#include <SimbodyMatterSubtree.h>
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 which 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.
SimbodyMatterSubtree | ( | const SimbodyMatterSubtree & | ) |
~SimbodyMatterSubtree | ( | ) |
SimbodyMatterSubtree | ( | const SimbodyMatterSubsystem & | ) | [explicit] |
SimbodyMatterSubtree | ( | const SimbodyMatterSubsystem & | , | |
const std::vector< MobilizedBodyIndex > & | terminalBodies | |||
) |
SimbodyMatterSubtree& operator= | ( | const SimbodyMatterSubtree & | ) |
void setSimbodyMatterSubsystem | ( | const SimbodyMatterSubsystem & | matter | ) |
const SimbodyMatterSubsystem& getSimbodyMatterSubsystem | ( | ) | const |
void clear | ( | ) |
SimbodyMatterSubtree& addTerminalBody | ( | MobilizedBodyIndex | ) |
void realizeTopology | ( | ) |
int getNumSubtreeBodies | ( | ) | const |
MobilizedBodyIndex getAncestorMobilizedBodyIndex | ( | ) | const |
const std::vector<MobilizedBodyIndex>& getTerminalBodies | ( | ) | const |
const std::vector<MobilizedBodyIndex>& getAllBodies | ( | ) | const |
SubtreeBodyIndex getParentSubtreeBodyIndex | ( | SubtreeBodyIndex | ) | const |
const std::vector<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 |