This package integrates a Model Predictive Controller (MPC) with Basilisk astrodynamics simulator using BSK-ROS2-Bridge.
The MPC is implemented using the acados framework.
This package provides MPC controllers for spacecraft control in two main configurations:
- Single Agent MPC: Individual spacecraft control with position and attitude tracking
- Leader-Follower MPC: Multi-agent formation control where followers maintain relative positions to a leader spacecraft
This package depends on acados
. Follow the official installation guide to set it up.
Clone this repo and the following dependencies into your ROS 2 workspace:
Build the workspace:
colcon build --packages-up-to bsk-ros2-mpc
source install/local_setup.bash
Before launching the MPC controllers, ensure the following components are running:
- Basilisk Simulation: The astrodynamics simulation must be started first
- BSK-ROS2-Bridge: The bridge connecting Basilisk to ROS2 must be active
For individual spacecraft control with position and attitude tracking:
ros2 launch bsk-ros2-mpc bsk_mpc.launch.py
For multi-agent formation control, launch the controllers in sequence:
- Start the leader controller (moves between waypoints):
ros2 launch bsk-ros2-mpc mpc_leader.launch.py
- Start the follower controllers (maintains relative positions to leader):
ros2 launch bsk-ros2-mpc mpc_followers.launch.py
The follower launch file starts MPC controllers for both follower spacecraft simultaneously.
The launch files support various configuration options:
type
: Controller type (da
for direct allocation,wrench
for force/torque control)namespace
: ROS namespace for the spacecraft
- Configures the leader spacecraft to follow waypoint trajectories
- Handles position and attitude reference tracking
- Launches MPC controllers for follower spacecraft
- Configures relative position maintenance with respect to the leader
Single Agent - Basic:
ros2 launch bsk-ros2-mpc bsk_mpc.launch.py
Single Agent - Direct Allocation MPC:
ros2 launch bsk-ros2-mpc bsk_mpc.launch.py type:=da
Single Agent - Wrench MPC:
ros2 launch bsk-ros2-mpc bsk_mpc.launch.py type:=wrench namespace:=bskSat0
Formation Control - Leader:
ros2 launch bsk-ros2-mpc mpc_leader.launch.py
Formation Control - Followers:
ros2 launch bsk-ros2-mpc mpc_followers.launch.py
This project is licensed under the BSD-3-Clause License - see the LICENSE file for details.
Elias Krantz
Email: eliaskra@kth.se