Trax3 3.1.0
trax track library
Loading...
Searching...
No Matches
trax::TrackJoint< Valtype > Class Template Referenceabstract

Physics engine agnostic part of track joint logic. More...

#include <C:/Trend/Development/Trax3/Code/trax/rigid/TrackJoint.h>

Inheritance diagram for trax::TrackJoint< Valtype >:

Public Member Functions

void SetTimeStep (Time step) noexcept
 Sets the time step for this trackjoint.
Time GetTimeStep () const noexcept
bool SetMovingBody (const spat::Frame< Valtype > &bodyFrame) noexcept
 Set the global pose of the body moving along the track.
const spat::Frame< Valtype > & GetMovingBody () const noexcept
void SetMovingBodyCOM (const spat::Frame< Valtype > &localCom) noexcept
 Set the moving bodie's center of mass relative to the bodie's pose.
bool SetTrackBody (const spat::Frame< Valtype > &bodyFrame) noexcept
 Set the global pose of the body moving the track system.
const spat::Frame< Valtype > & GetTrackBody () const noexcept
void SetTrackBodyCOM (const spat::Frame< Valtype > &localCom) noexcept
 Set the track bodie's center of mass relative to the track bodie's pose.
void Anchor (const spat::Frame< Valtype > &anchor) noexcept
 Sets the anchor on the moving body that is to be aligned with a track position on the track body.
const spat::Frame< Valtype > & Anchor () const noexcept
const spat::Frame< Valtype > & GlobalAnchor () const noexcept
void ThresholdP (Valtype threshold) noexcept
 Sets the threshold to switch off the joint when violated.
void ThresholdT (Valtype threshold) noexcept
 Sets the threshold to switch off the joint when violated.
void ThresholdN (Valtype threshold) noexcept
 Sets the threshold to switch off the joint when violated.
void ThresholdB (Valtype threshold) noexcept
 Sets the threshold to switch off the joint when violated.
void Flange (Valtype flange) noexcept
 If there is no holding force in binormal direction (BinormalForceLimitMin >= 0) the flange height will be used to switch off the joint's effect if the anchor levitates more than by flange height.
void ErrorReductionParameter (Valtype erp) noexcept
 Sets the error reduction parameter for the track joint.
Valtype ErrorReductionParameter () const noexcept
void SetDerailed (bool bDerailed=true) noexcept
 Sets the status of the track joint to derailed.
bool IsDerailed () const noexcept
spat::Vector< Valtype > MovingBodyGlobalCOM2AnchorOffset () const noexcept
void Precalculate (const spat::Frame< Valtype > &bodyFrame) noexcept
 Set the global pose of the body moving along the track and precalculates internal values like the global anchor.
virtual bool IsMovableBodySleeping () const noexcept=0
virtual void WakeUp () const =0
virtual void UpdateBodies ()=0
virtual void UpdateTrackBody (std::shared_ptr< const struct Body > pToBody)=0
virtual void release ()=0
Force Limits

Specifies the maximal forces to be applied by the physics engine to maintain the constraints that hold the movable object on the track.

Parameters
minMinimum force or torque to be applied at the movable body, min <= max.
maxMaximum force or torque to be applied at the movable body, min <= max.
targetVelocityTarget velocity of the movable object to be maintained by the engine.
Returns
The respective values returned by the getter methods.
void NormalForceLimits (Valtype min, Valtype max)
 Sets the limits for the normal force to be applied at the anchor point.
void BinormalForceLimits (Valtype min, Valtype max)
 Sets the limits for the binormal force to be applied at the anchor point.
void NormalTorqueLimit (Valtype max)
 Sets the limit for the normal torque to be applied at the anchor point [-max,max].
void TorqueLimit (Valtype max)
 Sets the limit for the tangent and binormal torque to be applied at the anchor point [-max,max].
void MotorTarget (Valtype targetVelocity) noexcept
 Sets the target velocity of the movable object to be maintained by the engine.
void MotorForceLimits (Valtype min, Valtype max)
 Sets the limits for the motor force to be applied at the anchor point.
void MotorForceMax (Valtype max)
 Sets the maximum motor force to be applied in order to reach target velocity at the anchor point.
void MotorForceMin (Valtype min)
 Sets the minimum motor force to be applied in order to reach target velocity at the anchor point.
Valtype MotorTarget () const noexcept
Valtype MotorForceMax () const noexcept
Valtype MotorForceMin () const noexcept
Constraints

The track joint assembles a set of different constraints to keep the anchor aligned with a track.

