AGXDynamics  2.31.1.0
agxVehicle::TrackWheel Class Reference

Wheel used in tracked vehicles. More...

#include <TrackWheel.h>

+ Inheritance diagram for agxVehicle::TrackWheel:

Public Types

using ConstraintContainer = agx::Vector< agx::ConstraintRef >
 
using ControlPointContainer = agx::Vec3Vector
 
enum  Model { SPROCKET, IDLER, ROLLER }
 
using Properties = agx::BitState< Property, agx::UInt32 >
 
enum  Property : agx::UInt32 { MERGE_NODES = 1 << 0, SPLIT_SEGMENTS = 1 << 2, MOVE_NODES_TO_ROTATION_PLANE = 1 << 3, MOVE_NODES_TO_WHEEL = 1 << 4 }
 

Public Member Functions

 TrackWheel (Model model, agx::Real radius, agx::RigidBody *rb, agx::FrameRef rbRelFrame=nullptr)
 Construct given property (wheel type), radius, rigid body and frame defining wheel center, up and rotation axes in the rigid body frame. More...
 
 TrackWheel (Model model, agx::Real radius, agx::RigidBody *rb, agx::AffineMatrix4x4 rbRelTransform)
 Construct given property (wheel type), radius, rigid body and transform defining wheel center, up and rotation axes in the rigid body frame. More...
 
template<typename T >
T * as ()
 Subclass casting. More...
 
template<typename T >
const T * as () const
 
template<typename T >
T * asSafe ()
 Safe subclass casting, return nullptr if template type does not match. More...
 
template<typename T >
const T * asSafe () const
 
template<typename T >
agx::ref_ptr< T > attachConstraint (const agx::Name &name, agx::RigidBody *other, agx::Real wheelCenterOffset)
 Create constraint with this wheel and some other rigid body. More...
 
agx::Hinge * attachHinge (const agx::Name &name, agx::RigidBody *other, agx::Real wheelCenterOffset)
 Specialized version of attachConstraint to create a hinge with this wheel body and other. More...
 
IndexRangeContainer findMergedNodesIndexRanges () const
 Finds merged nodes indices and splits the list into ranges where the indices aren't consecutive. More...
 
agx::UIntVector findMergedNodesIndices () const
 List of node indices merged to this wheel. More...
 
agx::Vec3 getCenterPosition () const
 
const char * getClassName () const override
 
agx::Constraint * getConstraint () const
 
agx::Constraint * getConstraint (const agx::Name &name) const
 
const ConstraintContainer & getConstraints () const
 
ControlPointContainer getControlPoints (agx::Real circleSegmentLength) const
 Creates a set of points defining the wheel circle, each length circleSegmentLength apart. More...
 
agx::Bool getControlPoints (agx::Real circleSegmentLength, ControlPointContainer &container) const
 Creates a set of points defining the wheel circle, each length circleSegmentLength apart. More...
 
agx::Bool getEnableProperty (Property property) const
 
bool getEnableSerialization () const
 
bool getEnableUuidGeneration ()
 
agx::UInt32 getIndex () const
 This index is given at creation of this object. More...
 
agx::Frame * getLocalFrame () const
 
agx::MergedBody * getMergedBody () const
 
Model getModel () const
 
agx::MergedBody * getOrCreateMergedBody (agxSDK::Simulation *simulation)
 
const Properties getProperties () const
 
agx::Real getRadius () const
 
int getReferenceCount () const
 
agx::RigidBody * getRigidBody () const
 
agx::Vec3 getRotationAxis () const
 
agx::Plane getRotationAxisPlane () const
 
agxStream::StorageAgent * getStorageAgent () const override
 
agxVehicle::Track * getTrack () const
 
agx::AffineMatrix4x4 getTransform () const
 
agx::Vec3 getUpAxis () const
 
agx::Uuid getUuid () const
 
agx::Bool hasControlPoint (const agx::Vec3 &point, const agx::Real epsilon=agx::REAL_SQRT_EPSILON) const
 
template<typename T >
bool is () const
 Subclass test. More...
 
bool isFinished () const
 
template<typename... ModelTypes>
agx::Bool isModel (ModelTypes... modelTypes) const
 
void reference (void *ptr=nullptr) const
 Explicitly increment the reference count by one, indicating that this object has another pointer which is referencing it. More...
 
virtual void restore (agxStream::InputArchive &in) override
 
void setEnableProperty (Property property, agx::Bool enable)
 Enable/disable a property for this wheel. More...
 
void setEnableSerialization (bool flag)
 Set to false to disable serialization of this object. More...
 
