Spacecraft Models Package 2.0
Spacecraft Models for DSim
Public Member Functions | Protected Attributes | List of all members
rigid_body Class Reference

Rigid body dynamical model applying both force and torque to the spacecraft. More...

#include <rigid_body.h>

Inherits dsim_model.

Public Member Functions

void initialize_data ()
 Initialize outlets and output variables.
 
void initialization_complete ()
 Finish initialization.
 
void initialize_timestep ()
 Computation done prior to numerical integration.
 
void complete_timestep ()
 Computation done after numerical integration.
 
void rhs (double t, double jd)
 Computation done during numerical integration. More...
 
dsim_value handle_message (const std::string &sender_path, const std::string &message_name, const dsim_value &argument)
 Handle force and torque messages. More...
 

Protected Attributes

dsim_variable spacecraft_name_dsim
 Spacecraft name.
 
dsim_variable spacecraft_type_dsim
 Spacecraft type.
 
dsim_variable position_dsim
 object position
 
dsim_variable velocity_dsim
 object velocity
 
dsim_variable quaternion_dsim
 attitude quaternion ([scalar;x;y;z])
 
dsim_variable bodyRate_dsim
 body rotational rates (rad/s)
 
dsim_variable mass_dsim
 total mass, including mass of children
 
dsim_variable inertia_dsim
 total inertia, including children
 
dsim_variable ang_momentum_dsim
 Angular momentum.
 
dsim_variable acceleration_dsim
 object linear acceleration in body frame
 
dsim_variable angular_acceleration_dsim
 Angular acceleration.
 
dsim_variable frame_dsim
 frame for initial conditions
 
dsim_variable centerOfMass_dsim
 Center of mass.
 
dsim_variable quaternionCommand_dsim
 Commanded quaternion.
 
ml_matrix inertia
 Stored inertia for computational efficiency.
 
ml_matrix invInertia
 Stored inverse inertia for computational efficiency.
 
ml_matrix force
 The external force on the spacecraft.
 
ml_matrix torque
 The external torque on the spacecraft.
 
double mass
 Mass.
 
double m_to_km
 Convert meters to kilometers.
 

Detailed Description

Rigid body dynamical model applying both force and torque to the spacecraft.

Integrates the position, velocity, quaternion, and body rates. Allows the mass of the spacecraft to change. Children can use the apply_torque, apply_force, or mass_changed messages. Ignores any effect of or changes in center of mass. Does not add up or compute changes in inertia. Assumes all torques are about the center of mass.

Member Function Documentation

◆ rhs()

void rigid_body::rhs ( double  t,
double  jd 
)

Computation done during numerical integration.

Dynamics and kinematics.

References acceleration_dsim, angular_acceleration_dsim, bodyRate_dsim, force, inertia, invInertia, m_to_km, mass, mass_dsim, position_dsim, quaternion_dsim, torque, and velocity_dsim.

◆ handle_message()

dsim_value rigid_body::handle_message ( const std::string &  sender_path,
const std::string &  message_name,
const dsim_value &  argument 
)

Handle force and torque messages.

Handle the messages.

The units should be N and Nm. Force should be in the ECI frame and torque should be in the body frame.

References force, and torque.


The documentation for this class was generated from the following files: