WarpTwin
Documentation for WarpTwin models and classes.
Loading...
Searching...
No Matches
warptwin::Node Class Reference

Node class to apply forces and moments to frames. More...

#include <Node.h>

Inheritance diagram for warptwin::Node:

Public Member Functions

 Node (const std::string &name, Frame *par=nullptr)
 Basic constructor for the node object.
const JointtJoint ()
 Function to get reference to the frame's translational joint.
const JointrJoint ()
 Function to get reference to the frame's rotational joint.
void getFMPairAtParentOrigin (clockwerk::CartesianVector< 3 > &force_parentcg__p, clockwerk::CartesianVector< 3 > &moment_parentcg__p)
 Function to resolve applied forces/moments into a force/moment pair in parent body frame origin.
clockwerk::CartesianVector< 3 > passthroughForce ()
clockwerk::CartesianVector< 3 > passthroughMoment ()
Public Member Functions inherited from warptwin::Frame
 Frame (const std::string &name, Frame *par=nullptr, bool free=false)
 Constructor for the frame object.
virtual ~Frame ()
std::vector< Frame * > frameChildren ()
 Return all children of the frame as a vector of frames.
FramegetFrameByAddress (const std::string &address)
 Function to get an object from the graph tree by string address.
JointtJoint ()
 Function to get reference to the frame's translational joint.
JointrJoint ()
 Function to get reference to the frame's rotational joint.
int parent (Frame *new_parent)
 Function to assign the frame's parent via pointer.
int parent (Frame &new_parent)
Frameparent ()
void setParentRelAcceleration (clockwerk::CartesianVector< 3 > accel)
 Function to set parent relative acceleration of frame.
void setParentRelAngularAcceleration (clockwerk::CartesianVector< 3 > alpha)
 Function to set parent relative angular acceleration.
clockwerk::CartesianVector< 3 > parentRelAcceleration ()
 Function to get the acceleration of the frame relative to parent expressed in parent coords.
clockwerk::CartesianVector< 3 > parentRelAngularAcceleration ()
 Function to get angular acceleration relative to parent in frame coords.
void rootRelPosition (clockwerk::CartesianVector< 3 > &pos_o_root__root) const
 Returns the position of the frame origin wrt the root origin, in root coordinates.
clockwerk::CartesianVector< 3 > rootRelPosition () const
void rootRelVelocity (clockwerk::CartesianVector< 3 > &vel_o_root__root) const
 Returns the velocity of the frame origin wrt the root origin, in root coordinates.
clockwerk::CartesianVector< 3 > rootRelVelocity () const
void rootRelAcceleration (clockwerk::CartesianVector< 3 > &acc_o_root__root) const
 Returns the acceleration of the frame origin wrt the root origin, in root coordinates.
clockwerk::CartesianVector< 3 > rootRelAcceleration () const
void rootRelQuaternion (clockwerk::Quaternion &quat_f_root) const
 Returns the quaternion representing the frame origin wrt the root frame.
clockwerk::Quaternion rootRelQuaternion () const
void rootRelDCM (clockwerk::DCM &dcm_f_root) const
 Returns the clockwerk::DCM of the frame origin wrt the root frame.
clockwerk::DCM rootRelDCM () const
void rootRelAngularVelocity (clockwerk::CartesianVector< 3 > &w_f_root__f) const
 Returns the angular velocity of the frame origin wrt the root, expressed in this frame's coordinates.
clockwerk::CartesianVector< 3 > rootRelAngularVelocity () const
void rootRelAngularAcceleration (clockwerk::CartesianVector< 3 > &alpha_f_root__f) const
 Returns the angular acceleration of the frame origin wrt the root, expressed in this frame's coordinates.
clockwerk::CartesianVector< 3 > rootRelAngularAcceleration () const
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.
int calcFrameTreeExtAcceleration ()
 Function to recurse through the body and its children to resolve applied external forces and moments into acceleration and angular acceleration.
void integrator (void *integ_ptr)
 Getter and setter for integrator pointer.
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.
void getStateAsStateVector (std::array< floating_point, 13 > &state_f_p__f)
 Function to return frame state as a NUM_INTEGRATED_STATES-element state vector.
void getStateVectorDot (std::array< floating_point, 13 > &state_dot)
 Function to get the rate of change in the frame state vector.
int setRootRelPosition (const clockwerk::CartesianVector< 3 > &pos_f_root__root)
 Function to set the frame's position relative to root.
