Simbody  3.5
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              }
                    .
                    .
                   ...
                 Ground

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

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

Member Function Documentation

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

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