426 virtual
agx::Bool reinitialize(
agx::UInt numberOfNodes,
429 agx::Real initialDistanceTension =
agx::Real( 0 ) );
436 void registerAsImplementationObject(
agx::RigidBody* rb ) const;
445 void onPostContact(
agxCollide::GeometryContact* geometryContact );
450 INITIALIZED = 1 << 0,
451 ACTIVE_TRACK_IMPLEMENTATION = 1 << 1
453 using State = agx::BitState<StateEnum, agx::UInt32>;
478 : wheelNodeContacts{}
484 WheelNodeContacts wheelNodeContacts;
485 NodeContacts nodeContacts;
486 GeometryContactContainer otherContacts;
489 struct TrackNodeTriplet
491 agx::Bool isValid()
const {
return prev !=
nullptr && node !=
nullptr && next !=
nullptr; }
503 TrackNodeTriplet findTrackNodeTriplet(
agx::UInt nodeIndex )
const;
504 TrackNodeTriplet findTrackNodeTriplet(
const agx::RigidBody* nodeRb )
const;
506 void onPreStepMergeNodes( TrackWheel& wheel,
const ContactData::NodeContacts* contacts,
agx::UIntVector& mergedNodeIndices );
507 void onPreStepHandleNonMergedNodes( TrackWheel& wheel,
agx::UIntVector& mergedNodeIndices );
508 void onPreStepSplitWheelMergedNodes( TrackWheel& wheel,
agx::UIntVector& mergedNodeIndices );
509 void onPreInternalMergeNodes(
const TrackInternalMergeProperties& properties );
511 void addAndConstrain( TrackNodeRef node, TrackNodeRef prev );
512 void constrain( TrackNode& curr, TrackNode& prev );
513 void merge( TrackWheel& wheel, TrackNode& node );
514 void merge( TrackNode& node1, TrackNode& node2,
agx::MergedBody& mergedBody );
516 void transformToWheel( TrackNode& node,
const TrackWheel& wheel )
const;
519 TrackWheelContainer m_wheels;
520 RigidBodyTrackWheelTable m_rbWheelTable;
522 ContactData m_contactData;
524 TrackInternalMergeProperties m_internalMergeProperties;
527 InitialTrackTension m_initialTension;
529 bool m_enableCollisionsWithSupport;
534 return LinkedStructure::getT<Track>( rb );
539 return LinkedStructure::getT<Track>( rb );
542 inline Track::TrackNodeTriplet Track::findTrackNodeTriplet(
agx::UInt nodeIndex )
const
553 *prevIt, *nodeIt, *nextIt,
554 prevIt.
index(), nodeIt.index(), nextIt.index()
558 inline Track::TrackNodeTriplet Track::findTrackNodeTriplet(
const agx::RigidBody* nodeRb )
const
581 auto node = LinkedStructure::getSegment( obj );
582 return node !=
nullptr ? node->as<
TrackNode>() :
nullptr;
587 return LinkedStructure::getSegmentIndex( rb );
592 return LinkedStructure::getSegmentIterator<TrackNode>( index,
true );
598 return LinkedStructure::getSegmentIterator<TrackNode>( obj,
true );
604 if ( obj ==
nullptr )
611 return m_initialTension;
616 return m_initialTension;
#define AGX_DECLARE_POINTER_TYPES(type)
#define AGXSTREAM_DECLARE_SERIALIZABLE(T)
Use this in a Serializable class to add the required methods Important: Use full namespace in the dec...
#define AGXVEHICLE_EXPORT
The geometry representation used by the collision detection engine.
Optionally unbounded linked structure segment iterator object to iterate segments in a SegmentStructu...
static LinkedSegmentIterator end(const agxSDK::LinkedSegmentContainer &segments)
Segment range object for linked structure.
agx::RigidBody * getRigidBody() const
Basic implementation of any structure where bodies are linked/constrained together in a well defined ...
const agxSDK::LinkedSegmentContainer & getSegmentsContainer() const
LinkedSegment * getSegment(agx::UInt index) const
agx::UInt getNumSegments() const
Simulation is a class that bridges the collision space agxCollide::Space and the dynamic simulation s...
Base class for a custom track implementation.
Properties and thresholds for internal merging of nodes in agxVehicle::Track.
Track node initialize callback, called when a track node has been created and is about to be added to...
Node/segment/shoe object in agxVehicle::Track.
Object containing properties of an agxVehicle::Track.
Track route object to initialize tracks.
Wheel used in tracked vehicles.
Assembly object representing a continuous track with a given number of shoes (nodes).
TrackWheel * findReferenceWheel() const
Reference wheel's rotation axis is defining the plane in which this track will be created.
agx::UInt32Vector onPreGetNodesWheelContacts(const TrackWheel *wheel) const
Node indices in contact with the given wheel.
agx::Bool remove(TrackWheelRef wheel)
Remove track wheel.
bool isInitialized() const
const GeometryContactContainer & onPreGetNodeOtherContacts(const TrackNode *node) const
Collected contacts of node vs.
agx::UInt getNumNodes() const
virtual void onPreStep() override
Called on simulation pre step event - after user preStep.
TrackInternalMergeProperties * getInternalMergeProperties() const
const GeometryContactContainer & onPreGetOtherContacts() const
Collected contacts that matches Track::get(rb) == this but isn't nodes vs.
TrackProperties * getProperties() const
virtual void onSetEnableCollisions(agxCollide::Geometry *geometry, agx::Bool enable) override
Called when collision state changed for given geometry.
TrackNode * findNode(const agx::Vec3 &worldPoint) const
Find the node closest to the given world point.
virtual agx::Bool initialize(TrackNodeOnInitializeCallback *onInitializeCallback=nullptr)
Initialize this track given already assigned route, added wheels, number of nodes and an initialize n...
virtual void onPostStep() override
Called on simulation post step event - after user postStep.
agx::UInt getNodeIndex(const agx::RigidBody *rb) const
bool getEnableFullDegreeModel() const
static const Track * get(const Wheel *wheel)
agx::UInt32 getSupportGroupId() const
static Track * find(agxSDK::Simulation *simulation, const agx::Uuid &uuid)
Find track instance given simulation and unique id.
static Track * find(agxSDK::Simulation *simulation, const agx::Name &name)
Find track instance given simulation and name.
Track(agx::UInt numberOfNodes, agx::Real width, agx::Real thickness, agx::Real initialDistanceTension=agx::Real(0))
Construct track given number of nodes, size and initial tension distance.
virtual void onGroupRemove(const agxSDK::LinkedStructure::IdData &group) override
Called when an existing group has been removed.
TrackNodeIterator Iterator
static TrackPtrVector findAll(agxSDK::Simulation *simulation)
Finds all agxVehicle::Track instances in the given simulation.
virtual void onGroupAdd(const agxSDK::LinkedStructure::IdData &group) override
Called when a new group has been added.
virtual void onAddNotification(agxSDK::Simulation *simulation) override
Called when addNotification is executed when this linked structure is added to the simulation.
Track(TrackRoute *route, InitialTrackTension initialTension)
Construct given a track route.
bool getEnableCollisionsWithSupport() const
Track(agx::RigidBody *referenceRigidBody, agx::UInt numberOfNodes, agx::Real width, agx::Real thickness, InitialTrackTension initialTension={})
Construct track given number of nodes, size and initial tension.
virtual void onMaterialNew() override
Called when a new material has been assigned.
virtual void onLastStep() override
Called on simulation last step event - after user lastStep.
Iterator getIterator(const T *obj) const
agx::Real getTension(const TrackNode &node) const
agx::Bool add(TrackWheelRef wheel, bool addToAssembly=true)
Add track wheel to this track before this track has been initialized.
std::function< void(const TrackNode &)> OnNodeInitializeCallback
TrackWheel * getWheel(const agx::RigidBody *rb) const
Iterator getIterator(agx::UInt index) const
agx::Bool removeSupportGroupId(agxCollide::Geometry *geometry) const
Remove this track's support group id from geometry.
TrackNode * getNode(agx::UInt index) const
static Track * get(agx::RigidBody *rb)
NodeRange nodes(IndexRange range) const
const Track::TrackWheelContainer & getWheels() const
TrackRoute * getRoute() const
virtual void onRemoveNotification(agxSDK::Simulation *simulation) override
Called when removeNotification is executed when this linked structure is removed from the simulation.
const InitialTrackTension & getInitialTension() const
agx::RigidBody * getReferenceRigidBody() const
virtual agx::Bool initialize(OnNodeInitializeCallback onInitializeCallback)
Initialize this track given already assigned route, added wheels, number of nodes and an initialize n...
static TrackPtrVector findAll(agxSDK::Simulation *simulation, const agx::Name &name)
Finds all track instances given simulation and name.
void setEnableCollisionsWithSupport(bool enable)
Enable/disable collisions between this track and geometries carrying this track's support group id.
static Track * get(Wheel *wheel)
agx::BitState< StateEnum, agx::UInt32 > State
agx::Bool addSupportGroupId(agxCollide::Geometry *geometry) const
Add this track's support group id to geometry.
virtual void onPostIntegrate() override
Called on simulation post integrate event - when transforms has been updated given current velocities...
virtual void onPreCollideStep() override
Called on simulation pre-collide step event - after user preCollide.
bool setEnableFullDegreeModel(bool enable)
Activates or deactivates the full degrees-of-freedom track model.
void setProperties(TrackProperties *properties)
Assign properties to this track.
TrackNode * getNode(const T *obj) const
Abstraction of a wheel of arbitrary geometry.
This class is a combined container which has the find complexity of a HashTable, deterministic iterat...
const ValueT get_or_return_default(const KeyT &k) const
Inheritance with partial specialization due to bug with ref_ptr containers.
Structure holding several "normal" rigid bodies.
Representation of a name string.
T * as()
Subclass casting.
The rigid body class, combining a geometric model and a frame of reference.
A UUID, or Universally unique identifier, is intended to uniquely identify information in a distribut...
Vector containing 'raw' data.
#define DOXYGEN_END_INTERNAL_BLOCK()
#define DOXYGEN_START_INTERNAL_BLOCK()
This namespace consists of a set of classes for handling geometric intersection tests including boole...
T nextIndex(T index, T size)
T prevIndex(T index, T size)
This namespace contains classes related to vehicles dynamics.
agx::ref_ptr< TrackRoute > TrackRouteRef
agx::ref_ptr< TrackProperties > TrackPropertiesRef
agx::ref_ptr< TrackImplementation > TrackImplementationRef
The agx namespace contains the dynamics/math part of the AGX Dynamics API.
AGXCORE_EXPORT const InvalidIndexStruct InvalidIndex
Group id 'union' of int id and name id.
Initial track tension representing either legacy distance offset per node, or an actual initial tensi...