Simbody
Public Member Functions

SimTK::Constraint::ConstantAngle Class Reference

This constraint consists of a single constraint equation that enforces that a unit vector v1 fixed to one body (the "base body") must maintain a fixed angle theta with respect to a unit vector v2 fixed on the other body (the "follower body"). More...

#include <Constraint.h>

Inheritance diagram for SimTK::Constraint::ConstantAngle:

List of all members.

Public Member Functions

 ConstantAngle (MobilizedBody &baseBody_B, const UnitVec3 &defaultAxis_B, MobilizedBody &followerBody_F, const UnitVec3 &defaultAxis_F, Real angle=Pi/2)
ConstantAnglesetAxisDisplayLength (Real)
ConstantAnglesetAxisDisplayWidth (Real)
Real getAxisDisplayLength () const
Real getAxisDisplayWidth () const
ConstantAnglesetDefaultBaseAxis (const UnitVec3 &)
ConstantAnglesetDefaultFollowerAxis (const UnitVec3 &)
ConstantAnglesetDefaultAngle (Real)
MobilizedBodyIndex getBaseMobilizedBodyIndex () const
MobilizedBodyIndex getFollowerMobilizedBodyIndex () const
const UnitVec3getDefaultBaseAxis () const
const UnitVec3getDefaultFollowerAxis () const
Real getDefaultAngle () const
const UnitVec3getBaseAxis (const State &) const
const UnitVec3getFollowerAxis (const State &) const
Real getAngle (const State &) const
Real getPositionError (const State &) const
Real getVelocityError (const State &) const
Real getAccelerationError (const State &) const
Real getMultiplier (const State &) const
Real getTorqueOnFollowerBody (const State &) const
 SimTK_INSERT_DERIVED_HANDLE_DECLARATIONS (ConstantAngle, ConstantAngleImpl, Constraint)

Detailed Description

This constraint consists of a single constraint equation that enforces that a unit vector v1 fixed to one body (the "base body") must maintain a fixed angle theta with respect to a unit vector v2 fixed on the other body (the "follower body").

This can be done with a single constraint equation as long as theta is sufficiently far away from 0 and +/-Pi (180 degrees), with the numerically best performance at theta=Pi/2 (90 degrees).

Warning:
Do not use this constraint to align the vectors, that is for angles near 0 or +/- Pi; performance will noticeably degrade within a few degrees of these limits and numerical integration will eventually fail at the limits.

If you want to enforce that two axes are aligned with one another (that is, the angle between them is 0 or +/-Pi), that takes two constraint equations since the only remaining rotation is about the common axis. (That is, two rotational degrees of freedom are removed; that can't be done with one constraint equation -- the situation is analogous to the inability of a Rod (distance) constraint to keep two points at 0 distance.) Instead, you can use two ConstantAngle constraints on pairs of vectors perpendicular to the aligned ones, so that each ConstantAngle is set to the optimal 90 degrees.

This constraint is enforced by an internal scalar torque applied equal and opposite on each body, about the mutual perpendicular to the two vectors.

The assembly condition is the same as the run-time constraint: the bodies must be rotated until the vectors have the right angle between them.


Constructor & Destructor Documentation

SimTK::Constraint::ConstantAngle::ConstantAngle ( MobilizedBody baseBody_B,
const UnitVec3 defaultAxis_B,
MobilizedBody followerBody_F,
const UnitVec3 defaultAxis_F,
Real  angle = Pi/2 
)

Member Function Documentation

ConstantAngle& SimTK::Constraint::ConstantAngle::setAxisDisplayLength ( Real  )
ConstantAngle& SimTK::Constraint::ConstantAngle::setAxisDisplayWidth ( Real  )
Real SimTK::Constraint::ConstantAngle::getAxisDisplayLength ( ) const
Real SimTK::Constraint::ConstantAngle::getAxisDisplayWidth ( ) const
ConstantAngle& SimTK::Constraint::ConstantAngle::setDefaultBaseAxis ( const UnitVec3 )
ConstantAngle& SimTK::Constraint::ConstantAngle::setDefaultFollowerAxis ( const UnitVec3 )
ConstantAngle& SimTK::Constraint::ConstantAngle::setDefaultAngle ( Real  )
MobilizedBodyIndex SimTK::Constraint::ConstantAngle::getBaseMobilizedBodyIndex ( ) const
MobilizedBodyIndex SimTK::Constraint::ConstantAngle::getFollowerMobilizedBodyIndex ( ) const
const UnitVec3& SimTK::Constraint::ConstantAngle::getDefaultBaseAxis ( ) const
const UnitVec3& SimTK::Constraint::ConstantAngle::getDefaultFollowerAxis ( ) const
Real SimTK::Constraint::ConstantAngle::getDefaultAngle ( ) const
const UnitVec3& SimTK::Constraint::ConstantAngle::getBaseAxis ( const State ) const
const UnitVec3& SimTK::Constraint::ConstantAngle::getFollowerAxis ( const State ) const
Real SimTK::Constraint::ConstantAngle::getAngle ( const State ) const
Real SimTK::Constraint::ConstantAngle::getPositionError ( const State ) const
Real SimTK::Constraint::ConstantAngle::getVelocityError ( const State ) const
Real SimTK::Constraint::ConstantAngle::getAccelerationError ( const State ) const
Real SimTK::Constraint::ConstantAngle::getMultiplier ( const State ) const
Real SimTK::Constraint::ConstantAngle::getTorqueOnFollowerBody ( const State ) const
SimTK::Constraint::ConstantAngle::SimTK_INSERT_DERIVED_HANDLE_DECLARATIONS ( ConstantAngle  ,
ConstantAngleImpl  ,
Constraint   
)

The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines