AGX Dynamics 2.42.3.1
Loading...
Searching...
No Matches
ReducedOrderTrackImplementation.h
Go to the documentation of this file.
1/*
2Copyright 2007-2025. Algoryx Simulation AB.
3
4All AGX source code, intellectual property, documentation, sample code,
5tutorials, scene files and technical white papers, are copyrighted, proprietary
6and confidential material of Algoryx Simulation AB. You may not download, read,
7store, distribute, publish, copy or otherwise disseminate, use or expose this
8material unless having a written signed agreement with Algoryx Simulation AB, or having been
9advised so by Algoryx Simulation AB for a time limited evaluation, or having purchased a
10valid commercial license from Algoryx Simulation AB.
11
12Algoryx Simulation AB disclaims all responsibilities for loss or damage caused
13from using this software, unless otherwise stated in written agreements with
14Algoryx Simulation AB.
15*/
16
17#pragma once
18
23
24#include <agxUtil/agxUtil.h>
25#include <agxSDK/Assembly.h>
26
27#include <agx/LockJoint.h>
28
29namespace agx
30{
31 class GenericManyBodyConstraint;
32}
33
34namespace agxVehicle
35{
43 {
50 void merge( TrackNode& node );
51
57 void restoreCollisionState( TrackNode& node ) const;
58
59 agx::RigidBodyRef rigidBody = nullptr;
60 agx::LockJointRef constraint = nullptr;
61 agx::MergedBodyRef mergedBody = nullptr;
62 };
63
71 {
72 public:
73 static ReducedOrderTrackImplementation& get( const TrackImplementation& implementation );
74
75 public:
83
88
92 virtual bool isInitialized() const override;
93
98
106
111
117
123
135
142 virtual agx::Real getTension( const TrackNode& node ) const override;
143
150 agx::Real getTension( agx::Int wheelIndex ) const;
151
156 agx::Real getBendForce( agx::Int wheelIndex ) const;
157
159
160 public:
162
163 void add( agx::GenericManyBodyConstraint* sensorConstraint, size_t wheelSensorDataIndex );
164
165 void setTrackSegmentTargetTransform( const WheelTangentData& trackSegment, const TrackWheelSensorData& wheelData ) const;
166
167 bool isTrackSegment( const agx::RigidBody* rb ) const;
168
169 const TrackWheel* getWheelGivenPotentialWheelSensor( const agx::RigidBody* rb ) const;
170
171 agx::ConstraintRef getTrackMasslessConstraint() const;
172
173 agx::ConstraintRef getSensorFrictionConstraint() const;
174
176
177 virtual void store( agxStream::OutputArchive& out, const Track& track ) const override;
178
179 virtual void restore( agxStream::InputArchive& in, const Track& track ) override;
180
181 public:
183
184 virtual void onAddNotification() override;
185
186 virtual void onRemoveNotification() override;
187
188 virtual void onMaterialNew() override;
189
190 virtual void onGroupAdd( const agxSDK::LinkedStructure::IdData& group ) override;
191
192 virtual void onGroupRemove( const agxSDK::LinkedStructure::IdData& group ) override;
193
194 virtual void onPreStep() override;
195
196 virtual void onPostStep() override;
197
198 virtual void onPostIntegrate() override;
199
200 virtual void onPostContact( agxCollide::GeometryContact* geometryContact ) override;
201
203
204 private:
205 struct InternalState
206 {
207 enum Flag : agx::UInt32
208 {
209 INITIALIZED = 1 << 0,
210 RESTORED = 1 << 2,
211 CURVATURE_INCLUDE_WHEEL_CONTACTS = 1 << 3
212 };
213 using Flags = agx::BitState<Flag, std::underlying_type_t<Flag>>;
214
215 bool isInitialized() const
216 {
217 return flags.Is( INITIALIZED );
218 }
219
220 Flags flags;
221 };
222
223 private:
224 bool initialize();
225
226 void bindWheelSensorGeometriesToTires();
227 void unbindWheelSensorGeometriesFromTires();
228
229 void updatePrismaticBrakes();
230
231 void updateTrackCurveEventGenerator();
232
233 private:
234 agx::RigidBodyRef m_chassis;
235 ChassisProxyData m_chassisProxyData;
236 TrackWheelSensorDataRefVector m_wheelsSensorData;
237 TrackNodeAnimatorRef m_nodeAnimator;
238 agx::ConstraintRef m_trackMasslessConstraints;
239 agx::ConstraintRef m_sensorContactConstraint;
240 InternalState m_state;
241 ReducedOrderTrackProperties m_properties;
242 agx::UInt32 m_wheelSensorGroupId;
244 };
245
247 {
248 agxAssert( implementation.is<TrackImplementation>() );
249 return const_cast<ReducedOrderTrackImplementation&>(static_cast<const ReducedOrderTrackImplementation&>(implementation));
250 }
251}
#define AGXSTREAM_DECLARE_SERIALIZABLE(T)
Use this in a Serializable class to add the required methods Important: Use full namespace in the dec...
Definition: Serializable.h:207
#define AGXVEHICLE_EXPORT
TrackNodeAnimator * getTrackNodeAnimator() const
const ChassisProxyData & getChassisProxyData() const
ReducedOrderTrackImplementation(agx::RigidBody *chassis)
Construct given chassis.
const TrackWheelSensorDataRefVector & getWheelSensorData() const
The wheel sensor data vector is sorted in order of the track nodes from an implementation defined poi...
agx::Real getBendForce(agx::Int wheelIndex) const
Get force at the bend constraint associated with the given sensor segment index.
virtual bool isInitialized() const override
void setProperties(const ReducedOrderTrackProperties &properties)
Replace the internal Reduced-Order properties for this track model.
ReducedOrderTrackProperties & getProperties()
These properties gives control over internal model dependent features and parameters.
const ReducedOrderTrackProperties & getProperties() const
These properties gives control over internal model dependent features and parameters.
agx::Real getTension(agx::Int wheelIndex) const
Get tension at the given sensor segment index.
static ReducedOrderTrackImplementation & get(const TrackImplementation &implementation)
virtual agx::Real getTension(const TrackNode &node) const override
Get tension at the massless wire segment closes to this node.
This is the properties/settings of an agxVehicle::ReducedOrderTrackImplementation.
Base class for a custom track implementation.
Animates the track nodes going around a set of wheels.
Node/segment/shoe object in agxVehicle::Track.
Definition: TrackNode.h:47
Additional data for wheels and segments between wheels of a track where the nodes aren't simulated.
Wheel used in tracked vehicles.
Definition: TrackWheel.h:32
Assembly object representing a continuous track with a given number of shoes (nodes).
bool is() const
Subclass test.
The rigid body class, combining a geometric model and a frame of reference.
Definition: RigidBody.h:49
#define agxAssert(expr)
Definition: debug.h:143
#define DOXYGEN_END_INTERNAL_BLOCK()
Definition: macros.h:89
#define DOXYGEN_START_INTERNAL_BLOCK()
Definition: macros.h:88
This namespace consists of a set of classes for handling geometric intersection tests including boole...
The agxSDK namespace contain classes to bridge the collision detection system and the dynamical simul...
Definition: Constraint.h:31
This namespace contain classes for streaming classes into archives, ASCII, binary for storage (serial...
This namespace contains classes related to vehicles dynamics.
agx::ref_ptr< TrackNodeAnimator > TrackNodeAnimatorRef
agx::Vector< TrackWheelSensorDataRef > TrackWheelSensorDataRefVector
The agx namespace contains the dynamics/math part of the AGX Dynamics API.
uint32_t UInt32
Definition: Integer.h:32
double Real
Definition: Real.h:41
int64_t Int
Definition: Integer.h:28
Proxy body, locked to the chassis, which all track node bodies are merged with.
void merge(TrackNode &node)
Merge the given node to the proxy rigid body.
void restoreCollisionState(TrackNode &node) const
Restores the collision state the given node had before being merged with the proxy body.
Data for an external tangent between two wheels.