AGX Dynamics  2.37.3.2
agxVehicle::Wheel Class Reference

Abstraction of a wheel of arbitrary geometry. More...

#include <Wheel.h>

+ Inheritance diagram for agxVehicle::Wheel:

Public Types

using ConstraintContainer = agx::Vector< agx::ConstraintRef >
 

Public Member Functions

 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. More...
 
 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. More...
 
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...
 
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
 
agx::Frame * getLocalFrame () const
 
agx::Real getRadius () const
 
agx::RigidBody * getRigidBody () const
 
agx::Vec3 getRotationAxis () const
 
agx::Plane getRotationAxisPlane () const
 
agxStream::StorageAgent * getStorageAgent () const override
 
agx::AffineMatrix4x4 getTransform () const
 
agx::Vec3 getUpAxis () const
 
virtual void restore (agxStream::InputArchive &in) override
 
virtual void store (agxStream::OutputArchive &out) const override
 
- Public Member Functions inherited from agx::Referenced
 Referenced ()
 Default constructor. More...
 
 Referenced (const Referenced &)
 
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
 
int getReferenceCount () const
 
template<typename T >
bool is () const
 Subclass test. More...
 
Referenced & operator= (const Referenced &)
 Assignment operator. Will increment the number of references to the referenced object. More...
 
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...
 
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...
 
- Public Member Functions inherited from agxStream::Serializable
virtual ~Serializable ()
 Destructor for normal C++ use but hidden from SWIG bindings. More...
 
bool getEnableSerialization () const
 
bool getEnableUuidGeneration ()
 
agx::UInt32 getIndex () const
 This index is given at creation of this object. More...
 
agx::Uuid getUuid () const
 
bool isFinished () const
 
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...
 

Static Public Member Functions

static agxStream::Serializable * create ()
 
static agxStream::Serializable * create (agxStream::InputArchive &)
 
static const char * getConstructClassId ()
 
- 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. More...
 

Protected Member Functions

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

Additional Inherited Members

- 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. More...
 
- Protected Attributes inherited from agx::Referenced
Mutex m_mutex
 
ObserverContainer m_observers
 
AtomicValue m_refCount
 

Detailed Description

Abstraction of a wheel of arbitrary geometry.

The wheel has a well defined center, rotation axis and radius.

Definition at line 37 of file Wheel.h.

Member Typedef Documentation

◆ ConstraintContainer

Constructor & Destructor Documentation

◆ Wheel() [1/3]

agxVehicle::Wheel::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.

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
radius- radius of the wheel
rb- wheel body
rbRelFrame- relative frame defining center and rotation axis of this wheel, given in rb frame.

◆ Wheel() [2/3]

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.

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
radius- radius of the wheel
rb- wheel body
rbRelTransform- relative transform defining center and rotation axis of this wheel, given in rb frame.

◆ Wheel() [3/3]

agxVehicle::Wheel::Wheel ( )
protected

Default constructor used only when this object is restored.

◆ ~Wheel()

virtual agxVehicle::Wheel::~Wheel ( )
protectedvirtual

Reference counted object - protected destructor.

Member Function Documentation

◆ attachConstraint()

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

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 
)

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 ( )
inlinestatic

Definition at line 157 of file Wheel.h.

◆ create() [2/2]

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

Definition at line 157 of file Wheel.h.

◆ getCenterPosition()

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

◆ getClassName()

const char* agxVehicle::Wheel::getClassName ( ) const
inlineoverridevirtual
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
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
Parameters
name- name of the constraint to find
Returns
constraint with the given name

◆ getConstraints()

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

◆ getConstructClassId()

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

Definition at line 157 of file Wheel.h.

◆ getLocalFrame()

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

◆ getRadius()

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

◆ getRigidBody()

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

◆ getRotationAxis()

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

◆ getRotationAxisPlane()

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

◆ getStorageAgent()

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

Implements agxStream::Serializable.

Definition at line 157 of file Wheel.h.

◆ getTransform()

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

◆ getUpAxis()

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

◆ restore()

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

◆ store()

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

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