Connect Create® 3 to Raspberry Pi® 4 and set up ROS 2 Galactic
Before you start
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:
- How to install Ubuntu Server on your Raspberry Pi1 - official Canonical documentation
- Installing ROS 2 on Ubuntu Linux1 - official Open Robotics documentation
- Download Ubuntu® Server 20.04 64-bit1 and write onto a microSD card.
- In the system-boot partition, edit usercfg.txt and add
dtoverlay=dwc2,dr_mode=peripheral. For convenience, here's a copy of this file.
- In the system-boot partition, edit cmdline.txt to add
rootwait. For convenience, here's a copy of this file.
In the system-boot partition, edit network-config to optionally add information about your Wi-Fi connection, and also add the following under
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
.txtextension. 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-configin the boot partition will not do anything; instead, the file to edit can be found at
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.
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.)
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
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
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
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
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_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
echo "export RMW_IMPLEMENTATION=rmw_fastrtps_cpp" >> ~/.bashrc
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.
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.