The Frame class defined in C++ forms the basis for all 6-DOF kinematics and dynamics. It is designed for recursive chaining and represents the relationship of a frame to its parent.

The Frame Class

Description and Naming

The Frame class is a templated class with one template argument - T. Frame<T> represents a frame with the following key parameters relative to its parent:

  • pos_f_p__p - Position of the child frame relative to its parent, in parent coordinates.

  • vel_f_p__p - Velocity of the child frame in the parent frame, in parent coordinates.

  • quat_f_p - Attitude quaternion of the child frame relative to its parent.

  • ang_vel_f_p__f - Angular velocity of the child frame relative to its parent, in frame coordinates.

The Frame class also includes translational and rotational joints to track degrees of freedom.

A Note on Freedom

The frame class’s chain kinematics are dependent on the concept of whether it is "free" to translate, that is, can have velocity, relative to its parent. Frames may be defined as fully free or fully locked. The default is locked. This functionality is handled by the frame’s joint (a separate class).

A Note on the Root Frame

A key concept in the ModelSpace is the root frame. This is a special frame which serves as the ultimate inertial refererence point relative to which the entire simulation is constructed. It is typically set to the planet relative to which the analysis is being performed by default (aligned to planet’s inertial reference frame), but may be a random reference (for flat earth scenarios) or another celestial body (for instance, the sun in interplanetary simulations). Many functions return frame states relative to root as the ultimate inertial reference point.

Doxygen

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

Creating a Frame

Description C++ Example Python Example

Constructor for the frame class with only a name

Frame<double> frame1("frame1");
frame1 = FrameD("frame1")

Constructor for the frame class with name and parent

Frame<double> frame1("frame1", parent_frame_ptr);
frame1 = FrameD("frame1", parent_frame)

Constructor for the frame class with name, parent, and freedom. In this case set fully free relative to parent.

Frame<double> frame1("frame1", parent_frame_ptr, true);
frame1 = FrameD("frame1", parent_frame, True)

Getting and Setting Values

Description C++ Example Python Example

Get Translational Joint - Retrieves the frame’s translational joint.

Joint<double> tJoint = frame1.tJoint();
tJoint = frame1.tJoint()

Get Rotational Joint - Retrieves the frame’s rotational joint.

Joint<double>& rJoint = frame1.rJoint();
rJoint = frame1.rJoint()

Set Parent Frame - Sets the parent frame.

frame2.parent(&frame1);
frame2.parent(frame1)

Set Position Relative to Root - Sets the frame’s position relative to the root.

CartesianVector<double, 3> pos_f_root__root({1.0, 2.0, 3.0});
frame2.setRootRelPosition(pos_f_root__root);
pos_f_root__root = CartesianVector3D([1.0, 2.0, 3.0])
frame2.setRootRelPosition(pos_f_root__root)

Set Velocity Relative to Root - Sets the frame’s velocity relative to the root.

CartesianVector<double, 3> vel_f_root__root({0.5, 0.5, 0.5});
frame2.setRootRelVelocity(vel_f_root__root);
pos_f_root__root = CartesianVector3D([0.5, 0.5, 0.5])
frame2.setRootRelVelocity(pos_f_root__root)

Set Attitude Relative to Root - Sets the frame’s attitude relative to the root.

Quaternion<double> quat_f_root({1.0, 0.0, 0.0, 0.0});
frame2.setRootRelAttitude(quat_f_root);
quat_f_root = QuaternionD([1.0, 0.0, 0.0, 0.0])
frame2.setRootRelAttitude(quat_f_root)

Set Angular Velocity Relative to Root - Sets the frame’s angular velocity relative to the root.

CartesianVector<double, 3> w_f_root__f({0.1, 0.2, 0.3});
frame2.setRootRelAngularVelocity(w_f_root__f);
w_f_root__f = CartesianVector3D([0.1, 0.2, 0.3])
frame2.setRootRelAngularVelocity(w_f_root__f)

Getting Values Relative to Root

Description C++ Example Python Example

Get Position Relative to Root - Retrieves the frame’s position relative to the root.

CartesianVector<double, 3> pos = frame2.rootRelPosition();
pos = frame2.rootRelPosition()

Get Velocity Relative to Root - Retrieves the frame’s velocity relative to the root.

CartesianVector<double, 3> vel = frame2.rootRelVelocity();
vel = frame2.rootRelVelocity()

Get Acceleration Relative to Root - Retrieves the frame’s acceleration relative to the root.

CartesianVector<double, 3> acc = frame2.rootRelAcceleration();
acc = frame2.rootRelAcceleration()

Get Attitude Quaternion Relative to Root - Retrieves the frame’s attitude quaternion relative to the root.

Quaternion<double> quat = frame2.rootRelQuaternion();
quat = frame2.rootRelQuaternion()

Get Direction Cosine Matrix Relative to Root - Retrieves the frame’s DCM relative to the root.

DCM<double> dcm = frame2.rootRelDCM();
dcm = frame2.rootRelDCM()

Get Angular Velocity Relative to Root - Retrieves the frame’s angular velocity relative to the root.

CartesianVector<double, 3> omega = frame2.rootRelAngularVelocity();
omega = frame2.rootRelAngularVelocity()

Get Angular Acceleration Relative to Root - Retrieves the frame’s angular acceleration relative to the root.

CartesianVector<double, 3> alpha = frame2.rootRelAngularAcceleration();
alpha = frame2.rootRelAngularAcceleration()