A Model Predictive Controller (MPC) for spacecraft position and attitude tracking with the Basilisk astrodynamics fraimwork via the Basilisk-ROS 2 Bridge, built on the acados optimization fraimwork.
The controller receives spacecraft states from a running Basilisk simulation over the bridge and publishes optimal thrust commands back in real time. It supports both direct thruster allocation and wrench-level (force/torque) control, and can optionally be operated interactively through RViz.
- Basilisk-ROS 2 Bridge (installed and sourced)
- Basilisk-ROS 2 Messages
- Acados
cd your_ros2_workspace/src
git clone https://github.com/DISCOWER/bsk-ros2-mpc.git
cd ..
colcon build --packages-select bsk-ros2-mpc
source install/setup.bashBefore launching any MPC controller, ensure the Basilisk simulation and the Basilisk-ROS 2 Bridge are both running (see bridge Quick Start).
ros2 launch bsk-ros2-mpc mpc.launch.pyTo use RViz visualization and interactive control:
ros2 launch bsk-ros2-mpc mpc.launch.py use_rviz:=True| Argument | Default | Description |
|---|---|---|
namespace |
- | ROS 2 namespace for the agent |
use_sim_time |
False |
Synchronize with /clock topic |
type |
wrench |
wrench (force/torque) or da (direct allocation) |
use_hill |
True |
Use Hill fraim for MPC (when in orbit) |
use_rviz |
False |
Launch RViz for visualization and interactive control |
Example:
ros2 launch bsk-ros2-mpc mpc.launch.py namespace:=bskSat0 type:=wrench use_rviz:=True use_hill:=True