2
3
4
5
6
7
8
9
10
11
12
13
14
15
17
18
19
20
24#include "data_management/DataIO.hpp"
47 class Body :
public Frame<T> {
52 Body(
const std::string &name,
Frame<T>* par=
nullptr);
58 clockwerk::
Matrix<T, 3, 3>({{1.0,0.0,0.0},{0.0,1.0,0.0},{0.0,0.0,1.0}}));
65 clockwerk::
Matrix<T, 3, 3>({{1.0,0.0,0.0},{0.0,1.0,0.0},{0.0,0.0,1.0}}));
68 clockwerk::
DataIO<Body<T>*> self_id = clockwerk::
DataIO<Body<T>*>(
nullptr,
"self_id",
this);
95 CartesianVector<T, 3> passthroughMoment() {
return _passthrough_moment__b;}
113 template <
typename T>
114 Body<T>::
Body(
const std::string &name,
Frame<T>* par)
115 :
Frame<T>(name, par,
true) {
121 template <
typename T>
125 _ext_moment__b.setToZeros();
127 _passthrough_moment__b.setToZeros();
132 if(
this->nChildren()) {
137 for(
unsigned int i = 0; i <
this->nChildren(); i++) {
141 if(ptr->type() == BODY) {
143 Body<T>* body_ptr = (Body<T>*)ptr;
144 body_ptr->calcFrameTreeExtForcesMoments();
148 body_ptr->getFMPairAtParentOrigin(force_tmp, moment_tmp);
152 }
else if(ptr->type() == NODE) {
155 Node<T>* node_ptr = (Node<T>*)ptr;
156 node_ptr->getFMPairAtParentOrigin(force_tmp, moment_tmp);
163 ptr->calcFrameTreeExtForcesMoments();
171 template <
typename T>
185 Matrix<T, 3, 3> ci_inverse;
187 Frame<T>::_alpha_f_p__f = ci_inverse*tmp;
192 template <
typename T>
199 template <
typename T>
205 eAdd(
Frame<T>::_r_joint.freedom()*moment, _ext_moment__b, _ext_moment__b);
206 eAdd(
Frame<T>::_r_joint.dependency()*moment, _passthrough_moment__b, _passthrough_moment__b);
209 template <
typename T>
213 DCM<T> dcm_p_f =
Frame<T>::quat_f_p().toDCM().inverse();
217 moment_parentcg__p = dcm_p_f*_passthrough_moment__b + cross(
Frame<T>::pos_f_p__p(), force_parentcg__p);
CartesianVector< T, 3 > _ext_force__b
Applied external force and moment on the body.
Definition Body.hpp:105
void getFMPairAtParentOrigin(CartesianVector< T, 3 > &force_parentcg__p, CartesianVector< T, 3 > &moment_parentcg__p)
Function to resolve passthrough forces/moments into a force/moment pair in parent body frame origin.
Definition Body.hpp:210
void _calcCompositeMassInertiaCM()
Function to recurse through children and calculate body composite inertia.
Definition Body.hpp:193
CartesianVector< T, 3 > _passthrough_force__b
Passthrough force on the body – force not applied here but passed on to parent body.
Definition Body.hpp:109
int calcFrameTreeExtForcesMoments()
Function to recurse through the body and its children to apply external forces and moments to the "co...
Definition Body.hpp:122
int calcFrameTreeExtAcceleration()
Function to recurse through the body and its children to resolve applied external forces and moments ...
Definition Body.hpp:172
clockwerk::DataIO< Matrix< T, 3, 3 > > inertia
Signal/parameter for the body's inertia.
Definition Body.hpp:57
clockwerk::DataIO< T > mass
Signal/parameter for the body's mass.
Definition Body.hpp:55
clockwerk::DataIO< Matrix< T, 3, 3 > > composite_inertia
Signal/parameter for the body's composite inertia.
Definition Body.hpp:64
Body(const std::string &name, Frame< T > *par=nullptr)
Parent constructor for the body object.
Definition Body.hpp:114
CartesianVector< T, 3 > externalForce()
Getters for force and moment stuff.
Definition Body.hpp:92
void _calcAppliedForceMoment(const CartesianVector< T, 3 > &force, const CartesianVector< T, 3 > &moment)
Function to resolve forces and moments to body frame as applied and passed through.
Definition Body.hpp:200
clockwerk::DataIO< T > composite_mass
Signal/parameter for the body's composite mass.
Definition Body.hpp:61
Standard vector class derived from Matrix.
Definition CartesianVector.hpp:39
Class defining a direction cosine matrix inherited from Matrix.
Definition DCM.hpp:71
Class for inter-object communication.
Definition DataIO.hpp:46
Frame class definition.
Definition Frame.hpp:92
Base class for object organization.
Definition GraphTreeObject.h:87
std::vector< GraphTreeObject * > _children
Pointers to the object's children – automatically set to an empty vector, and can be increased to any...
Definition GraphTreeObject.h:234
uint8_t _graph_tree_type
Variable to store graph tree object type.
Definition GraphTreeObject.h:251
Matrix math implementation.
Definition Matrix.hpp:54
#define NO_ERROR
Definition clockwerkerrors.h:31