Parameters
dimindex for the constraint 0 < dim < DimensionsTotal(). This is the ordinal number of the constraint minus one.
unsigned short DimensionsTotal () const noexcept
bool IsAngularConstraint (unsigned short dim) const noexcept
bool IsDriveConstraint (unsigned short dim) const noexcept
bool IsConstraintLimited (unsigned short dim) const noexcept
void Jacobian (unsigned short dim, spat::Vector< Valtype > &Jm, spat::Vector< Valtype > &Rm, spat::Vector< Valtype > &Jt, spat::Vector< Valtype > &Rt, Valtype &VTarget, Valtype &E, Valtype &fmin, Valtype &fmax) const noexcept
 Fills the matrix values for a specific constraint.
Public Member Functions inherited from trax::TrackData< Valtype >
 TrackData (const TrackData &)=default
 TrackData (TrackData &&)=default
 TrackData (spat::Frame< Valtype > _F, spat::Frame< Valtype > _wF, Valtype _c, Valtype _t)
TrackData & operator= (const TrackData &)=default
TrackData & operator= (TrackData &&)=default
template<typename Valtype2>
TrackData & operator= (const TrackData< Valtype2 > &)
void Init () noexcept
 Initializes all values.
virtual bool SetValues (const TrackData &td) noexcept
 Sets the curve values for calculating the contraint.
template<typename Valtype2>
TrackData< Valtype > & operator= (const TrackData< Valtype2 > &td)

Protected Member Functions

virtual void markDirty () noexcept=0

Additional Inherited Members

Public Attributes inherited from trax::TrackData< Valtype >
spat::Frame< Valtype > F
 TNB Frame of the curve.
spat::Frame< Valtype > wF
 twisted TNB Frame
Valtype c
 curvature
Valtype t
 torsion

Detailed Description

template<typename Valtype>
class trax::TrackJoint< Valtype >

Physics engine agnostic part of track joint logic.

Implemented are the case for static tracks as well as the case were the track system is attached to a moving body. E.g. turn tables and the like.

Member Function Documentation

◆ Anchor() [1/2]

template<typename Valtype>
const spat::Frame< Valtype > & trax::TrackJoint< Valtype >::Anchor ( ) const
inlinenoexcept
Returns
The anchor of the moving body in local coordinates

◆ Anchor() [2/2]

template<typename Valtype>
void trax::TrackJoint< Valtype >::Anchor ( const spat::Frame< Valtype > & anchor)
inlinenoexcept

Sets the anchor on the moving body that is to be aligned with a track position on the track body.

Parameters
anchorAnchor of the moving body in local coordinates

◆ DimensionsTotal()

template<typename Valtype>
unsigned short trax::TrackJoint< Valtype >::DimensionsTotal ( ) const
inlinenoexcept
Returns
the number of active constraints.

◆ ErrorReductionParameter() [1/2]

template<typename Valtype>
Valtype trax::TrackJoint< Valtype >::ErrorReductionParameter ( ) const
inlinenoexcept
Returns
the error reduction parameter for the track joint.

◆ ErrorReductionParameter() [2/2]

template<typename Valtype>
void trax::TrackJoint< Valtype >::ErrorReductionParameter ( Valtype erp)
inlinenoexcept

Sets the error reduction parameter for the track joint.

With the track joint comes a mechanism that handles translational or angular aberrations of the anchor from the track. The erp specifies what fraction of the error should be corrected in the next simulation step. 1 would mean all of the error (not recommended) and 0 means no correction (also not recommended). The default value is 0.25. In connection with other joints and under certain mass conditions it might happen that the error correction of two or more joints interfere in an unfortunate way, so the simualtion becomes instable. This can be cured by choosing a different erp.

Parameters
erpError reduction parameter. The value should be between 0 and 1.

◆ Flange()

template<typename Valtype>
void trax::TrackJoint< Valtype >::Flange ( Valtype flange)
inlinenoexcept

If there is no holding force in binormal direction (BinormalForceLimitMin >= 0) the flange height will be used to switch off the joint's effect if the anchor levitates more than by flange height.

Note that error correction stays in effect while still in the flange range. This makes the trackjoint a bit sticky while in flange range. So flange should be typically a small value to achieve realistic levitating.

◆ GetMovingBody()

template<typename Valtype>
const spat::Frame< Valtype > & trax::TrackJoint< Valtype >::GetMovingBody ( ) const
inlinenoexcept
Returns
The global pose of the body moving along the track

◆ GetTimeStep()

template<typename Valtype>
Time trax::TrackJoint< Valtype >::GetTimeStep ( ) const
inlinenoexcept
Returns
the time step used by this joint.

