Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

DISCOWER/bsk-ros2-mpc

Open more actions menu

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
31 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Basilisk-ROS 2 MPC

A Model Predictive Controller (MPC) for spacecraft position and attitude tracking with the Basilisk astrodynamics framework via the Basilisk-ROS 2 Bridge, built on the acados optimization framework.

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.

Leader-follower formation flying with three spacecraft controlled via identical ROS 2-based MPC, running in Basilisk simulation (left) and on the ATMOS free-flyers at KTH (right). See the paper for details.

Setup

Prerequisites

Install

cd your_ros2_workspace/src
git clone https://github.com/DISCOWER/bsk-ros2-mpc.git
cd ..
colcon build --packages-up-to bsk-ros2-mpc
source install/setup.bash

Usage

Before launching any MPC controller, ensure the Basilisk simulation and the Basilisk-ROS 2 Bridge are both running (see bridge Quick Start).

Single Agent

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

Launch Options

Argument Default Description
namespace bskSat 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 frame for MPC (when in orbit)
use_rviz True Launch RViz for visualization and interactive control
name_leader "" Leader namespace (used by follower_wrench)
name_others "" Space-separated namespaces of other agents for collision avoidance
skip_build False Skip acados solver codegen/build and reuse an existing compiled solver

Notes:

  • name_others enables multi-agent avoidance by passing other agents' positions into MPC constraints. Leave it empty for single-agent runs.
  • skip_build:=True is useful for faster startup when the solver has already been generated for the same controller/model configuration.

Example:

Single-agent

ros2 launch bsk-ros2-mpc mpc.launch.py namespace:=bskSat0 type:=wrench use_hill:=True use_rviz:=True skip_build:=False

Multi-agent avoidance example (track bskSat1 and bskSat2)

ros2 launch bsk-ros2-mpc mpc.launch.py namespace:=bskSat0 type:=wrench name_others:="bskSat1 bskSat2"

Troubleshooting

Missing acados dependencies: If the launch fails during solver generation, ensure the Python package acados_template is installed and that $ACADOS_SOURCE_DIR is correctly exported in your .bashrc.

Shared library error: If you encounter ImportError: libacados.so: cannot open shared object file, ensure your $LD_LIBRARY_PATH includes $ACADOS_SOURCE_DIR/lib.

Missing message types: If you receive errors about unknown types, ensure bsk_msgs and bsk_mpc_msgs are built and your workspace is fully sourced.

References

About

A ROS 2-based MPC controller for spacecraft control using Basilisk via the Basilisk-ROS 2 Bridge.

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages

Morty Proxy This is a proxified and sanitized view of the page, visit original site.