trick/trick_sims/SIM_singlerigidbody/README.md
bnwalla1 7bc6ab74a8
added SIM_singlerigidbody (#1762)
* added SIM_singlerigidbody

* Removed a few sections in the README file

* Removed the sims directory

* Added shutdown job and made minor changes to body.cpp

---------

Co-authored-by: Wallace <bnwalla1@scooby.trick.gov>
2024-10-16 14:37:48 -05:00

4.3 KiB

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]