A flight software based on ROS2-foxy.
2024.12 : Currently working on python, cpp (with lifecycle nodes) version will be done soon.
- Ubuntu-20.04 with ROS2-foxy (or newer)
- Python3.8 (as required by ROS2)
- colcon
- gcc
- make
- cmake
Ubuntu-20.04 uses ROS2-foxy while Ubuntu-22.04 uses ROS2-humble. We take foxy as an example.
You can follow the next steps:
$ echo "deb [arch=$(dpkg --print-architecture)] https://repo.huaweicloud.com/ros2/ubuntu/ $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/ros2.list > /dev/null
$ sudo apt install curl gnupg2 -y
$ curl -s https://gitee.com/ohhuo/rosdistro/raw/master/ros.asc | sudo apt-key add -
Then you have to update your pkg list:
$ sudo apt update
After that, ROS2 is reday to be installed:
$ sudo apt install ros-foxy-desktop
$ sudo apt install python3-argcomplete
You can add ros2 to the system's command via: echo "source /opt/ros/foxy/setup.bash" >> ~/.bashrc
Easy-to-use tool, you can install it via:
sudo apt-get install python3-colcon-common-extensions
Our system demo includes 4 packages, all of them can be compiled by colcon build
(at SR-flisght-software/
):
- cycle_nodes_pkg
- maintaince_pkg
- more_interfaces
- restart_node_pkg
Includes some interfaces, needs compile.
TODO: note for add more interfaces
Include basic nodes that can reply to the switcher node.
You can use it by:
$ cd SR-flight-software
$ colcon build
$ source ./install/setup.bash
$ ros2 run cycle_nodes_pkg switcher
(3 new terminals)
$ ros2 run cycle_nodes_pkg payload01
$ ros2 run cycle_nodes_pkg payload02
$ ros2 run cycle_nodes_pkg payload03
Include demo for cycle verify and restart node.
You can use it by:
$ cd SR-flight-software
$ colcon build
$ source ./install/setup.bash
$ ros2 run restart_node_pkg switcher
(3 new terminals)
$ ros2 run restart_node_pkg payload01
$ ros2 run restart_node_pkg payload02
$ ros2 run restart_node_pkg payload03
Now it's ready for you to interrupt some of them:
$ ros2 topic pub /destroy std_msgs/msg/Int32 'data: 1'
Include demo for how to do maintaince for a certain node.
You can use it by:
$ cd SR-flight-software
$ colcon build
$ source ./install/setup.bash
$ ros2 run maintaince_pkg switcher
(4 new terminals)
$ ros2 run maintaince_pkg payload01
$ ros2 run maintaince_pkg payload02
$ ros2 run maintaince_pkg payload03old
$ ros2 run maintaince_pkg maintainer
Then you can start to switch payload03old
to a new one:
$ ros2 topic pub /command_break std_msgs/msg/Int32 'data: 999'