Skip to content

Connect Create® 3 to Raspberry Pi® 4 and set up ROS 2 Galactic

Before you start

Attention

These directions are written for someone with experience with embedded Linux and basic embedded computers.

It is highly recommended to read through the following documents before beginning:

Step-by-step

  1. Download Ubuntu® Server 20.04 64-bit1 and write onto a microSD card.
  2. In the system-boot partition, edit usercfg.txt and add dtoverlay=dwc2,dr_mode=peripheral. For convenience, here's a copy of this file.
  3. In the system-boot partition, edit cmdline.txt to add modules-load=dwc2,g_ether after rootwait. For convenience, here's a copy of this file.
  4. In the system-boot partition, edit network-config to optionally add information about your Wi-Fi connection, and also add the following under ethernets

            usb0:
                dhcp4: false
                optional: true
                addresses: [192.168.186.3/24]
    

    For convenience, here's a copy of this file. Be sure to remove the .txt extension. Note that the robot uses the default IP address of 192.168.186.2 on its usb0 interface. Please note also that after initial boot, editing network-config in the boot partition will not do anything; instead, the file to edit can be found at /etc/netplan/50-cloud-init.yaml.

  5. If you would like your Raspberry Pi® 43 to communicate with the Create® 3 over its USB-C®2 port (and not just to power it), be sure that the USB/BLE toggle on the robot's adapter board is set to the USB position.

  6. Insert the microSD card into the Raspberry Pi® 43, and then use a USB-C®2 to USB-C®2 cable to connect the Raspberry Pi® 43 to the Create® 3. A photo of this connection can be found here. The first boot may take a few minutes. (It may help to have a monitor and keyboard set up in case of any trouble on the first boot.)

  7. Log in with the default username and password (ubuntu/ubuntu), change your password, and then change your locale to be one that uses UTF-8. For example, in the US, type

    sudo apt update
    sudo apt install locales
    sudo locale-gen en_US en_US.UTF-8
    sudo update-locale LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8
    export LANG=en_US.UTF-8
    
  8. Recommended: follow the procedure to Setup NTP on this compute board so the Create 3 can sync its clock.

  9. Optional: Run timedatectl and see if System clock synchronized: says yes. If not, you may want setup NTP on your raspi so the clock stays accurate. To do so, specify some NTP servers for time syncronization. Edit /etc/systemd/timesyncd.conf (sudo nano /etc/systemd/timesyncd.conf) to have the below contents, then run systemctl restart systemd-timesyncd.service to load the new NTP server configuration.

    [Time]
    NTP=ntp.ubuntu.com
    FallbackNTP=0.us.pool.ntp.org 1.us.pool.ntp.org
    
  10. Then, execute the following blocks of commands to install ROS 24:

    sudo apt update && sudo apt install -y curl gnupg2 lsb-release build-essential git cmake
    

    then

    sudo curl -ksSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.key  -o /usr/share/keyrings/ros-archive-keyring.gpg
    echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/ros-archive-keyring.gpg] http://packages.ros.org/ros2/ubuntu $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/ros2.list > /dev/null
    sudo apt update && sudo apt install -y ros-galactic-ros-base python3-colcon-common-extensions python3-rosdep ros-galactic-rmw-fastrtps-cpp ros-galactic-rmw-cyclonedds-cpp ros-galactic-irobot-create-msgs
    

    finally

    echo "source /usr/share/colcon_cd/function/colcon_cd.sh" >> ~/.bashrc
    echo "export _colcon_cd_root=/opt/ros/galactic/" >> ~/.bashrc
    echo "source /usr/share/colcon_argcomplete/hook/colcon-argcomplete.bash" >> ~/.bashrc
    echo "source /opt/ros/galactic/setup.bash" >> ~/.bashrc
    
  11. At this point, we recommend setting your default RMW. The RMW you set here has to match the RMW on your robot, which can be found from its Application Configuration page. More detail on RMW can be found here. Right now, the Create® 3 robot supports rmw_cyclonedds_cpp and rmw_fastrtps_cpp. The default for Galactic is rmw_cyclonedds_cpp. Depending on your robot's RMW implementation, type one of the following:

    echo "export RMW_IMPLEMENTATION=rmw_cyclonedds_cpp" >> ~/.bashrc
    

    or

    echo "export RMW_IMPLEMENTATION=rmw_fastrtps_cpp" >> ~/.bashrc
    
  12. Log out and log back in. Once you do, test things out with a ros2 topic list. A full Create® 3 API description can be found here.

    Attention

    If you are using CycloneDDS (Galactic default), your Raspberry Pi® may be running with multiple network interfaces (usb0 to talk to robot and wlan0 to talk to laptop). You will need to export a path on the Raspberry Pi® to an xml config file that registers those interfaces in the CYCLONEDDS_URI. See CycloneDDS Multiple Network Interfaces.


  1. Ubuntu is a registered trademark of Canonical Ltd. 

  2. USB-C® is a trademark of USB Implementers Forum. 

  3. Raspberry Pi® is a trademark of Raspberry Pi Trading. All other trademarks mentioned are the property of their respective owners. 

  4. ROS 2 is governed by Open Robotics