scenarioUnbalancedThrusters
It’s recommended to review the following scenario(s) first (and any recommended scenario(s) that they may have):
examples/mujoco/scenarioReactionWheel.py
This script shows how to simulate a CubeSat with 4 thrusters attached each to a different fuel tank. All thrusters produce the same thrust, but one of the consumes fuel at twice the rate of the others (which simulates a defect). This is done using the MuJoCo-based DynamicObject MJScene.
The multi-body system is defined in the XML file sat_w_thrusters.xml
.
This XML file defines a ‘hub’ body with 4 tank bodies as their
sub-bodies (‘tank_1’, ‘tank_2’, etc.). The ‘hub’ body is a cube, while the
‘tank’ bodies are ‘pills’ and are contained within the ‘hub’ body. Each
‘tank’ body has a site attached to it (‘tank_X_thrust_point’), which defines
the point at which the thrust vector is applied. The thrust of each thruster
is modeled as a single actuator (‘tank_X_thrust’) that applies a force at
the corresponding site. The attribute gear
of the actuators is set to
gear="0 0 -1 0 0 0"
, which means ‘apply a force along the negative z-axis’.
For more information on how to define a multi-body system in MuJoCo, see https://mujoco.readthedocs.io/en/stable/XMLreference.html
To model a thruster, two things must be achieved:
The thrust force must be applied.
The fuel consumption must be modeled.
To accomplish the first, we tie a standalone SingleActuatorMsg
to
the control input of each of the thrusters. The payload of this message
is kept constant at 5 N.
To model the fuel consumption, we need to tell the system that the mass
of the tank bodies is decreasing. The mass of each of the bodies in the
system is a state, and thus should be updated by defining its time
derivative. This is done by tying a SCMassPropsMsg
to the
derivativeMassPropertiesInMsg
of the tank bodies. In this script,
the payload of this message is kept constant at -1 kg/s for the first 3
tanks, and -2 kg/s for the last tank.
The simulation is run for 2.5 minutes, and the mass of each of the tanks and the state of the ‘hub’ body are recorded. The mass of the tanks should decrease linearly with time, with the last tank decreasing at twice the rate of the others. Because of the initial symmetry of the configuration, the ‘hub’ body should appear to accelerate in a straight line. However, because the last tank is consuming fuel at twice the rate of the others, the inertial properties of the system become unbalanced, and the ‘hub’ body should start to rotate.
- scenarioUnbalancedThrusters.run(showPlots: bool = False, visualize: bool = False)[source]
Main function, see scenario description.
- Parameters:
showPlots (bool, optional) – If True, simulation results are plotted and show. Defaults to False.
visualize (bool, optional) – If True, the
MJScene
visualization tool is run on the simulation results. Defaults to False.