AGX Dynamics 2.42.3.1
Loading...
Searching...
No Matches
agxVehicle::TrackWheel Class Reference

Wheel used in tracked vehicles. More...

#include <TrackWheel.h>

+ Inheritance diagram for agxVehicle::TrackWheel:

Public Types

using ControlPointCallback = std::function< void(agx::Vec3)>
 
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 Types inherited from agxVehicle::Wheel
using ConstraintContainer = agx::Vector< agx::ConstraintRef >
 

Public Member Functions

 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.
 
 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.
 
IndexRangeContainer findMergedNodesIndexRanges () const
 Finds merged nodes indices and splits the list into ranges where the indices aren't consecutive.
 
agx::UIntVector findMergedNodesIndices () const
 List of node indices merged to this wheel.
 
agx::Vec3Vector getControlPoints (agx::Real circleSegmentLength, agx::Real surfaceOffset) const
 Creates a set of points defining the wheel circle, each length circleSegmentLength apart.
 
void getControlPoints (agx::Real circleSegmentLength, agx::Real surfaceOffset, ControlPointCallback callback) const
 Creates a set of points defining the wheel circle, each length circleSegmentLength apart.
 
agx::Vec3Vector getControlPoints (const agx::Vec3 &referencePoint, agx::Real circleSegmentLength) const
 Creates a set of points defining the wheel circle given a reference point.
 
void getControlPoints (const agx::Vec3 &referencePoint, agx::Real circleSegmentLength, ControlPointCallback callback) const
 Creates a set of points defining the wheel circle given a reference point.
 
agx::Vec3Vector getControlPoints (const WheelTangentData &incidentTangent, const WheelTangentData &exitTangent, agx::Real circleSegmentLength) const
 Control points from incident tangent end to exit tangent begin.
 
void getControlPoints (const WheelTangentData &incidentTangent, const WheelTangentData &exitTangent, agx::Real circleSegmentLength, ControlPointCallback callback) const
 Control points from incident tangent end to exit tangent begin.
 
agx::Bool getEnableProperty (Property property) const
 
agx::Vec3 getExtremePoint (const WheelTangentData &incidentTangent, const WheelTangentData &exitTangent) const
 Given incident tangent incidentTangent and exit tangent exitTangent, the extreme point is in the middle of incident tangent end and exit tangent begin.
 
agx::MergedBody * getMergedBody () const
 
Model getModel () const
 
agx::MergedBody * getOrCreateMergedBody ()
 
const Properties getProperties () const
 
agxVehicle::Track * getTrack () const
 
agx::Vec3 getTrackExtremePoint (const TrackWheel &prevWheel, const TrackWheel &nextWheel) const
 Given incident tangent from prevWheel and exit tangent to nextWheel, the track extreme point is in the middle of incident tangent end and exit tangent begin, offset 0.5 * track thickness (if known) from the surface of this wheel.
 
agx::Bool hasControlPoint (const agx::Vec3 &point, const agx::Real epsilon=agx::REAL_SQRT_EPSILON) const
 
template<typename... ModelTypes>
agx::Bool isModel (ModelTypes... modelTypes) const
 
void setEnableProperty (Property property, agx::Bool enable)
 Enable/disable a property for this wheel.
 
- Public Member Functions inherited from agxVehicle::Wheel
 Wheel (agx::Real radius, agx::RigidBody *rb, agx::AffineMatrix4x4 rbRelTransform)
 Construct wheel given radius, wheel body and transform defining wheel center, up and rotation axes in the rigid body frame.
 
 Wheel (agx::Real radius, agx::RigidBody *rb, agx::Frame *rbRelFrame=nullptr)
 Construct wheel given radius, wheel body and frame defining wheel center, up and rotation axes in the rigid body frame.
 
 AGXSTREAM_DECLARE_SERIALIZABLE_BASE (agxVehicle::Wheel)
 
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.
 
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.
 
agx::Vec3 getCenterPosition () const
 
agx::Constraint * getConstraint () const
 
agx::Constraint * getConstraint (const agx::Name &name) const
 
const ConstraintContainer & getConstraints () const
 
agx::Frame * getLocalFrame () const
 
agx::Real getRadius () const
 
agx::RigidBody * getRigidBody () const
 
agx::Vec3 getRotationAxis () const
 
agx::Plane getRotationAxisPlane () const
 
agx::AffineMatrix4x4 getTransform () const
 
agx::Vec3 getUpAxis () const
 
WheelTangentData tangentFrom (const agx::Vec3 &point, agx::Real offsetFromSurface=0.0, agx::Real wrapSign=-1.0) const
 Calculates tangent from the given world point to wheel.
 
