test_MJSystemCoM
- test_MJSystemCoM.MJSystemCoMTest(show_plots, model, moving, displaced)[source]
Validation Test Description
This unit test sets up a spacecraft to extract its center of mass.
Test Parameters
The spacecraft geometry, velocity, and base position are varied between tests
- Parameters:
model (str) – the model of the spacecraft for this parameterized unit test
moving (bool) – whether the spacecraft is moving or not for this parameterized unit test
displaced (bool) – whether the spacecraft base is displaced or not for this parameterized unit test
Description of Variables Being Tested
In this test we are checking the location and velocity of the spacecraft’s center of mass compared to the expected values
- test_MJSystemCoM.test_variable_mass_velocity_is_com_position_derivative(rotated)[source]
Include the quotient-rule term in the reported CoM velocity.
A 10 kg hub and a 2 kg tank translate together, with the tank positioned by a fixed inertial offset \(\mathbf d\) from the hub and depleting at 0.5 kg/s. Their center of mass is
\[\mathbf r_C(t) = \mathbf r_H(0) + \mathbf v_Ht + \frac{m(t)}{10+m(t)}\mathbf d, \qquad m(t) = 2 - 0.5t,\]so
\[\dot{\mathbf r}_C(t) = \mathbf v_H + \frac{10\dot m}{(10+m(t))^2}\mathbf d.\]The second term distinguishes the position derivative from the mass-weighted body velocity. The rotated case ensures that the correction uses inertial body positions rather than MJCF-local offsets.