int setRootRelVelocity (const clockwerk::CartesianVector< 3 > &vel_f_root__root)
 Function to set the frame's velocity relative to root.
int setRootRelAttitude (const clockwerk::Quaternion &quat_f_root)
 Function to set the frame's attitude relative to root.
int setRootRelAngularVelocity (const clockwerk::CartesianVector< 3 > &w_f_root__f)
 Function to set the frame's position relative to root.
FramegetFrameRootPointer ()
 Function to get a pointer to this frame's root frame.
void dump ()
 Dump all information associated with the frame.
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.
virtual ~GraphTreeObject ()
 Destructor.
GraphTreeObjectparent ()
 Functions to get object's parent/children.
GraphTreeObject ** children ()
GraphTreeObjectchildAtIndex (uint8 i) const
int16 parent (GraphTreeObject *new_parent)
 Function to assign the node's parent via pointer.
int16 parent (GraphTreeObject &new_parent)
 Function to assign the node's parent via reference.
uint8 nChildren () const
 Getters for number of children and descendants.
uint16 nDescendants () const
uint8 capacity () const
const char * name () const
 Getter and setter for object name.
int16 name (const char *new_name)
uint8 rank ()
 Getter for the object rank.
int8 type ()
 Function to indicate type – -1 by default unless implemented downstream.
bool loggable ()
 Getter for object logability flag – note no setter because should only be set by this or a derived class in its definition.
GraphTreeObjectgetRootDataPointer ()
 Get the pointer to the highest object in the graph tree.
virtual int16 str (char *output, size_t size) const
 Get object represented as string.
virtual int16 fromStr (const char *val)
 Set value of graphtreeobject from string.

Public Attributes

clockwerk::DataIO< clockwerk::CartesianVector< 3 > > force = clockwerk::DataIO<clockwerk::CartesianVector<3>>(nullptr, "force", clockwerk::CartesianVector<3>({0.0,0.0,0.0}))
 The force applied at the node.
clockwerk::DataIO< Frame * > force_frame = clockwerk::DataIO<Frame*>(nullptr, "force_frame", nullptr)
 The frame in which the force is applied. Using this utility abstracts away framerotate commands and also allows forces to be applied inertially or frame locally, because rotation will occur every step.
clockwerk::DataIO< clockwerk::CartesianVector< 3 > > moment
 The moment applied at the node.
clockwerk::DataIO< Frame * > moment_frame = clockwerk::DataIO<Frame*>(nullptr, "moment_frame", nullptr)
 The frame in which the moment is applied Using this utility abstracts away framerotate commands and also allows moments to be applied inertially or frame locally, because rotation will occur every step.
clockwerk::DataIO< Node * > self_id = clockwerk::DataIO<Node*>(nullptr, "self_id", this)
Public Attributes inherited from warptwin::Frame
clockwerk::DataIO< clockwerk::CartesianVector< 3 > > pos_f_p__p
clockwerk::DataIO< clockwerk::CartesianVector< 3 > > vel_f_p__p
clockwerk::DataIO< clockwerk::Quaternionquat_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 > _passthrough_force__b
clockwerk::CartesianVector< 3 > _passthrough_moment__b
Protected Attributes inherited from warptwin::Frame
clockwerk::CartesianVector< 3 > _acc_f_p__p
clockwerk::CartesianVector< 3 > _alpha_f_p__f
Joint _t_joint
Joint _r_joint
 Translational.
void * _integrator_ptr = nullptr
 Rotational.
Frame_parent
 Variable to hold our parent.
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.
uint8 _num_children = 0
 Number of direct children of the tree (not including the tree itself).
uint8 _rank = 0
int8 _graph_tree_type = BASE_GRAPH_TREE
 Variable to store graph tree object type.
bool _loggable = false
 Variable to indicate whether the selected object is loggable. Set to false by default.
uint32 _index = 0
 Index pointing to the next write location for the graph tree children.

Additional Inherited Members

Protected Member Functions inherited from clockwerk::GraphTreeObject
int16 _setStorage (GraphTreeObject **storage_array, uint8 storage_size)
 Getter for object's string address.
void _recalculateDescendants ()
 Function to recursively re-calculate the number of descendants of a given node on the tree.
void _recalculateRank ()
 Function to recursively re-calculate the rank of a given node on the tree.
int16 _addChild (GraphTreeObject *child)
 Function to decompose a string into a series of substrings via indexing.
int16 _removeChild (GraphTreeObject *child)
 Function to remove a child from the graph node's children.

