Simbody  3.6
SimTK::SimbodyMatterSubtree Class Reference

A SimbodyMatterSubtree is a view of a connected subgraph of the tree of mobilized bodies in a SimbodyMatterSubsystem. More...

Public Member Functions

 SimbodyMatterSubtree ()
 SimbodyMatterSubtree (const SimbodyMatterSubtree &)
SimbodyMatterSubtreeoperator= (const SimbodyMatterSubtree &)
 ~SimbodyMatterSubtree ()
 SimbodyMatterSubtree (const SimbodyMatterSubsystem &)
 SimbodyMatterSubtree (const SimbodyMatterSubsystem &, const Array_< MobilizedBodyIndex > &terminalBodies)
void setSimbodyMatterSubsystem (const SimbodyMatterSubsystem &matter)
const SimbodyMatterSubsystemgetSimbodyMatterSubsystem () const
void clear ()
SimbodyMatterSubtreeaddTerminalBody (MobilizedBodyIndex)
void realizeTopology ()
int getNumSubtreeBodies () const
MobilizedBodyIndex getAncestorMobilizedBodyIndex () const
const Array_< MobilizedBodyIndex > & getTerminalBodies () const
const Array_< MobilizedBodyIndex > & getAllBodies () const
SubtreeBodyIndex getParentSubtreeBodyIndex (SubtreeBodyIndex) const
const Array_< SubtreeBodyIndex > & getChildSubtreeBodyIndices (SubtreeBodyIndex) const
void initializeSubtreeResults (const State &, SimbodyMatterSubtreeResults &) const
bool isCompatibleSubtreeResults (const SimbodyMatterSubtreeResults &) const
void copyPositionsFromState (const State &, SimbodyMatterSubtreeResults &) const
void calcPositionsFromSubtreeQ (const State &, const Vector &subQ, SimbodyMatterSubtreeResults &) const
void perturbPositions (const State &, SubtreeQIndex subQIndex, Real perturbation, SimbodyMatterSubtreeResults &) const
void copyVelocitiesFromState (const State &, SimbodyMatterSubtreeResults &) const
void calcVelocitiesFromSubtreeU (const State &, const Vector &subU, SimbodyMatterSubtreeResults &) const
void calcVelocitiesFromZeroU (const State &, SimbodyMatterSubtreeResults &) const
void perturbVelocities (const State &, SubtreeUIndex subUIndex, Real perturbation, SimbodyMatterSubtreeResults &) const
void copyAccelerationsFromState (const State &, SimbodyMatterSubtreeResults &) const
void calcAccelerationsFromSubtreeUDot (const State &, const Vector &subUDot, SimbodyMatterSubtreeResults &) const
void calcAccelerationsFromZeroUDot (const State &, SimbodyMatterSubtreeResults &) const
void perturbAccelerations (const State &, SubtreeUIndex subUDotIndex, Real perturbation, SimbodyMatterSubtreeResults &) const

Detailed Description

A SimbodyMatterSubtree is a view of a connected subgraph of the tree of mobilized bodies in a SimbodyMatterSubsystem.

It is used to perform kinematic operations on the subgraph to facilitate the handling of constraints, which typically involve only small subgraphs.

A SimbodyMatterSubtree is characterized by a single ancestor body A and a set of terminal mobilized bodies T={Ti}, where A is the outmost body that is on the inboard path of each Ti. Note that a SimbodyMatterSubtree's "terminal" bodies do not have to be terminal in the full tree. The SimbodyMatterSubtree includes T and all "branch" mobilized bodies B={Bij} found on any path from a Ti to A, and A itself which serves as Ground. A may be one of the terminal bodies. A's mobilizer is not part of the SimbodyMatterSubtree. The path from Ti to A is called the ith branch of the SimbodyMatterSubtree; branches can overlap.

                           . .
      .    .                .
       .  .                 .
        T0      T1          T2     }
         *       *       .  *      }
     B0   *     * B1       *       }
           *   *          *        }   A SimbodyMatterSubtree with
        .    *           *  B2     }   three branches.
          . . *        *           }
                *     *            }
           B0,B1  *  *             }
                    A              }

Each body in the SimbodyMatterSubtree is assigned an index called a SubtreeBodyIndex, with the Ancestor being SubtreeBodyIndex 0 and other ids assigned such that ids increase going outwards along a branch. Maps are kept in the SimbodyMatterSubtree object to track its relationship to the full tree.

A SimbodyMatterSubtree can be constructed at Topology stage and needed ones can thus be precalculated and stored in the SimbodyMatterSubsystem Topology Cache (i.e., in the System not the State). Calculations done on the SimbodyMatterSubtree, on the other hand, require further state information and cannot be stored as part of the System. For those, we define a companion class below called SimbodyMatterSubtreeResults.

A SimbodyMatterSubtreeResults object is initialized at Model stage, at which point we can determine the mobilities u and generalized coordinates q. These are assigned SubtreeUIndex's and SubtreeQIndex's in the same order that the SimbodyMatterSubtree bodies are numbered. Maps are kept in the SimbodyMatterSubtreeResults object to track the relationship between the SimbodyMatterSubtree mobilities and those in the full tree.

Note that SimbodyMatterSubtree operations are elaborate operators, not responses. That means the results are not stored in the State, but rather in the private SimbodyMatterSubtreeResults objects.

