scenarioBranchingPanels

It’s recommended to review the following scenario(s) first (and any recommended scenario(s) that they may have):

  1. examples/mujoco/scenarioDeployPanels.py

This script demonstrates how to simulate a spacecraft with a branching solar panel deployment sequence using a Proportional- Integral-Derivative (PID) controller. Like scenarioDeployPanels.py, this scenario uses the MuJoCo-based DynamicObject MJScene, but extends the concept to a more complex, multi-stage deployment process.

In mujoco/scenarioDeployPanels.py, all solar panels were deployed simultaneously using PID controllers and trapezoidal/triangular velocity profiles. In this scenario, the panels are deployed in a staged sequence, where the deployment of some panels happens after the deployment of others. Moreover, this scenario uses the C++ implementation of the PID controller (MJPIDControllers.JointPIDController), which provides improved performance compared to the previous Python-based controller.

The multi-body system is defined in the XML file sat_w_branching_panels.xml, which describes a spacecraft hub with six deployable panels arranged in a branching configuration. Each panel is attached via a revolute joint, and the deployment sequence is controlled by locking and unlocking joints at specific times, simulating mechanical latches.

The deployment profiles for each joint are generated using a trapezoidal/triangular velocity profile, as in the previous scenario. However, the timing of each deployment is offset to create the desired branching sequence. The PID controllers for each joint receive these profiles as their reference inputs and compute the required torques to achieve the commanded motion.

During the simulation, joints are locked or unlocked at runtime to enforce the staged deployment sequence. This is accomplished by sending constraint messages to the relevant joints, effectively freezing or releasing their motion as needed.

The simulation is run in three legs, corresponding to the sequential deployment of different panel groups. The state of the system is recorded throughout, and the desired and achieved joint angles are plotted for each panel. The system can also be visualized in 3D using the mujoco.visualize function.

This scenario illustrates how to model and control complex, staged deployment mechanisms in a spacecraft simulation, and how to coordinate multiple actuators and controllers in a branched sequence using MuJoCo and Basilisk.

scenarioBranchingPanels.generateProfiles(initialPoint: float, finalPoint: float, vMax: float, aMax: float, timeOffset: int = 0) List[ScalarJointStateInterpolator][source]

Generate a position and velocity profile for a point-to-point movement.

This function calculates the position and velocity profiles for a point-to-point movement using either a trapezoidal or triangular velocity profile, depending on whether the maximum velocity is reached or not.

Parameters:
  • initialPoint (float) – The starting position.

  • finalPoint (float) – The target position.

  • vMax (float) – The maximum velocity.

  • aMax (float) – The maximum acceleration.

  • timeOffset (int) – The profile will start at this time (in nanoseconds).

Returns:

A list containing two mujoco.ScalarJointStateInterpolator objects,

one for the position profile and one for the velocity profile.

Return type:

list

scenarioBranchingPanels.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.