22 DragData(
const std::vector<double>& linear_drag,
const std::vector<double>& quadratic_drag)
24 assert(linear_drag.size() == 6 && quadratic_drag.size() == 6);
25 for (
unsigned int i = 0; i < 6; i++)
74 dragData1 += dragData2;
148 mInertia =
Math::Matrix3d(gyration_radii[0], 0., 0., 0., gyration_radii[1], 0., 0., 0., gyration_radii[2]);
171 mInertia =
Math::Matrix3d(gyration_radii[0], 0., 0., 0., gyration_radii[1], 0., 0., 0., gyration_radii[2]);
189 mInertia =
Math::Matrix3d(gyration_radii[0], 0., 0., 0., gyration_radii[1], 0., 0., 0., gyration_radii[2]);
281 if (other_body.
mMass == 0. && other_body.
mInertia == Math::Matrix3d::Zero())
286 double other_mass = other_body.
mMass;
287 double new_mass =
mMass + other_mass;
289 double other_volume = other_body.
volume;
290 double new_volume =
volume + other_volume;
294 throw RdlException(
"Error: cannot join bodies as both have zero mass!");
300 if (new_volume != 0.)
323 Math::Matrix3d inertia_other_com = inertia_other - other_mass * other_com_cross * other_com_cross.transpose();
326 Math::Matrix3d inertia_other_com_rotated = transform.
E.transpose() * inertia_other_com * transform.
E;
340 *
this =
Body(new_mass, new_com, new_inertia, new_cob, new_volume, new_added_mass_matrix, new_drag_data);
See V. Duindum p39-40 & Featherstone p32-33.
Definition: rdl_eigenmath.hpp:104
This class stores a bodies mass, center of mass, and inertia information. The inertia elements are st...
Definition: RigidBodyInertia.hpp:42
SpatialMatrix toMatrix() const
Definition: RigidBodyInertia.cpp:99
Definition: rdl_eigenmath.hpp:354
Definition: rdl_eigenmath.hpp:187
Definition: rdl_eigenmath.hpp:54
Matrix3d toTildeForm() const
Definition: rdl_eigenmath.cpp:118
A custom exception.
Definition: RdlExceptions.hpp:18
static RigidBodyInertia createFromMassComInertiaC(double mass, const Vector3d &com, const Matrix3d &inertia_C)
Definition: RigidBodyInertia.hpp:269
Vector3d Vector3dZero(0., 0., 0.)
Definition: rdl_mathutils.hpp:38
SpatialMatrix SpatialMatrixZero(0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.)
Definition: rdl_mathutils.hpp:45
Matrix3d parallel_axis(const Matrix3d &inertia, double mass, const Vector3d &com)
Translates the inertia matrix to a new center.
Definition: rdl_mathutils.cpp:122
Namespace for all structures of the RobotDynamics library.
Definition: examples.hpp:19
DragData operator+(DragData dragData1, const DragData &dragData2)
Definition: Body.hpp:72
Describes all properties of a single body.
Definition: Body.hpp:88
Body(const double &mass, const Math::Vector3d &com, const Math::Vector3d &gyration_radii, const Math::Vector3d ¢erOfBuoyancy, const double volume, const Math::SpatialMatrix &addedMassMatrix, const DragData &dragData)
Constructs a body from mass, center of mass, radii of gyration, the center of buoyancy,...
Definition: Body.hpp:144
Math::Vector3d mCenterOfBuoyancy
Definition: Body.hpp:353
Body(const Body &body)
Definition: Body.hpp:101
Body(const double &mass, const Math::Vector3d &com, const Math::Matrix3d &inertia_C)
Constructs a body from mass, center of mass, a 3x3 inertia matrix. Hydrodynamic terms are set such th...
Definition: Body.hpp:257
double volume
Definition: Body.hpp:352
Body()
Definition: Body.hpp:89
Math::SpatialMatrix addedMassMatrix
Definition: Body.hpp:354
Body(const double &mass, const Math::Vector3d &com, const Math::Vector3d &gyration_radii)
Constructs a body from mass, center of mass, radii of gyration. Hydrodynamic terms are set such that ...
Definition: Body.hpp:186
Body & operator=(const Body &body)
Definition: Body.hpp:111
Body(const double &mass, const Math::Vector3d &com, const Math::Vector3d &gyration_radii, const Math::Vector3d ¢erOfBuoyancy, const double volume, const Math::SpatialMatrix &addedMassMatrix)
Constructs a body from mass, center of mass, radii of gyration, the center of buoyancy,...
Definition: Body.hpp:166
Body(const double &mass, const Math::Vector3d &com, const Math::Matrix3d &inertia_C, const Math::Vector3d ¢erOfBuoyancy, const double volume, const Math::SpatialMatrix &addedMassMatrix, const DragData &dragData)
Constructs a body from mass, center of mass, a 3x3 inertia matrix, the center of buoyancy,...
Definition: Body.hpp:210
Math::Matrix3d mInertia
Inertia matrix at the center of mass.
Definition: Body.hpp:350
double mMass
The mass of the body.
Definition: Body.hpp:343
bool mIsVirtual
Definition: Body.hpp:356
void join(const Math::SpatialTransform &transform, const Body &other_body)
Joins inertial parameters of two bodies to create a composite body.
Definition: Body.hpp:278
Body(const double &mass, const Math::Vector3d &com, const Math::Matrix3d &inertia_C, const Math::Vector3d ¢erOfBuoyancy, const double volume, const Math::SpatialMatrix addedMassMatrix)
Constructs a body from mass, center of mass, a 3x3 inertia matrix, the center of buoyancy,...
Definition: Body.hpp:238
~Body()
Definition: Body.hpp:343
DragData dragData
Definition: Body.hpp:355
Math::Vector3d mCenterOfMass
The position of the center of mass in body coordinates.
Definition: Body.hpp:348
void operator+=(const DragData &dragData)
Definition: Body.hpp:62
DragData()
Definition: Body.hpp:38
void zero()
Definition: Body.hpp:49
DragData(const DragData &dragData)
Definition: Body.hpp:43
Math::SpatialVector linearDrag
Definition: Body.hpp:68
DragData(const std::vector< double > &linear_drag, const std::vector< double > &quadratic_drag)
Definition: Body.hpp:22
DragData & operator=(const DragData &dragData)
Definition: Body.hpp:55
Math::SpatialVector quadraticDrag
Definition: Body.hpp:69
DragData(const Math::SpatialVector &linear_drag, const Math::SpatialVector &quadratic_drag)
Definition: Body.hpp:32
Keeps the information of a body and how it is attached to another body.
Definition: Body.hpp:366
Math::Matrix3d mInertia
The spatial inertia that contains both mass and inertia information.
Definition: Body.hpp:372
double mMass
The mass of the body.
Definition: Body.hpp:368
Math::Vector3d mCenterOfBuoyancy
Definition: Body.hpp:374
Math::SpatialTransform mBaseTransform
Definition: Body.hpp:383
Math::Vector3d mCenterOfMass
The position of the center of mass in body coordinates.
Definition: Body.hpp:370
double volume
Definition: Body.hpp:373
Math::SpatialTransform mParentTransform
Transforms spatial quantities expressed for the parent to the.
Definition: Body.hpp:382
unsigned int mMovableParent
Id of the movable body that this fixed body is attached to.
Definition: Body.hpp:379
static FixedBody CreateFromBody(const Body &body)
Definition: Body.hpp:385
Math::SpatialMatrix addedMassMatrix
Definition: Body.hpp:375
DragData dragData
Definition: Body.hpp:376