trick/trick_sims/SIM_singlerigidbody
Aditya Girish 0292b52cf7
Added graphics client for SIM rigid body. (#1779)
* added SIM_singlerigidbody

* Added matrix operations file.

* Imported libraries and declared variables.

* New objects and more defined values.

* Declared more variables and added AzElRot. function.

* Sockets and file connections 1

* Adding to variable server.

* Variables for the variable server.

* Variable parsing added.

* Vertex model for crewModule; need to change to sphere later.

* Body and vantage positioning functions.

* Drawing functions to create the model.

* Finished drawing functions for world.

* Changed some of the object names and variable names for sync.

* Added Makefile.

* Added POM file.

* Graphics client starter added to input file.

* Changed paths in S_define to reflect current file structure.

* More accurate cd error message in input file.

* Color hardcoded for testing purposes and getting the sim running.

* S_overrides changed to include graphics cleaning for each sim execution.

* S_define formatted for better readability.

* Changed shape to a dodecahedron.

* Path changed for input file.

* Airport commit

* New edges for dodecahedron.

* Triangle normals for the dodecahedron changed.

* Sim variable parsing fixed for functionality.

* Edges of dodecahedron fixed.

* Changed paint color for the shape to change based on location.

* Deleted unnecessary JViewport library.

* Increased length of x, y, and z axis lines.

* Increased vantage distance.

* Fixed triangles and normals.

* Commented on the edges.

* Deleted the notes file.

* Removed trick.frame_long_on() from splashdown SIM's realtime.py in modified data directory.

* Deleted sims directory (including images sub directory).

* Removed unnecessary body.hh and body.cpp from subdirectory.

* Removed unnecessary files.

---------

Co-authored-by: Wallace <bnwalla1@scooby.trick.gov>
Co-authored-by: AdityaGirish <aditya.girish@nasa.gov>
2024-11-12 11:23:32 -06:00
..
Images added SIM_singlerigidbody (#1762) 2024-10-16 14:37:48 -05:00
models Added graphics client for SIM rigid body. (#1779) 2024-11-12 11:23:32 -06:00
Modified_data added SIM_singlerigidbody (#1762) 2024-10-16 14:37:48 -05:00
RUN_test added SIM_singlerigidbody (#1762) 2024-10-16 14:37:48 -05:00
README.md added SIM_singlerigidbody (#1762) 2024-10-16 14:37:48 -05:00
S_define added SIM_singlerigidbody (#1762) 2024-10-16 14:37:48 -05:00
S_overrides.mk Added graphics client for SIM rigid body. (#1779) 2024-11-12 11:23:32 -06:00

Single Rigid Body

SIM_singlerigidbody is a simulation of the motion of a sphere that is a single rigid body with six degrees of freedom.

The motion of the sphere is found by using Euler's equations of motion, and can be controlled by changing several initial input values such as force, position, angle, angular velocity, velocity, and position of the force. The recorded data of the motion can then be viewed and analyzed.

Dynamics model

Equations of Motion

To determine the sphere's motion, we will use Euler's equations of motion for a single rigid body. Euler's equations describe the combined translational and rotational dynamics of a rigid body in three-dimensional space.

Equations_of_motion

Where,

Force_and_Torque_eq

  • is a 6x1 column vector.
  • F is the applied force.
  • τ is the torque.

Mass_Matrix_eq

  • is a 6x6 matrix.
  • m is the mass.
  • I 3x3 is the identity matrix.
  • I is the inertia.
  • C m is the center of mass.

Acceleration_Omega

  • is a 6x1 column vector.
  • a o is the acceleration.

Force_Torque_Remain

  • is a 6x1 column vector.
  • ω A is the angular velocity.

Force

The force acting on the sphere is calculated by the cross product of the rotation matrix and initial force.

Force

Torque

Torque is found by the cross product of the rotation matrix and the cross product of the position of force and initial force.

Torque

Mass

The default value of the mass of the sphere is:

Mass

Radius

The default value of the radius is:

Radius

Center of mass

The center of mass of a sphere is equal to its radius.

Center_of_mass

Inertia

Inertia of a sphere is calculated by:

Inertia

Acceleration and angular acceleration

To determine the acceleration and angular acceleration, dLU_Choleski must be used. dLU_Choleski solves linear sets of equations in the form of [A]x = b and returns the vector x, which is the acceleration. It decomposes the symmetric, positive definite [A] matrix into a lower triangular form, where we can then substitute and our equation becomes:

Vector_a

The term 'a' is a 6x1 vector. Acceleration is equal to the first three values of vector a and angular acceleration is equal to the last three values of vector a.

State Integration

The state is defined by position, velocity, angle, and angular velocity. They are calculated by numerically integrating velocity, acceleration, angular velocity, and angular acceleration, respectively.

Position

The position of the sphere is determined by integrating the velocity over time.

Position

Velocity

The velocity is determined by integrating the acceleration of the sphere over time.

Velocity

Angle

The angle is determined by integrating the angular velocity over time.

Angle

Angular velocity

The angular velocity is determined by integrating the angular acceleration over time.

Angular_Velocity

Inputs

Variable Type Units
dyn.body.POS_INIT double[3] m
dyn.body.ANGLE_INIT double[3] rad
dyn.body.OMEGA_INIT double[3] rad*s^-1
dyn.body.FORCE_INIT double[3] N
dyn.body.TORQUE_INIT double[3] N*m
dyn.body.VEL_INIT double[3] m/s
dyn.body.POS_FORCE double[3] m

Outputs

Variable Type Units
dyn.body.pos double[3] m
dyn.body.vel double[3] m/s
dyn.body.acc double[3] m/s^2
dyn.FORCE_INIT double[3] N
dyn.force double[3] N
dyn.body.angle_force double[3] rad
dyn.body.omegaDot double[3] rad/^s2
dyn.body.omega double[3] rad*s^-1
dyn.body.rotate double[3]