WheelTangentData tangentTo (const agx::Vec3 &point, agx::Real offsetFromSurface=0.0, agx::Real wrapSign=-1.0) const
 Calculates tangent from this wheel to a world point.
 
WheelTangentData tangentTo (const Wheel &other, agx::Real offsetFromSurface=0.0, agx::Real wrapSign=-1.0) const
 
- Public Member Functions inherited from agx::Referenced
 Referenced ()
 Default constructor.
 
 Referenced (const Referenced &)
 
template<typename T >
T * as ()
 Subclass casting.
 
template<typename T >
const T * as () const
 
template<typename T >
T * asSafe ()
 Safe subclass casting, return nullptr if template type does not match.
 
template<typename T >
const T * asSafe () const
 
int getReferenceCount () const
 
template<typename T >
bool is () const
 Subclass test.
 
Referenced & operator= (const Referenced &)
 Assignment operator. Will increment the number of references to the referenced object.
 
void reference (void *ptr=nullptr) const
 Explicitly increment the reference count by one, indicating that this object has another pointer which is referencing it.
 
void unreference (void *ptr=nullptr) const
 Decrement the reference count by one, indicating that a pointer to this object is referencing it.
 
void unreference_nodelete () const
 Decrement the reference count by one, indicating that a pointer to this object is referencing it.
 
- Public Member Functions inherited from agxStream::Serializable
virtual ~Serializable ()
 Destructor for normal C++ use but hidden from SWIG bindings.
 
virtual const char * getClassName () const
 
bool getEnableSerialization () const
 
bool getEnableUuidGeneration ()
 
agx::UInt32 getIndex () const
 This index is given at creation of this object.
 
virtual StorageAgent * getStorageAgent () const =0
 
agx::Uuid getUuid () const
 
bool isFinished () const
 
void setEnableSerialization (bool flag)
 Set to false to disable serialization of this object.
 
void setFinished ()
 Tells this class that it is restored correctly and should not be deleted during destruction of an Archive.
 
void setUuid (const agx::Uuid &uuid)
 Explicitly set a Uuid on a serializable object.
 

Protected Member Functions

 TrackWheel ()
 
virtual ~TrackWheel ()
 
- Protected Member Functions inherited from agxVehicle::Wheel
 Wheel ()
 Default constructor used only when this object is restored.
 
virtual ~Wheel ()
 Reference counted object - protected destructor.
 
- Protected Member Functions inherited from agx::Referenced
virtual ~Referenced ()
 Destructor.
 
void allocateObserverVector () const
 
void deleteUsingDeleteHandler () const
 
- Protected Member Functions inherited from agxStream::Serializable
 Serializable ()
 Default constructor.
 
 Serializable (const Serializable &other)
 Copy constructor.
 
void generateUuid ()
 

Additional Inherited Members

- Static Public Member Functions inherited from agxVehicle::Wheel
static agxStream::Serializable * create (agxStream::InputArchive &)
 
static agx::AffineMatrix4x4 findRelativeTransform (const agx::RigidBody *wheelBody, const agx::Hinge *hinge, agx::Real sign=1.0)
 Calculates a transformation such that, when applied to a wheel with the given rigid body, the wheel's transformation becomes aligned with the hinge's transformation.
 
static agx::AffineMatrix4x4 findRelativeTransform (const agx::RigidBody *wheelBody, const agx::Vec3 &rotationAxis)
 Calculates a transformation such that, when applied to a wheel with the given rigid body, the wheel's transformation becomes aligned with the given axis.
 
- Static Public Member Functions inherited from agx::Referenced
template<typename T >
static bool ValidateCast (const Referenced *object)
 
- Static Public Member Functions inherited from agxStream::Serializable
static void setEnableUuidGeneration (bool flag)
 Specify if there should be UUID:s generated for each new Serializable object. By default it is enabled.
 
- Static Protected Member Functions inherited from agx::Referenced
static DeleteHandler * getDeleteHandler ()
 
static void setDeleteHandler (DeleteHandler *handler)
 Internal: Set a DeleteHandler to which deletion of all referenced counted objects will be delegated to.
 
- Protected Attributes inherited from agx::Referenced
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

◆ ControlPointCallback

Definition at line 58 of file TrackWheel.h.

◆ Properties

Definition at line 59 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

◆ 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.

◆ getControlPoints() [1/6]

agx::Vec3Vector agxVehicle::TrackWheel::getControlPoints ( agx::Real  circleSegmentLength,
agx::Real  surfaceOffset 
) 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
surfaceOffset- control points offset from the wheel surface
Returns
points defining the wheel circle, given in world coordinate frame

◆ getControlPoints() [2/6]