void setFinished ()
 Tells this class that it is restored correctly and should not be deleted during destruction of an Archive. More...
 
void setUuid (const agx::Uuid &uuid)
 Explicitly set a Uuid on a serializable object. More...
 
virtual void store (agxStream::OutputArchive &out) const override
 
void unreference (void *ptr=nullptr) const
 Decrement the reference count by one, indicating that a pointer to this object is referencing it. More...
 
void unreference_nodelete () const
 Decrement the reference count by one, indicating that a pointer to this object is referencing it. More...
 

Static Public Member Functions

static agxStream::Serializable * create ()
 
static agxStream::Serializable * create (agxStream::InputArchive &)
 
static const char * getConstructClassId ()
 
static void setEnableUuidGeneration (bool flag)
 Specify if there should be UUID:s generated for each new Serializable object. By default it is enabled. More...
 
template<typename T >
static bool ValidateCast (const Referenced *object)
 

Protected Member Functions

 TrackWheel ()
 
virtual ~TrackWheel ()
 
void allocateObserverVector () const
 
void deleteUsingDeleteHandler () const
 
void generateUuid ()
 

Static Protected Member Functions

static DeleteHandler * getDeleteHandler ()
 
static void setDeleteHandler (DeleteHandler *handler)
 Internal: Set a DeleteHandler to which deletion of all referenced counted objects will be delegated to. More...
 

Protected Attributes

Mutex m_mutex
 
ObserverContainer m_observers
 
AtomicValue m_refCount
 

Detailed Description

Wheel used in tracked vehicles.

Definition at line 31 of file TrackWheel.h.

Member Typedef Documentation

◆ ConstraintContainer

Definition at line 40 of file Wheel.h.

◆ ControlPointContainer

◆ Properties

Definition at line 63 of file TrackWheel.h.

Member Enumeration Documentation

◆ Model

Enumerator
SPROCKET 

Sprocket - geared driving wheel with default property MERGE_NODES.

IDLER 

Idler - geared non-powered wheel with default property MERGE_NODES.

ROLLER 

Roller - track return or road wheel.

Definition at line 34 of file TrackWheel.h.

◆ Property

Enumerator
MERGE_NODES 

Wheels with this property and nodes will merge to them, simulating geared, non-slip, type of properties.

SPLIT_SEGMENTS 

Wheels with this property will split segments, i.e., intermediate nodes that are merged.

Use this property on ROLLER models where the track changes angle.

MOVE_NODES_TO_ROTATION_PLANE 

If enabled - when a node is merged to the wheel, move the node into the plane defined by the wheel center position and rotation axis.

This will prevent the tracks from sliding of its path but all wheels with MERGE_NODES must be aligned. Default: Disabled

MOVE_NODES_TO_WHEEL 

Similar to MOVE_NODE_TO_ROTATION_PLANE but this property will also make sure the node is moved to the surface of the wheel.

Default: Disabled

Definition at line 41 of file TrackWheel.h.

Constructor & Destructor Documentation

◆ TrackWheel() [1/3]

agxVehicle::TrackWheel::TrackWheel ( Model  model,
agx::Real  radius,
agx::RigidBody *  rb,
agx::FrameRef  rbRelFrame = nullptr 
)

Construct given property (wheel type), radius, rigid body and frame defining wheel center, up and rotation axes in the rigid body frame.

Rotation axis is by definition the y axis in rbRelFrame (if given, otherwise y axis of rb).

Up axis is by definition the z axis in rbRelFrame (if given, otherwise z axis of rb).

Parameters
model- wheel model
radius- radius of the wheel
rb- wheel rigid body
rbRelFrame- frame defining center position, up and rotation axes in rb frame

◆ TrackWheel() [2/3]

agxVehicle::TrackWheel::TrackWheel ( Model  model,
agx::Real  radius,
agx::RigidBody *  rb,
agx::AffineMatrix4x4  rbRelTransform 
)

Construct given property (wheel type), radius, rigid body and transform defining wheel center, up and rotation axes in the rigid body frame.

Rotation axis is by definition the y axis in rbRelFrame (if given, otherwise y axis of rb).

Up axis is by definition the z axis in rbRelFrame (if given, otherwise z axis of rb).

Parameters
model- wheel model
radius- radius of the wheel
rb- wheel rigid body
rbRelTransform- transform defining center position, up and rotation axes in rb frame

◆ TrackWheel() [3/3]

agxVehicle::TrackWheel::TrackWheel ( )
protected

◆ ~TrackWheel()

