Quick Start
Connect to the Raspberry Pi
Discover the robot’s IP address and connect via SSH.
Before you can run any ROS 2 commands on your robot, you need to connect to the Raspberry Pi over the network. The robot obtains an IP address via DHCP when powered on. The following commands help you discover that IP and open an SSH session as the rcr user.
ip addr show
ssh rcr@192.168.1.n
Configure Raspberry Pi host settings
Set the hostname and ensure hostname preservation on reboot.
To give each robot a unique identity on your network you should set the system hostname. These commands modify the cloud‑init configuration to prevent overwriting the hostname, set the hostname files, and apply the changes.
sudo nano /etc/cloud/cloud.cfg
In the editor, find the line beginning with preserve_hostname and set it to true:
preserve_hostname: true
Save and exit (Ctrl+O, Enter, Ctrl+X).
sudo nano /etc/hostname
sudo nano /etc/hosts
Replace occurrences of the old hostname with your robot’s desired name (e.g. rcr001). In /etc/hosts update the line beginning with 127.0.1.1 to reference your new hostname.
sudo hostnamectl set-hostname rcr001
sudo reboot
Configure network settings on the Raspberry Pi
Define a static IP address and Wi‑Fi credentials using Netplan.
For reliable communication between your development computer and the robot you may want to assign a static IP address and configure Wi‑Fi credentials. The Pi uses Netplan for network management. Edit the configuration and apply it, then verify connectivity.
sudo nano /etc/netplan/50-cloud-init.yaml
Adjust the file to specify your network settings. For example:
network:
version: 2
ethernets:
eth0:
dhcp4: false
addresses: [192.168.1.42/24]
gateway4: 192.168.1.1
nameservers:
addresses: [8.8.8.8,8.8.4.4]
wifis:
wlan0:
dhcp4: true
access-points:
"YourSSID":
password: "YourWiFiPassword"
Save the file and exit the editor.
sudo netplan apply
hostname -I
hostname
ping -c 3 google.com
Set ROS 2 name and namespace
Configure the robot’s ROS node namespace to avoid topic collisions.
To avoid conflicts when running multiple robots on the same network, you must assign a unique name and namespace to your robot. ROS 2 uses these to prefix all topics and nodes so that multiple robots can share the same network without collisions.
# edit your profile
sudo nano ~/.profile
# add or update this line (replace n with your robot number)
export ROS_NAME=rcr00n
# save the file, then reload your profile
source ~/.profile
sudo nano ~/env.list
# add or update this line (replace n with your robot number)
ROS_NAMESPACE=/rcr00n
If your micro‑ROS firmware initializes the node with a namespace, you must update the source code as well. Open the RosInterface.cpp file in the firmware directory and change the third argument of rclc_node_init_default to your robot’s name:
```bash {id:”namespace:edit-firmware”, test:false}
cd ~/repos/common_platform/firmware/closed_loop/
sudo nano RosInterface.cpp
In the file, find the line that looks similar to:
```cpp
rclc_node_init_default(&node, "micro_ros_arduino_node", "", &support);
Replace the empty string with your robot name (e.g. rcr00n):
rclc_node_init_default(&node, "micro_ros_arduino_node", "rcr00n", &support);
Save the file, then recompile and flash the firmware using the Teensy flashing procedure so the change takes effect.
Compile and flash the Teensy firmware
Build and upload the microcontroller firmware for closed‑loop control.
The closed‑loop motor controller firmware for the robot runs on a Teensy 4.0 microcontroller. Follow these steps to compile and upload the firmware using arduino-cli and teensy_loader_cli.
cd ~/repos/common_platform/firmware/closed_loop
rm -rf build
mkdir build
arduino-cli compile --fqbn teensy:avr:teensy40 -e -o build
SERIAL_TEENSY_DEVICE=$(ls -1 /dev/serial/by-id/ | grep -i teensy | head -n1)
echo $SERIAL_TEENSY_DEVICE
sudo stty -F /dev/serial/by-id/${SERIAL_TEENSY_DEVICE} 9600
sudo teensy_loader_cli -v -w build/*.hex