![]() |
ModelSpace
Documentation for ModelSpace models and classes.
|
Frame class definition. More...
#include <Frame.h>

Public Member Functions | |
| Frame (const std::string &name, Frame *par=nullptr, bool free=false) | |
| Constructor for the frame object. More... | |
| virtual | ~Frame () |
| std::vector< Frame * > | frameChildren () |
| Return all children of the frame as a vector of frames. More... | |
| Frame * | getFrameByAddress (const std::string &address) |
| Function to get an object from the graph tree by string address. More... | |
| Joint & | tJoint () |
| Function to get reference to the frame's translational joint. More... | |
| Joint & | rJoint () |
| Function to get reference to the frame's rotational joint. More... | |
| int | parent (Frame *new_parent) |
| Function to assign the frame's parent via pointer. More... | |
| int | parent (Frame &new_parent) |
| Frame * | parent () |
| void | setParentRelAcceleration (clockwerk::CartesianVector< 3 > accel) |
| Function to set parent relative acceleration of frame. More... | |
| void | setParentRelAngularAcceleration (clockwerk::CartesianVector< 3 > alpha) |
| Function to set parent relative angular acceleration. More... | |
| clockwerk::CartesianVector< 3 > | parentRelAcceleration () |
| Function to get the acceleration of the frame relative to parent expressed in parent coords. More... | |
| clockwerk::CartesianVector< 3 > | parentRelAngularAcceleration () |
| Function to get angular acceleration relative to parent in frame coords. More... | |
| void | rootRelPosition (clockwerk::CartesianVector< 3 > &pos_o_root__root) |
| Returns the position of the frame origin wrt the root origin, in root coordinates. More... | |
| clockwerk::CartesianVector< 3 > | rootRelPosition () |
| void | rootRelVelocity (clockwerk::CartesianVector< 3 > &vel_o_root__root) |
| Returns the velocity of the frame origin wrt the root origin, in root coordinates. More... | |
| clockwerk::CartesianVector< 3 > | rootRelVelocity () |
| void | rootRelAcceleration (clockwerk::CartesianVector< 3 > &acc_o_root__root) |
| Returns the acceleration of the frame origin wrt the root origin, in root coordinates. More... | |
| clockwerk::CartesianVector< 3 > | rootRelAcceleration () |
| void | rootRelQuaternion (clockwerk::Quaternion &quat_f_root) |
| Returns the quaternion representing the frame origin wrt the root frame. More... | |
| clockwerk::Quaternion | rootRelQuaternion () |
| void | rootRelDCM (clockwerk::DCM &dcm_f_root) |
| Returns the clockwerk::DCM of the frame origin wrt the root frame. More... | |
| clockwerk::DCM | rootRelDCM () |
| void | rootRelAngularVelocity (clockwerk::CartesianVector< 3 > &w_f_root__f) |
| Returns the angular velocity of the frame origin wrt the root, expressed in this frame's coordinates. More... | |
| clockwerk::CartesianVector< 3 > | rootRelAngularVelocity () |
| void | rootRelAngularAcceleration (clockwerk::CartesianVector< 3 > &alpha_f_root__f) |
| Returns the angular acceleration of the frame origin wrt the root, expressed in this frame's coordinates. More... | |
| clockwerk::CartesianVector< 3 > | rootRelAngularAcceleration () |
| int | calcFrameTreeExtForcesMoments () |
| Function to recurse through the body and its children to apply external forces and moments to the "correct" body by resolving them to locations where there are degrees of freedom. More... | |
| int | calcFrameTreeExtAcceleration () |
| Function to recurse through the body and its children to resolve applied external forces and moments into acceleration and angular acceleration. More... | |
| void | integrator (void *integ_ptr) |
| Getter and setter for integrator pointer. More... | |
| void * | integrator () |
| void | setStateFromStateVector (const std::array< floating_point, 13 > &state_f_p__f) |
| Function to set frame state based on NUM_INTEGRATED_STATES-element state vector. More... | |
| void | getStateAsStateVector (std::array< floating_point, 13 > &state_f_p__f) |
| Function to return frame state as a NUM_INTEGRATED_STATES-element state vector. More... | |
| void | getStateVectorDot (std::array< floating_point, 13 > &state_dot) |
| Function to get the rate of change in the frame state vector. More... | |
| int | setRootRelPosition (const clockwerk::CartesianVector< 3 > &pos_f_root__root) |
| Function to set the frame's position relative to root. More... | |
| int | setRootRelVelocity (const clockwerk::CartesianVector< 3 > &vel_f_root__root) |
| Function to set the frame's velocity relative to root. More... | |
| int | setRootRelAttitude (const clockwerk::Quaternion &quat_f_root) |
| Function to set the frame's attitude relative to root. More... | |
| int | setRootRelAngularVelocity (const clockwerk::CartesianVector< 3 > &w_f_root__f) |
| Function to set the frame's position relative to root. More... | |
| Frame * | getFrameRootPointer () |
| Function to get a pointer to this frame's root frame. More... | |
| void | dump () |
| Dump all information associated with the frame. More... | |
Public Member Functions inherited from clockwerk::GraphTreeObject | |
| GraphTreeObject (const char *gt_nme="", GraphTreeObject **storage_array=nullptr, uint32 storage_size=0) | |
| Name-based constructor for GraphTreeObject which will have no children by default. More... | |
| virtual | ~GraphTreeObject () |
| Destructor. More... | |
| GraphTreeObject * | parent () |
| Functions to get object's parent/children. More... | |
| GraphTreeObject ** | children () |
| GraphTreeObject * | childAtIndex (uint8 i) const |
| int16 | parent (GraphTreeObject *new_parent) |
| Function to assign the node's parent via pointer. More... | |
| int16 | parent (GraphTreeObject &new_parent) |
| Function to assign the node's parent via reference. More... | |
| uint8 | nChildren () const |
| Getters for number of children and descendants. More... | |
| uint16 | nDescendants () const |
| uint8 | capacity () const |
| const char * | name () const |
| Getter and setter for object name. More... | |
| int16 | name (const char *new_name) |
| uint8 | rank () |
| Getter for the object rank. More... | |
| int8 | type () |
| Function to indicate type – -1 by default unless implemented downstream. More... | |
| bool | loggable () |
| Getter for object logability flag – note no setter because should only be set by this or a derived class in its definition. More... | |
| GraphTreeObject * | getRootDataPointer () |
| Get the pointer to the highest object in the graph tree. More... | |
| virtual int16 | str (char *output, size_t size) const |
| Get object represented as string. More... | |
| virtual int16 | fromStr (const char *val) |
| Set value of graphtreeobject from string. More... | |
Public Attributes | |
| clockwerk::DataIO< clockwerk::CartesianVector< 3 > > | pos_f_p__p |
| clockwerk::DataIO< clockwerk::CartesianVector< 3 > > | vel_f_p__p |
| clockwerk::DataIO< clockwerk::Quaternion > | quat_f_p |
| clockwerk::DataIO< clockwerk::CartesianVector< 3 > > | ang_vel_f_p__f |
| clockwerk::DataIO< Frame * > | self_id = clockwerk::DataIO<Frame*>(nullptr, "self_id", this) |
Protected Attributes | |
| clockwerk::CartesianVector< 3 > | _acc_f_p__p |
| clockwerk::CartesianVector< 3 > | _alpha_f_p__f |
| Joint | _t_joint |
| Joint | _r_joint |
| Translational. More... | |
| void * | _integrator_ptr = nullptr |
| Rotational. More... | |
| Frame * | _parent |
| Variable to hold our parent. More... | |
Protected Attributes inherited from clockwerk::GraphTreeObject | |
| GraphTreeObject * | _parent = nullptr |
| GraphTreeObject ** | _children_ptr = nullptr |
| uint32 | _max_num_children = 0 |
| uint16 | _num_descendants = 0 |
| char | _name [MAXIMUM_NAME_CHARS] = "" |
| String name for object. More... | |
| uint8 | _num_children = 0 |
| Number of direct children of the tree (not including the tree itself) More... | |
| uint8 | _rank = 0 |
| int8 | _graph_tree_type = BASE_GRAPH_TREE |
| Variable to store graph tree object type. More... | |
| bool | _loggable = false |
| Variable to indicate whether the selected object is loggable. Set to false by default. More... | |
| uint32 | _index = 0 |
| Index pointing to the next write location for the graph tree children. More... | |
Additional Inherited Members | |
Protected Member Functions inherited from clockwerk::GraphTreeObject | |
| int16 | _setStorage (GraphTreeObject **storage_array, uint8 storage_size) |
| Getter for object's string address. More... | |
| void | _recalculateDescendants () |
| Function to recursively re-calculate the number of descendants of a given node on the tree. More... | |
| void | _recalculateRank () |
| Function to recursively re-calculate the rank of a given node on the tree. More... | |
| int16 | _addChild (GraphTreeObject *child) |
| Function to decompose a string into a series of substrings via indexing. More... | |
| int16 | _removeChild (GraphTreeObject *child) |
| Function to remove a child from the graph node's children. More... | |
Frame class definition.
This file defines the frame class, which is the base of all 6-DOF kinematics and dynamics. This frame class is designed for recursive chaining, and represents the relationship of a frame to its parent.
The frame class tracks the frame's relationship to its parent via the following four key parameters: pos_f_p__p - The position of the child frame relative to its parent, in PARENT coords vel_f_p__p - The velocity of the child frame IN THE PARENT Frame , in PARENT coords. quat_f_p - The attitude quaternion of the child frame relative to its parent ang_vel_f_p__f - The angular velocity of the child frame relative to its parent, in Frame coords
Frame relationships to their parents are also defined by the Joint class, which is a method for tracking the degrees of freedom (and thus, which channels can have a nonzero velocity value). Each frame has a translational and rotational joint, which sets degrees of freedom in the velocity (represented in parent coordinates) and angular velocity (represented in frame coordinates). The frame joint is set to fully fixed by default, but can be set to free or modified later.
Frame states may be set by calling the parent relative states directly (they are DataIO objects, but buyer beware that you can set the frame states with almost no restrictions.)
Alternatively, users may get and set frame states relative to the root frame by calling the root relative functions which are provided by this class. The functions rootRelPosition, rootRelVelocity, rootRel... and so on all return the frame state relative to root. The functions setRootRel... will set the frame's state relative to the root frame. For many applications it is better to work with the root functions, rather than parent relative functions.
| modelspace::Frame::Frame | ( | const std::string & | name, |
| Frame * | par = nullptr, |
||
| bool | free = false |
||
| ) |
Constructor for the frame object.
| name | Name of the frame |
| par | Parent of the frame. Defaults to nullptr |
| free | Boolean indicating whether frame should be free or fixed. |
|
inlinevirtual |
| int modelspace::Frame::calcFrameTreeExtAcceleration | ( | ) |
Function to recurse through the body and its children to resolve applied external forces and moments into acceleration and angular acceleration.
| int modelspace::Frame::calcFrameTreeExtForcesMoments | ( | ) |
Function to recurse through the body and its children to apply external forces and moments to the "correct" body by resolving them to locations where there are degrees of freedom.
| void modelspace::Frame::dump | ( | ) |
Dump all information associated with the frame.
| std::vector< Frame * > modelspace::Frame::frameChildren | ( | ) |
Return all children of the frame as a vector of frames.
| Frame * modelspace::Frame::getFrameByAddress | ( | const std::string & | address | ) |
Function to get an object from the graph tree by string address.
| address | The exact string address to access the variable with |
| Frame * modelspace::Frame::getFrameRootPointer | ( | ) |
Function to get a pointer to this frame's root frame.
| void modelspace::Frame::getStateAsStateVector | ( | std::array< floating_point, 13 > & | state_f_p__f | ) |
Function to return frame state as a NUM_INTEGRATED_STATES-element state vector.
| state | Return of NUM_INTEGRATED_STATES-element state vector as [pos][vel][quat][omega] |
| void modelspace::Frame::getStateVectorDot | ( | std::array< floating_point, 13 > & | state_dot | ) |
Function to get the rate of change in the frame state vector.
| state_dot | Rate of change in each element of the state vector |
|
inline |
|
inline |
Getter and setter for integrator pointer.
|
inline |
|
inline |
| int modelspace::Frame::parent | ( | Frame * | new_parent | ) |
Function to assign the frame's parent via pointer.
| new_parent | The new parent to assign the node to |
|
inline |
Function to get the acceleration of the frame relative to parent expressed in parent coords.
|
inline |
Function to get angular acceleration relative to parent in frame coords.
|
inline |
Function to get reference to the frame's rotational joint.
| clockwerk::CartesianVector< 3 > modelspace::Frame::rootRelAcceleration | ( | ) |
| void modelspace::Frame::rootRelAcceleration | ( | clockwerk::CartesianVector< 3 > & | acc_o_root__root | ) |
Returns the acceleration of the frame origin wrt the root origin, in root coordinates.
| acc_o_root__root | Implicit return of acceleration of origin relative to root, in root |
| clockwerk::CartesianVector< 3 > modelspace::Frame::rootRelAngularAcceleration | ( | ) |
| void modelspace::Frame::rootRelAngularAcceleration | ( | clockwerk::CartesianVector< 3 > & | alpha_f_root__f | ) |
Returns the angular acceleration of the frame origin wrt the root, expressed in this frame's coordinates.
| alpha_f_root__f | Implicit return of angular acceleration relative to root, expressed in f frame |
| clockwerk::CartesianVector< 3 > modelspace::Frame::rootRelAngularVelocity | ( | ) |
| void modelspace::Frame::rootRelAngularVelocity | ( | clockwerk::CartesianVector< 3 > & | w_f_root__f | ) |
Returns the angular velocity of the frame origin wrt the root, expressed in this frame's coordinates.
| w_f_root__f | Implicit return of angular velocity relative to root, expressed in f frame |
| clockwerk::DCM modelspace::Frame::rootRelDCM | ( | ) |
| void modelspace::Frame::rootRelDCM | ( | clockwerk::DCM & | dcm_f_root | ) |
Returns the clockwerk::DCM of the frame origin wrt the root frame.
| dcm_f_root | Implicit return of attitude relative to root |
| clockwerk::CartesianVector< 3 > modelspace::Frame::rootRelPosition | ( | ) |
| void modelspace::Frame::rootRelPosition | ( | clockwerk::CartesianVector< 3 > & | pos_o_root__root | ) |
Returns the position of the frame origin wrt the root origin, in root coordinates.
| pos_o_root__root | Implicit return of position of origin relative to root, in root |
| clockwerk::Quaternion modelspace::Frame::rootRelQuaternion | ( | ) |
| void modelspace::Frame::rootRelQuaternion | ( | clockwerk::Quaternion & | quat_f_root | ) |
Returns the quaternion representing the frame origin wrt the root frame.
| quat_f_root | Implicit return of attitude relative to root |
| clockwerk::CartesianVector< 3 > modelspace::Frame::rootRelVelocity | ( | ) |
| void modelspace::Frame::rootRelVelocity | ( | clockwerk::CartesianVector< 3 > & | vel_o_root__root | ) |
Returns the velocity of the frame origin wrt the root origin, in root coordinates.
| vel_o_root__root | Implicit return of velocity of origin relative to root in root |
|
inline |
Function to set parent relative acceleration of frame.
| accel | acceleration of frame relative to parent in parent frame coords |
|
inline |
Function to set parent relative angular acceleration.
| alpha | angular accel of the frame relative to parent in parent frame coords |
| int modelspace::Frame::setRootRelAngularVelocity | ( | const clockwerk::CartesianVector< 3 > & | w_f_root__f | ) |
Function to set the frame's position relative to root.
| w_f_root__f | Angular velocity of this frame wrt root frame origin, as specified in this frame |
| int modelspace::Frame::setRootRelAttitude | ( | const clockwerk::Quaternion & | quat_f_root | ) |
Function to set the frame's attitude relative to root.
| quat_f_root | Attitude of this frame wrt root frame |
| int modelspace::Frame::setRootRelPosition | ( | const clockwerk::CartesianVector< 3 > & | pos_f_root__root | ) |
Function to set the frame's position relative to root.
| pos_f_root__root | Position of this frame wrt root frame origin, as specified in the root frame |
| int modelspace::Frame::setRootRelVelocity | ( | const clockwerk::CartesianVector< 3 > & | vel_f_root__root | ) |
Function to set the frame's velocity relative to root.
| vel_f_root__root | Velocity of this frame wrt root frame origin, as specified in the root frame |
| void modelspace::Frame::setStateFromStateVector | ( | const std::array< floating_point, 13 > & | state_f_p__f | ) |
Function to set frame state based on NUM_INTEGRATED_STATES-element state vector.
| state | NUM_INTEGRATED_STATES-element state vector as [pos][vel][quat][omega] |
|
inline |
Function to get reference to the frame's translational joint.
|
protected |
Internal variables to store accelerations applied to this frame. Note: these are not states. They are temporary variables and treated slightly differently.
|
protected |
|
protected |
Rotational.
Pointer to the integrator that is integrating this frame. Nullptr if unused
|
protected |
Variable to hold our parent.
|
protected |
Translational.
|
protected |
Translational and rotational joints relating this frame to its parent. Set locked by default.
| clockwerk::DataIO<clockwerk::CartesianVector<3> > modelspace::Frame::ang_vel_f_p__f |
Angular velocity of the frame with respect to parent, in frame coordinates
| clockwerk::DataIO<clockwerk::CartesianVector<3> > modelspace::Frame::pos_f_p__p |
Position of the frame with respect to parent, in parent coordinates
| clockwerk::DataIO<clockwerk::Quaternion> modelspace::Frame::quat_f_p |
Attitude quaternion of the frame with respect to parent
| clockwerk::DataIO<Frame*> modelspace::Frame::self_id = clockwerk::DataIO<Frame*>(nullptr, "self_id", this) |
| clockwerk::DataIO<clockwerk::CartesianVector<3> > modelspace::Frame::vel_f_p__p |
Velocity of the frame with respect to parent, in parent coordinates. Note that this is the velocity IN the parent frame, which takes into account rotation.