Detailed Description

Node class to apply forces and moments to frames.

This file defines the base node class which is used to apply forces and sense accelerations at fixed locations on bodies.

The node class is a special Frame that is fully fixed to its parent (i.e. cannot be fully free) and has special handles for applying forces and moments. Because it is a simple fixed frame, it is also ideal for sensing accelerations and states, in applications such as an accelerometer.

Applying forces in the node frame is done via the force() and moment() DataIO objects. By default, forces and moments are applied in the node frame. However, passing a frame argument to the force_frame or moment_frame objects causes forces and moments to be applied in that frame – this is particularly useful for cases where the node frame is rotating but the force is not, such as gravity applied to a rotating spacecraft node.

Constructor & Destructor Documentation

◆ Node()

warptwin::Node::Node ( const std::string & name,
Frame * par = nullptr )

Basic constructor for the node object.

Parameters
nameThe name of the node
parThe node's parent. Nullptr by default

Member Function Documentation

◆ getFMPairAtParentOrigin()

void warptwin::Node::getFMPairAtParentOrigin ( clockwerk::CartesianVector< 3 > & force_parentcg__p,
clockwerk::CartesianVector< 3 > & moment_parentcg__p )

Function to resolve applied forces/moments into a force/moment pair in parent body frame origin.

Parameters
force_parentcg__pImplicit return of force applied to this node in the parent body frame
moment_parentcg__pImplicit return of moment applied to this node in the parent body frame, RESOLVED TO A FORCE/MOMENT COUPLE AT THE PARENT FRAME LOCATION

◆ passthroughForce()

clockwerk::CartesianVector< 3 > warptwin::Node::passthroughForce ( )
inline

◆ passthroughMoment()

clockwerk::CartesianVector< 3 > warptwin::Node::passthroughMoment ( )
inline

◆ rJoint()

const Joint & warptwin::Node::rJoint ( )
inline

Function to get reference to the frame's rotational joint.

Returns
The frame's rotational joint
Note
OVERRIDES frame default joint with unmodifiable version

◆ tJoint()

const Joint & warptwin::Node::tJoint ( )
inline

Function to get reference to the frame's translational joint.

Returns
The frame's translational joint
Note
OVERRIDES frame default joint with unmodifiable version

Member Data Documentation

◆ _passthrough_force__b

clockwerk::CartesianVector<3> warptwin::Node::_passthrough_force__b
protected

Passthrough force on the node – force not applied here but passed on to parent body All forces and moments should be passed through for nodes

◆ _passthrough_moment__b

clockwerk::CartesianVector<3> warptwin::Node::_passthrough_moment__b
protected

◆ force

clockwerk::DataIO<clockwerk::CartesianVector<3> > warptwin::Node::force = clockwerk::DataIO<clockwerk::CartesianVector<3>>(nullptr, "force", clockwerk::CartesianVector<3>({0.0,0.0,0.0}))

The force applied at the node.

◆ force_frame

clockwerk::DataIO<Frame*> warptwin::Node::force_frame = clockwerk::DataIO<Frame*>(nullptr, "force_frame", nullptr)

The frame in which the force is applied. Using this utility abstracts away framerotate commands and also allows forces to be applied inertially or frame locally, because rotation will occur every step.

Note
Our node only rotates from the force frame – no translation or coupling

◆ moment

clockwerk::DataIO<clockwerk::CartesianVector<3> > warptwin::Node::moment
Initial value:
"moment", clockwerk::CartesianVector<3>({0.0,0.0,0.0}))
Standard vector class derived from Matrix.
Definition CartesianVector.hpp:39
Class for inter-object communication.
Definition DataIO.hpp:60

The moment applied at the node.

◆ moment_frame

clockwerk::DataIO<Frame*> warptwin::Node::moment_frame = clockwerk::DataIO<Frame*>(nullptr, "moment_frame", nullptr)

The frame in which the moment is applied Using this utility abstracts away framerotate commands and also allows moments to be applied inertially or frame locally, because rotation will occur every step.

Note
Our node only rotates from the moment frame – no translation or coupling

◆ self_id

clockwerk::DataIO<Node*> warptwin::Node::self_id = clockwerk::DataIO<Node*>(nullptr, "self_id", this)

The documentation for this class was generated from the following files:
  • /Users/mickey/Documents/Projects/warptwin/cpp/src/frames/Node.h
  • /Users/mickey/Documents/Projects/warptwin/cpp/src/frames/Node.cpp