Software Installation for Sim¶
The first step to get started with ROSflight will be to set up and install the necessary dependencies and software. This guide will detail how to install these packages as if preparing to run a simulation. This means we will cover setting up the following packages on either the companion computer or any other Linux computer:
- ROS2
- ROSflight Sim (and other software from
rosflight_ros_pkgs) - ROScopter
- ROSplane
We will not cover flashing firmware or other hardware-specific instructions. For instructions on setting up the software on real hardware, see the hardware installation guide.
Note
You probably don't need both ROSplane and ROScopter. If that is the case, just install the one that makes sense for your application.
Installing ROS2¶
Unsuprisingly, ROS2 is a required dependency for ROSflight. You can do this with a native installation of ROS2 or by following the ROSflight Docker guide. To install ROS2 natively, check out the official ROS2 Installation page for details.
If you don't plan to run simulations or GUI applications on your companion computer, ros-<ros-distro>-ros-base can be used instead of ros-<ros-distro>-desktop.
Note
ROSflight currently officially supports only LTS versions of ROS2, so ROS2 Humble running on Ubuntu 22.04 or ROS2 Jazzy running on Ubuntu 24.04. If you want to run a different version of ROS2, some of the below instructions may not work. ROS2 Rolling is not fixed-release and is therefore not officially supported.
Installing ROSflight, ROScopter, and ROSplane¶
In this section, when we refer to ROSflight we are referring to the rosflight_ros_pkgs repository, which includes the rosflight_sim, rosflight_io, and rosflight_firmware modules.
In the hardware installation guide, each of these packages will be installed separately, or not at all.
-
Create your ROSflight workspace:
mkdir -p ~/rosflight_ws/src -
Clone the
rosflight_ros_pkgsrepository, as well asroscopterandrosplane:cd ~/rosflight_ws/src git clone https://github.com/rosflight/rosflight_ros_pkgs --recursive git clone https://github.com/rosflight/roscopter git clone https://github.com/rosflight/rosplaneFile structure
Your ROSflight workspace file structure should now look like
rosflight_ws/ └── src/ ├── roscopter/ ├── rosflight_ros_pkgs/ └── rosplane/ -
Install dependencies using
rosdep:Warning
Make sure you have properly sourced the ROS2 environment in the terminal you are working in, or the
rosdepandcolconcommands will fail.# Replace <ros-distro> with your ROS2 distro (probably 'humble' or 'jazzy') source /opt/ros/<ros-distro>/setup.bashcd ~/rosflight_ws sudo rosdep init rosdep update rosdep install --from-path . -y --ignore-srcIf you have already done
sudo rosdep initpreviously, it will return an error. In most cases, you do not need to reinitialize. -
Build using the colcon build tool:
cd ~/rosflight_ws colcon buildAfter the build, you should see output similar to:
There may be warnings or--- Finished <<< roscopter [1min 34s] Finished <<< rosflight_sim [1min 35s] Starting >>> rosflight_pkgs Finished <<< rosflight_pkgs [0.42s] Summary: 18 packages finished [1min 44s] 4 packages had stderr output: roscopter rosflight_io rosplane rosplane_extrastderroutput, but as long as each package saysFinished, the build was successful.Resource Usage
Building the whole repository at once uses a lot of memory. If you get build errors, try running the build command with the following argument:
colcon build --executor sequentialSuccess
The
colconbuild tool will createbuild,log, andinstallfolders, even if the build fails. Your ROSflight workspace file structure should now look likerosflight_ws/ ├── build/ ├── install/ ├── log/ └── src/ ├── roscopter/ ├── rosflight_ros_pkgs/ └── rosplane/ -
Add the source files to your
.bashrc(so you don't have to source the files every time you open a terminal):If you are using a different ROS 2 distribution, replace# add the sourcing commands to your .bashrc. Replace bash with zsh if using zsh. echo "source /opt/ros/humble/setup.bash" >> $HOME/.bashrc echo "source $HOME/rosflight_ws/install/setup.bash" >> $HOME/.bashrc source $HOME/.bashrchumblewith your distro name.Make sure to reopen current terminals after adding these commands to your
.bashrcfile (or runsource $HOME/.bashrcfile in every open terminal).
Next Steps¶
At this point, you have successfully installed ROS2 and set up the ROSflight simulation environment, including all required dependencies. Your workspace is built and ready to run simulations with ROSflight, ROScopter, or ROSplane. The next step is to launch a simulation scenario or integrate your own simulated vehicle.