void agxVehicle::TrackWheel::getControlPoints ( agx::Real  circleSegmentLength,
agx::Real  surfaceOffset,
ControlPointCallback  callback 
) const

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

The points are given in the world coordinate frame. For all points the ControlPointCallback is called.

Parameters
circleSegmentLength- desired circle segment length between each point
surfaceOffset- control points offset from the wheel surface
callback- control points are passed to this callback

◆ getControlPoints() [3/6]

agx::Vec3Vector agxVehicle::TrackWheel::getControlPoints ( const agx::Vec3 &  referencePoint,
agx::Real  circleSegmentLength 
) const

Creates a set of points defining the wheel circle given a reference point.

The length from this wheels center to the reference point will be the same for all control points. The given reference point will be the first control point.

Parameters
referencePoint- reference point that should be included in the control points
circleSegmentLength- desired circle segment length between each point

◆ getControlPoints() [4/6]

void agxVehicle::TrackWheel::getControlPoints ( const agx::Vec3 &  referencePoint,
agx::Real  circleSegmentLength,
ControlPointCallback  callback 
) const

Creates a set of points defining the wheel circle given a reference point.

The length from this wheels center to the reference point will be the same for all control points. The given reference point will be the first control point.

Parameters
referencePoint- reference point that should be included in the control points
circleSegmentLength- desired circle segment length between each point
callback- control points are passed to this callback

◆ getControlPoints() [5/6]

agx::Vec3Vector agxVehicle::TrackWheel::getControlPoints ( const WheelTangentData &  incidentTangent,
const WheelTangentData &  exitTangent,
agx::Real  circleSegmentLength 
) const

Control points from incident tangent end to exit tangent begin.

If the tangents "wraps" this wheel, the end of the incident and begin of the exit tangent will always be part of the control points. If the tangents points away from this wheel the only control point is in the direction where the tangents crosses each other. The offset from the surface of the tangents are preserved in the control points and it's assumed both incident and exit tangents has the same offset.

Parameters
incidentTangent- the incident tangent, incidentTangent.end is the first control point
exitTangent- the exit tangent, exitTangent.begin is the last control point
circleSegmentLength- desired circle segment length between each point
Returns
the control points between the two tangents

◆ getControlPoints() [6/6]

void agxVehicle::TrackWheel::getControlPoints ( const WheelTangentData &  incidentTangent,
const WheelTangentData &  exitTangent,
agx::Real  circleSegmentLength,
ControlPointCallback  callback 
) const

Control points from incident tangent end to exit tangent begin.

If the tangents "wraps" this wheel, the end of the incident and begin of the exit tangent will always be part of the control points. If the tangents points away from this wheel the only control point is in the direction where the tangents crosses each other. The offset from the surface of the tangents are preserved in the control points and it's assumed both incident and exit tangents has the same offset.

Parameters
incidentTangent- the incident tangent, incidentTangent.end is the first control point
exitTangent- the exit tangent, exitTangent.begin is the last control point
circleSegmentLength- desired circle segment length between each point
callback- control points are passed to this callback

◆ 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 319 of file TrackWheel.h.

◆ getExtremePoint()

agx::Vec3 agxVehicle::TrackWheel::getExtremePoint ( const WheelTangentData &  incidentTangent,
const WheelTangentData &  exitTangent 
) const

Given incident tangent incidentTangent and exit tangent exitTangent, the extreme point is in the middle of incident tangent end and exit tangent begin.

The offset from the surface is preserved and assumed to be the same on both given tangents.

Parameters
incidentTangent- incident tangent
exitTangent- exit tangent
Returns
extreme (min or max) point between the incident and exit tangents

◆ getMergedBody()

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

Definition at line 299 of file TrackWheel.h.

◆ getModel()

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

◆ getOrCreateMergedBody()

agx::MergedBody * agxVehicle::TrackWheel::getOrCreateMergedBody ( )
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 314 of file TrackWheel.h.

◆ getTrack()

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

Definition at line 324 of file TrackWheel.h.

◆ getTrackExtremePoint()

agx::Vec3 agxVehicle::TrackWheel::getTrackExtremePoint ( const TrackWheel &  prevWheel,
const TrackWheel &  nextWheel 
) const

Given incident tangent from prevWheel and exit tangent to nextWheel, the track extreme point is in the middle of incident tangent end and exit tangent begin, offset 0.5 * track thickness (if known) from the surface of this wheel.

Parameters
prevWheel- the neighboring wheel before this wheel
nextWheel- the neighboring wheel after this wheel
Returns
extreme (min or max) point between the incident and exit tangents

◆ 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

◆ 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 305 of file TrackWheel.h.

◆ 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

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