ROS Basilisk is a wrapper that provides ROS2-interface for Basilisk Astrodynamics Simulation Framework. Tested on Ubuntu 20.04 LTS, ROS2 Galactic. This package aims to support the numerical verification and validation of spacecraft GNC and higher level authonomy software implemented with ROS2.
The main functionality of ROS Basilisk is to run (1) Basilisk simulation side by side with other ROS nodes and (2) provide examples for how Basilisk messages can be translated to ROS messages and vice versa.
We provide the docker container with ROS2 and Basilisk pre-installed. Please see the docker instruction here.
In this instruction, we assume Basilisk is installed at /home/UserName/basilisk (home directory) and ROS2 workspace is created at /home/UserName/basilisk_ws. The choice of installation location for Basilisk and other software is up to the user but paths should be changed appropriately.
The repo also provides basic attitude control and formation keeping algorithms implemented in ROS2 for the demonstration purpose.
- Install ROS2 Galactic
- Install Basilisk. We assme Basilisk is installed in home directory
/home/UserName/. Some tips regarding Basilisk installation:- Make sure you are in a venv!
- Install using this command:
python3 conanfile.py --clean --opNav True --vizInterface True --buildProject True - For debug mode:
python3 conanfile.py --clean --buildType Debug --opNav True --vizInterface True --buildProject True.- Debug mode allows for more descriptive error messages in
gdbor other C debuggers. Can also debug in Release. Could use CLion too, use these instructions to debug in CLion: https://www.jetbrains.com/help/clion/debugging-python-extensions.html#attach-py
- Debug mode allows for more descriptive error messages in
- If the workspace does not already exists, create one
mkdir -p basilisk_ws/src - Clone this repo into workspace
cd basilisk_ws/src && git clone https://github.com/aerorobotics/ros2basilisk - Install Python pre-requisites within the virtual environment
source ~/basilisk/.venv/bin/activate && pip3 install -r ros2basilisk/requirements.txt
- Build workspace at the top of workspace directory
cd ~/basilisk_ws && colcon build - Source the envrionment
source ~/basilisk/.venv/bin/activate && source ~/basilisk_ws/install/setup.bash - Add python paths. Launch needs the Basilisk python location:
export PYTHONPATH=$PYTHONPATH:/home/$(id -un)/basilisk/.venv/lib/python3.8/site-packages && export PYTHONPATH=$PYTHONPATH:/home/$(id -un)/basilisk/dist3 - Launch ROS2Basilisk:
ros2 launch ros2basilisk demo_launch.py ws:="/home/UserName/basilisk_ws/"This creates output data in data/runs/default_run - Visualize the simulation result:
python src/ros2basilisk/script/data_analysis.py
This is same as creating a ROS2 message.
- Create a file in the
msgfolder. Call itYOUR_MESSAGE_NAME.msg, then fill it out. - Add
"msg/YOUR_MESSAGE_NAME.msg"intoCMakeLists.txt, add it into the function where it starts withrosidl_generate_interfaces(${PROJECT_NAME}where all the other messages are.
- Modify RosBasilisk.py, RosBskTask.py, and Simulation.py to modify Basilisk simulation scenario.
If you use this repository, please make sure to cite our work.
@inproceedings{matsuka2023high,
title={High-Fidelity, Closed-Loop Simulation of Spacecraft Vision-Based Relative Navigation in ROS2},
author={Matsuka, Kai and Zhang, Leo and Ragheb, Isabelle and Ohenzuwa, Christine and Chung, Soon-Jo},
year={2023},
publisher={AIAA},
booktitle={2023 33rd AAS/AIAA Space Flight Mechanics Meeting}
}
This work was presented at 33rd AAS/AII Space Flight Mechanics Meeting in a paper titled "High-fidelity, closed-loop simulation of spacecraft vision-based relative navigation in ROS2." Our paper can be found here.