Skip to content

Software Installation for Hardware

This guide is meant for users preparing to conduct hardware flight experiments, not just simulation. For the simulation guide, see Software Installation for Sim. Note that these two installation guides have minor differences.

The first step to get started with ROSflight will be to set up and install the necessary dependencies and software. On hardware, we need to set up two devices: the companion computer and the flight controller. For more information on the difference between these two devices, see the overview page.

Starting in sim

If you haven't done so yet, we recommend setting up the simulation environment first before getting started with hardware. The simulation environment makes it easier to get familiar with the ROSflight ecosystem without needing to debug any potential hardware issues.

Overview

We will need to install these packages on the companion computer:

  • ROS2
  • ROSflightIO
  • ROScopter
  • ROSplane

We will install just the firmware on the flight controller.

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-humble-ros-base can be used instead of ros-humble-desktop.

Note

ROSflight currently officially supports only ROS2 Humble, running on Ubuntu 22.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.

Companion Computer Setup

Do the following on your companion computer.

  1. Create your ROSflight workspace:

    mkdir -p /path/to/rosflight_ws/src
    
  2. Clone the rosflight_ros_pkgs repository, as well as roscopter and rosplane:

    cd /path/to/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/rosplane
    

    File structure

    Your ROSflight workspace file structure should now look like

    rosflight_ws/
      └── src/
          ├── roscopter/
          ├── rosflight_ros_pkgs/
          └── rosplane/
    
  3. Install dependencies using rosdep:

    Warning

    Make sure you have properly sourced the ROS2 environment in the terminal you are working in, or the rosdep and colcon commands will fail.

    source /opt/ros/humble/setup.bash
    

    Tip

    If you are not planning on using the simulation environment on your companion computer, you can delete the rosflight_sim package safely. This will speed up build times.

    cd /path/to/rosflight_ws/src/rosflight_ros_pkgs
    rm -rf rosflight_sim
    
    cd /path/to/rosflight_ws
    sudo rosdep init
    rosdep update
    rosdep install --from-path . -y --ignore-src
    
  4. Build using the colcon build tool:

    cd /path/to/rosflight_ws
    colcon build
    

    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 sequential
    

    Success

    Your ROSflight workspace file structure should now look like

    rosflight_ws/
      ├── build/
      ├── install/
      ├── log/
      └── src/
          ├── roscopter/
          ├── rosflight_ros_pkgs/
          └── rosplane/
    

Flight controller setup

ROS2 will not be installed on the flight controller. We will only need to build and flash the flight controller with the rosflight_firmware.

See the flight controller guide for instructions on how to do this.

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.