The Body class defined in C++ provides a specialized class derived from the Frame class. It is designed for use in defining bodies in a 6-DOF dynamics context, incorporating mass and inertia properties. This guide provides an overview of how to interact with the Body class.

The Body Class

Description and Naming

The Body class is a templated class with one template argument - T. Body<T> produces a body object with properties and functions related to mass and inertia. The argument is:

  • T - The type of the body’s properties. This should be a floating-point type.

Since the class is derived from the Frame class, it inherits all the functionalities of the Frame class and adds several body-specific operations.

For a complete guide on interacting with the Body class, refer to the Doxygen documentation: Body Doxygen

Creating a Body

Description C++ Example Python Example

Constructor - Creates a body with a name and an optional parent frame.

Body<double> body1("body1");
BodyD body1("body1");

Constructor - Creates a body with a name and an optional parent frame.

Body<double> body1("body1", parentFrame);
BodyD body1("body1", parentFrame);

Setting Mass - Sets the mass of the body.

body1.mass(10.0);
body1.mass(10.0)

Setting Inertia - Sets the inertia matrix of the body.

Matrix<double, 3, 3> inertiaMatrix({{1.0, 0.0, 0.0}, {0.0, 1.0, 0.0}, {0.0, 0.0, 1.0}});
body1.inertia(inertiaMatrix);
Matrix<double, 3, 3> inertiaMatrix([[1.0, 0.0, 0.0], [0.0, 1.0, 0.0], [0.0, 0.0, 1.0]]);
body1.inertia(inertiaMatrix)