◆ GetTrackBody()

template<typename Valtype>
const spat::Frame< Valtype > & trax::TrackJoint< Valtype >::GetTrackBody ( ) const
inlinenoexcept
Returns
The global pose of the body moving the track system.

◆ GlobalAnchor()

template<typename Valtype>
const spat::Frame< Valtype > & trax::TrackJoint< Valtype >::GlobalAnchor ( ) const
inlinenoexcept
Returns
The anchor of the moving body in global coordinates

◆ IsAngularConstraint()

template<typename Valtype>
bool trax::TrackJoint< Valtype >::IsAngularConstraint ( unsigned short dim) const
inlinenoexcept
Returns
true if the constraint involves a rotational dimension.

◆ IsConstraintLimited()

template<typename Valtype>
bool trax::TrackJoint< Valtype >::IsConstraintLimited ( unsigned short dim) const
inlinenoexcept
Returns
true if the constraint's maximum or minimum force or torque is not infinite.

◆ IsDerailed()

template<typename Valtype>
bool trax::TrackJoint< Valtype >::IsDerailed ( ) const
noexcept
Returns
true if the track joint is set for derailment.

◆ IsDriveConstraint()

template<typename Valtype>
bool trax::TrackJoint< Valtype >::IsDriveConstraint ( unsigned short dim) const
inlinenoexcept
Returns
true if the constraint is amotor constraint.

◆ MotorForceMax()

template<typename Valtype>
Valtype trax::TrackJoint< Valtype >::MotorForceMax ( ) const
inlinenoexcept
Returns
The maximum motor force to be applied at the anchor point.

◆ MotorForceMin()

template<typename Valtype>
Valtype trax::TrackJoint< Valtype >::MotorForceMin ( ) const
inlinenoexcept
Returns
The minimum motor force to be applied at the anchor point.

◆ MotorTarget()

template<typename Valtype>
Valtype trax::TrackJoint< Valtype >::MotorTarget ( ) const
inlinenoexcept
Returns
The minimum motor force to be applied at the anchor point.

◆ MovingBodyGlobalCOM2AnchorOffset()

template<typename Valtype>
spat::Vector< Valtype > trax::TrackJoint< Valtype >::MovingBodyGlobalCOM2AnchorOffset ( ) const
inlinenoexcept
Returns
The vector from the center of mass (COM) to the anchor for the moving body in global coordinates

◆ SetDerailed()

template<typename Valtype>
void trax::TrackJoint< Valtype >::SetDerailed ( bool bDerailed = true)
noexcept

Sets the status of the track joint to derailed.

A derailed trackjoint will not influence the simulation anymore. If derailment is a permanent situation it is recommended to remove the joint from the simulation completely, since a derailed joint will still consume some resources.

◆ SetTimeStep()

template<typename Valtype>
void trax::TrackJoint< Valtype >::SetTimeStep ( Time step)
inlinenoexcept

Sets the time step for this trackjoint.

Influences force and torque strengthes. This should be called on using non-fixed timesteps. Default is fixed_timestep.

◆ ThresholdB()

template<typename Valtype>
void trax::TrackJoint< Valtype >::ThresholdB ( Valtype threshold)
inlinenoexcept

Sets the threshold to switch off the joint when violated.

The threshold sets the angle in radiants, so that a violation of the joint conditions greater than that will result in the joint having no effect any more.

Parameters
thresholdAngular threshold for rotations around binormal B.

◆ ThresholdN()

template<typename Valtype>
void trax::TrackJoint< Valtype >::ThresholdN ( Valtype threshold)
inlinenoexcept

Sets the threshold to switch off the joint when violated.

The threshold sets the angle in radiants, so that a violation of the joint conditions greater than that will result in the joint having no effect any more.

Parameters
thresholdAngular threshold for rotations around normal N.

◆ ThresholdP()

template<typename Valtype>
void trax::TrackJoint< Valtype >::ThresholdP ( Valtype threshold)
inlinenoexcept

Sets the threshold to switch off the joint when violated.

The threshold gives the distance from the TBN frame position to the real body position from wich on the joint will have no effect any more.

Parameters
thresholdlinear threshold distance.

◆ ThresholdT()

template<typename Valtype>
void trax::TrackJoint< Valtype >::ThresholdT ( Valtype threshold)
inlinenoexcept

Sets the threshold to switch off the joint when violated.

The threshold sets the angle in radiants, so that a violation of the joint conditions greater than that will result in the joint having no effect any more. This will not work for T, if tilting is enabled.

Parameters
thresholdAngular threshold for rotations around tangent T.

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