Skip to content

DISCOWER/bsk-ros2-mpc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

BSK ROS2 MPC Controller (BSK-ROS2-MPC)

This package integrates a Model Predictive Controller (MPC) with Basilisk astrodynamics simulator using BSK-ROS2-Bridge.

The MPC is implemented using the acados framework.

Overview

This package provides MPC controllers for spacecraft control in two main configurations:

  1. Single Agent MPC: Individual spacecraft control with position and attitude tracking
  2. Leader-Follower MPC: Multi-agent formation control where followers maintain relative positions to a leader spacecraft

Setup

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

Prerequisites

Before launching the MPC controllers, ensure the following components are running:

  1. Basilisk Simulation: The astrodynamics simulation must be started first
  2. BSK-ROS2-Bridge: The bridge connecting Basilisk to ROS2 must be active

Running the MPC Controllers

Single Agent MPC

For individual spacecraft control with position and attitude tracking:

ros2 launch bsk-ros2-mpc bsk_mpc.launch.py

Leader-Follower Formation Control

For multi-agent formation control, launch the controllers in sequence:

  1. Start the leader controller (moves between waypoints):
ros2 launch bsk-ros2-mpc mpc_leader.launch.py
  1. 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.

Launch File Options

The launch files support various configuration options:

bsk_mpc.launch.py

  • type: Controller type (da for direct allocation, wrench for force/torque control)
  • namespace: ROS namespace for the spacecraft

mpc_leader.launch.py

  • Configures the leader spacecraft to follow waypoint trajectories
  • Handles position and attitude reference tracking

mpc_followers.launch.py

  • Launches MPC controllers for follower spacecraft
  • Configures relative position maintenance with respect to the leader

Examples

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

References

License

This project is licensed under the BSD-3-Clause License - see the LICENSE file for details.

Authors

Elias Krantz
Email: eliaskra@kth.se

About

ROS2 controllers for Basilisk Astrodynamics Simulator using BSK_ROS2_Bridge

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published