test_mass_update

test_mass_update.test_continuouslyChangingMass(showPlots: bool = False)[source]

A ball with mass m is at rest, then accelerated with constant thrust T=100 for 25 units of time in the positive x-axis direction. The initial mass m_0 is that of a sphere of radius 1 and density 1000. The mass is constantly decreasing, with a slope of -100 units of mass per unit of time. The evolution of the velocity is given by the ODE:

dm/dt = -100 dv/dt = 100/m

which has solution family:

m(t) = c_1 - 100*t v(t) = c_2 - log(100*t - c_1)

to meet the initial conditions, c_1 must be the initial mass m_0, while c_2 is log(-m_0). Solving for v(t):

v(t) = log(m_0) - log(m_0 - 100t)

In this function we run this scenario in MuJoCo to check that simulation with variable mass returns the same as the analytical solution of the velocity.