virtual agxVehicle::TrackWheel::~TrackWheel ( )
protectedvirtual

Member Function Documentation

◆ allocateObserverVector()

void agx::Referenced::allocateObserverVector ( ) const
protectedinherited

◆ as() [1/2]

template<typename T >
T* agx::Referenced::as ( )
inherited

Subclass casting.

Template type must match actual type, dynamic_cast assertion will fail otherwise.

Referenced by agx::InternalData::get(), agxVehicle::Track::getNode(), agx::InternalData::getOrCreate(), and agx::InternalData::hasData().

◆ as() [2/2]

template<typename T >
const T* agx::Referenced::as ( ) const
inherited

◆ asSafe() [1/2]

template<typename T >
T* agx::Referenced::asSafe ( )
inherited

Safe subclass casting, return nullptr if template type does not match.

Referenced by agxUtil::CollectBodiesAndWiresVisitor::visit().

◆ asSafe() [2/2]

template<typename T >
const T* agx::Referenced::asSafe ( ) const
inherited

◆ attachConstraint()

template<typename T >
agx::ref_ptr< T > agxVehicle::Wheel::attachConstraint ( const agx::Name &  name,
agx::RigidBody *  other,
agx::Real  wheelCenterOffset 
)
inherited

Create constraint with this wheel and some other rigid body.

The constraint axis will point along the rotation axis and it's possible to offset the center along that same axis.

The constraint is stored and accessible through the given name. The constraint will be added to the simulation when this wheel is used in an agxVehicle object.

Parameters
name- name of the constraint
other- other rigid body
wheelCenterOffset- offset along the rotation axis (from center of this wheel)
Returns
constraint with this wheel body as first and other as second body in the constraint

Definition at line 181 of file Wheel.h.

References agx::RigidBody::getTransform(), and agx::AffineMatrix4x4T< T >::inverse().

◆ attachHinge()

agx::Hinge* agxVehicle::Wheel::attachHinge ( const agx::Name &  name,
agx::RigidBody *  other,
agx::Real  wheelCenterOffset 
)
inherited

Specialized version of attachConstraint to create a hinge with this wheel body and other.

See also
attachConstraint
Parameters
name- name of the hinge
other- other rigid body
wheelCenterOffset- offset along the rotation axis (from center if this wheel)
Returns
hinge with this wheel body as first and other as second body in the hinge

◆ create() [1/2]

static agxStream::Serializable* agxVehicle::Wheel::create ( )
inlinestaticinherited

Definition at line 157 of file Wheel.h.

◆ create() [2/2]

static agxStream::Serializable* agxVehicle::Wheel::create ( agxStream::InputArchive &  )
inlinestaticinherited

Definition at line 157 of file Wheel.h.

◆ deleteUsingDeleteHandler()

void agx::Referenced::deleteUsingDeleteHandler ( ) const
protectedinherited

◆ findMergedNodesIndexRanges()

IndexRangeContainer agxVehicle::TrackWheel::findMergedNodesIndexRanges ( ) const

Finds merged nodes indices and splits the list into ranges where the indices aren't consecutive.