Operators here perform kinematic operations based on perturbations of the global System State values. The supported perturbations are: General 1a same as global System state (except answers are in A rather than G) 1b all mobility variables set 2 all mobility variables from 1a or 1b, except for one which is perturbed (q,u,udot)

Linear 3 all mobility variables are zero (u,udot) 4 all mobility variables are zero again, except for one which is 1 (u,udot) Steps 1 and 2 are designed to work together, as are 3 and 4: first evaluate nominal kinematics; then perturb.

Constructor & Destructor Documentation

◆ SimbodyMatterSubtree() [1/4]

SimTK::SimbodyMatterSubtree::SimbodyMatterSubtree ( )

◆ SimbodyMatterSubtree() [2/4]

SimTK::SimbodyMatterSubtree::SimbodyMatterSubtree ( const SimbodyMatterSubtree )

◆ ~SimbodyMatterSubtree()

SimTK::SimbodyMatterSubtree::~SimbodyMatterSubtree ( )

◆ SimbodyMatterSubtree() [3/4]

SimTK::SimbodyMatterSubtree::SimbodyMatterSubtree ( const SimbodyMatterSubsystem )

◆ SimbodyMatterSubtree() [4/4]

SimTK::SimbodyMatterSubtree::SimbodyMatterSubtree ( const SimbodyMatterSubsystem ,
const Array_< MobilizedBodyIndex > &  terminalBodies 

Member Function Documentation

◆ operator=()

SimbodyMatterSubtree& SimTK::SimbodyMatterSubtree::operator= ( const SimbodyMatterSubtree )

◆ setSimbodyMatterSubsystem()

void SimTK::SimbodyMatterSubtree::setSimbodyMatterSubsystem ( const SimbodyMatterSubsystem matter)

◆ getSimbodyMatterSubsystem()

const SimbodyMatterSubsystem& SimTK::SimbodyMatterSubtree::getSimbodyMatterSubsystem ( ) const

◆ clear()

void SimTK::SimbodyMatterSubtree::clear ( )

◆ addTerminalBody()

SimbodyMatterSubtree& SimTK::SimbodyMatterSubtree::addTerminalBody ( MobilizedBodyIndex  )

◆ realizeTopology()

void SimTK::SimbodyMatterSubtree::realizeTopology ( )

◆ getNumSubtreeBodies()

int SimTK::SimbodyMatterSubtree::getNumSubtreeBodies ( ) const

◆ getAncestorMobilizedBodyIndex()

MobilizedBodyIndex SimTK::SimbodyMatterSubtree::getAncestorMobilizedBodyIndex ( ) const

◆ getTerminalBodies()

const Array_<MobilizedBodyIndex>& SimTK::SimbodyMatterSubtree::getTerminalBodies ( ) const

◆ getAllBodies()

const Array_<MobilizedBodyIndex>& SimTK::SimbodyMatterSubtree::getAllBodies ( ) const

◆ getParentSubtreeBodyIndex()

SubtreeBodyIndex SimTK::SimbodyMatterSubtree::getParentSubtreeBodyIndex ( SubtreeBodyIndex  ) const

◆ getChildSubtreeBodyIndices()

const Array_<SubtreeBodyIndex>& SimTK::SimbodyMatterSubtree::getChildSubtreeBodyIndices ( SubtreeBodyIndex  ) const

◆ initializeSubtreeResults()

void SimTK::SimbodyMatterSubtree::initializeSubtreeResults ( const State ,
) const

◆ isCompatibleSubtreeResults()

bool SimTK::SimbodyMatterSubtree::isCompatibleSubtreeResults ( const SimbodyMatterSubtreeResults ) const

◆ copyPositionsFromState()

void SimTK::SimbodyMatterSubtree::copyPositionsFromState ( const State ,
) const

◆ calcPositionsFromSubtreeQ()

void SimTK::SimbodyMatterSubtree::calcPositionsFromSubtreeQ ( const State ,
const Vector subQ,
) const

◆ perturbPositions()

void SimTK::SimbodyMatterSubtree::perturbPositions ( const State ,
SubtreeQIndex  subQIndex,
Real  perturbation,
) const

◆ copyVelocitiesFromState()

void SimTK::SimbodyMatterSubtree::copyVelocitiesFromState ( const State ,
) const

◆ calcVelocitiesFromSubtreeU()

void SimTK::SimbodyMatterSubtree::calcVelocitiesFromSubtreeU ( const State ,
const Vector subU,
) const

◆ calcVelocitiesFromZeroU()

void SimTK::SimbodyMatterSubtree::calcVelocitiesFromZeroU ( const State ,
) const

◆ perturbVelocities()

void SimTK::SimbodyMatterSubtree::perturbVelocities ( const State ,
SubtreeUIndex  subUIndex,
Real  perturbation,
) const

◆ copyAccelerationsFromState()

void SimTK::SimbodyMatterSubtree::copyAccelerationsFromState ( const State ,
) const

◆ calcAccelerationsFromSubtreeUDot()

void SimTK::SimbodyMatterSubtree::calcAccelerationsFromSubtreeUDot ( const State ,
const Vector subUDot,
) const

◆ calcAccelerationsFromZeroUDot()

void SimTK::SimbodyMatterSubtree::calcAccelerationsFromZeroUDot ( const State ,
) const

◆ perturbAccelerations()

void SimTK::SimbodyMatterSubtree::perturbAccelerations ( const State ,
SubtreeUIndex  subUDotIndex,
Real  perturbation,
) const

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