Note that if the first and the last node both are in the list the last node will be included in the first range. E.g., instead of [[0, 1, 2, 3] [78, 79]] the resulting range could be (given it's 80 nodes in the track) [78, 79, 0, 1, 2, 3],

◆ findMergedNodesIndices()

agx::UIntVector agxVehicle::TrackWheel::findMergedNodesIndices ( ) const

List of node indices merged to this wheel.

The resulting list is sorted with lowest index first.

◆ generateUuid()

void agxStream::Serializable::generateUuid ( )
protectedinherited

◆ getCenterPosition()

agx::Vec3 agxVehicle::Wheel::getCenterPosition ( ) const
inherited
Returns
center position of this wheel, in world coordinate system

◆ getClassName()

const char* agxVehicle::Wheel::getClassName ( ) const
inlineoverridevirtualinherited
Returns
the class name of this class.

Reimplemented from agxStream::Serializable.

Definition at line 157 of file Wheel.h.

◆ getConstraint() [1/2]

agx::Constraint* agxVehicle::Wheel::getConstraint ( ) const
inherited
Returns
first constraint (null if no constraints has been attached with attachConstraint)

◆ getConstraint() [2/2]

agx::Constraint* agxVehicle::Wheel::getConstraint ( const agx::Name &  name) const
inherited
Parameters
name- name of the constraint to find
Returns
constraint with the given name

◆ getConstraints()

const ConstraintContainer& agxVehicle::Wheel::getConstraints ( ) const
inherited
Returns
vector with attached constraints created with attachConstraint

◆ getConstructClassId()

static const char* agxVehicle::Wheel::getConstructClassId ( )
inlinestaticinherited

Definition at line 157 of file Wheel.h.

◆ getControlPoints() [1/2]

ControlPointContainer agxVehicle::TrackWheel::getControlPoints ( agx::Real  circleSegmentLength) const

Creates a set of points defining the wheel circle, each length circleSegmentLength apart.

The points are given in the world coordinate frame.

Parameters
circleSegmentLength- desired circle segment length between each point
Returns
points defining the wheel circle, given in world coordinate frame

◆ getControlPoints() [2/2]

agx::Bool agxVehicle::TrackWheel::getControlPoints ( agx::Real  circleSegmentLength,
ControlPointContainer &  container 
) const

Creates a set of points defining the wheel circle, each length circleSegmentLength apart.

The points are given in the world coordinate frame and will be added to container.

Parameters
circleSegmentLength- desired circle segment length between each point
container- control points will be added to this container
Returns
true if points were added - otherwise false

◆ getDeleteHandler()

static DeleteHandler* agx::Referenced::getDeleteHandler ( )
staticprotectedinherited
Returns
a DeleteHandler.

◆ getEnableProperty()

agx::Bool agxVehicle::TrackWheel::getEnableProperty ( TrackWheel::Property  property) const
inline
Parameters
property- wheel property
Returns
true if the property is enabled - otherwise false

Definition at line 226 of file TrackWheel.h.

◆ getEnableSerialization()

bool agxStream::Serializable::getEnableSerialization ( ) const
inherited
Returns
true if serialization is enabled for this object

Definition at line 273 of file Serializable.h.

◆ getEnableUuidGeneration()

bool agxStream::Serializable::getEnableUuidGeneration ( )
inherited
Returns
true if Uuid:s should be generated for each new Serializable object

◆ getIndex()

agx::UInt32 agxStream::Serializable::getIndex ( ) const
inherited

This index is given at creation of this object.

It is guaranteed to be unique for the lifetime of this library instance. As long as the application is running. This value is not serialized or restored. A new object will always get a new index no matter how it is created.

Returns
an instance index of this object. This is unique for the lifetime of this library instance.

Definition at line 247 of file Serializable.h.

◆ getLocalFrame()

agx::Frame* agxVehicle::Wheel::getLocalFrame ( ) const
inherited
Returns
the local frame to the wheel body

◆ getMergedBody()

agx::MergedBody * agxVehicle::TrackWheel::getMergedBody ( ) const
inline
Returns
merged body of this wheel - if something is merged to it

Definition at line 206 of file TrackWheel.h.

◆ getModel()

Model agxVehicle::TrackWheel::getModel ( ) const
Returns
the model of this track wheel

◆ getOrCreateMergedBody()

agx::MergedBody* agxVehicle::TrackWheel::getOrCreateMergedBody ( agxSDK::Simulation *  simulation)
Returns
an already created instance or creates a new instance of a merged body

◆ getProperties()

const TrackWheel::Properties agxVehicle::TrackWheel::getProperties ( ) const
inline
Returns
the properties of this wheel

Definition at line 221 of file TrackWheel.h.

◆ getRadius()

agx::Real agxVehicle::Wheel::getRadius ( ) const
inherited
Returns
the radius of this wheel

◆ getReferenceCount()

int agx::Referenced::getReferenceCount ( ) const
inherited
Returns
the number pointers currently referencing this object.

◆ getRigidBody()

agx::RigidBody* agxVehicle::Wheel::getRigidBody ( ) const
inherited
Returns
the wheel rigid body

◆ getRotationAxis()

agx::Vec3 agxVehicle::Wheel::getRotationAxis ( ) const
inherited
Returns
wheel axis in world coordinate system

◆ getRotationAxisPlane()

agx::Plane agxVehicle::Wheel::getRotationAxisPlane ( ) const
inherited
Returns
the plane defined by the rotation axis

◆ getStorageAgent()

agxStream::StorageAgent* agxVehicle::Wheel::getStorageAgent ( ) const
inlineoverridevirtualinherited
Returns
the storage agent

Implements agxStream::Serializable.

Definition at line 157 of file Wheel.h.

◆ getTrack()

Track * agxVehicle::TrackWheel::getTrack ( ) const
inline
Returns
track instance this track wheel belongs to

Definition at line 231 of file TrackWheel.h.

◆ getTransform()

agx::AffineMatrix4x4 agxVehicle::Wheel::getTransform ( ) const
inherited
Returns
the transform of this wheel

◆ getUpAxis()

agx::Vec3 agxVehicle::Wheel::getUpAxis ( ) const
inherited
Returns
wheel up axis in world coordinate system

◆ getUuid()

agx::Uuid agxStream::Serializable::getUuid ( ) const
inherited
Returns
a unique id for this instance.

Definition at line 268 of file Serializable.h.

Referenced by agxSDK::UuidHashCollisionFilter::match().

◆ hasControlPoint()

agx::Bool agxVehicle::TrackWheel::hasControlPoint ( const agx::Vec3 &  point,
const agx::Real  epsilon = agx::REAL_SQRT_EPSILON 
) const
Returns
true if the given point can be assumed to be a control point on this wheel

◆ is()

template<typename T >
bool agx::Referenced::is ( ) const
inherited

◆ isFinished()

bool agxStream::Serializable::isFinished ( ) const
inherited
Returns
true if this class is restored correctly and should not be deleted during destruction of an Archive.

Definition at line 252 of file Serializable.h.

References AGX_FORCE_INLINE.

◆ isModel()

template<typename... ModelTypes>
agx::Bool agxVehicle::TrackWheel::isModel ( ModelTypes...  modelTypes) const
inline
Returns
true if this track wheel model matches any of the arguments

Definition at line 212 of file TrackWheel.h.

◆ reference()

void agx::Referenced::reference ( void *  ptr = nullptr) const
inherited

Explicitly increment the reference count by one, indicating that this object has another pointer which is referencing it.

This method should be used with care, always balanced with the same number of calls to unreference.

◆ restore()

virtual void agxVehicle::Wheel::restore ( agxStream::InputArchive &  in)
overridevirtualinherited

◆ setDeleteHandler()

static void agx::Referenced::setDeleteHandler ( DeleteHandler *  handler)
staticprotectedinherited

Internal: Set a DeleteHandler to which deletion of all referenced counted objects will be delegated to.

◆ setEnableProperty()

void agxVehicle::TrackWheel::setEnableProperty ( Property  property,
agx::Bool  enable 
)

Enable/disable a property for this wheel.

Parameters
property- property to enable/disable
enable- true to enable the property, false to disable

◆ setEnableSerialization()

void agxStream::Serializable::setEnableSerialization ( bool  flag)
inherited

Set to false to disable serialization of this object.

It will just be ignored during serialization (writing). It is still possible to restore TO this object.

◆ setEnableUuidGeneration()

static void agxStream::Serializable::setEnableUuidGeneration ( bool  flag)
staticinherited

Specify if there should be UUID:s generated for each new Serializable object. By default it is enabled.

◆ setFinished()

void agxStream::Serializable::setFinished ( )
inherited

Tells this class that it is restored correctly and should not be deleted during destruction of an Archive.

◆ setUuid()

void agxStream::Serializable::setUuid ( const agx::Uuid &  uuid)
inherited

Explicitly set a Uuid on a serializable object.

Use this method with great care, as it can result in non-unique identifiers in the system!

◆ store()

virtual void agxVehicle::Wheel::store ( agxStream::OutputArchive &  out) const
overridevirtualinherited

◆ unreference()

void agx::Referenced::unreference ( void *  ptr = nullptr) const
inherited

Decrement the reference count by one, indicating that a pointer to this object is referencing it.

If the reference count goes to zero, it is assumed that this object is no longer referenced and is automatically deleted.

This method should be used with care, always balanced with the same number of calls to reference.

Referenced by agxData::EntityRef< ContactMaterialPtr >::~EntityRef().

◆ unreference_nodelete()

void agx::Referenced::unreference_nodelete ( ) const
inherited

Decrement the reference count by one, indicating that a pointer to this object is referencing it.

However, do not delete it, even if ref count goes to 0. Warning, unref_nodelete() should only be called if the user knows exactly who will be responsible for, one should prefer unref() over unref_nodelete() as the later can lead to memory leaks.

◆ ValidateCast()

template<typename T >
static bool agx::Referenced::ValidateCast ( const Referenced *  object)
staticinherited

Member Data Documentation

◆ m_mutex

Mutex agx::Referenced::m_mutex
mutableprotectedinherited

Definition at line 240 of file Referenced.h.

◆ m_observers

ObserverContainer agx::Referenced::m_observers
mutableprotectedinherited

Definition at line 239 of file Referenced.h.

◆ m_refCount

AtomicValue agx::Referenced::m_refCount
mutableprotectedinherited

Definition at line 241 of file Referenced.h.


The documentation for this class was generated from the following file: