Overview
The Raspberry Pi serves as the onboard computer running ROS2 for autonomous navigation. It handles high-level tasks like SLAM, path planning, and sensor processing, while the ESP32 handles low-level motor control.Raspberry Pi: RPi 4 (4GB+) or RPi 5 recommended
OS: Ubuntu Server 24.04 (no desktop GUI needed)
ROS2: Jazzy Jalisco (ROS-Base, not Desktop)
Why Raspberry Pi?
Onboard Computing
Runs ROS2 navigation stack on the robot itself, enabling autonomous operation without tethered connection to laptop.
Sensor Integration
Connects to LiDAR (USB), Camera (CSI), and ESP32 (serial/USB), processing all sensor data locally.
WiFi Communication
Wireless connection to development computer for monitoring, debugging, and high-level commands.
Power Efficient
Lower power consumption (~2-3A @ 5V) compared to laptop, suitable for battery-powered robot.
Hardware Requirements
| Component | Specification | Notes |
|---|---|---|
| Raspberry Pi | RPi 4 (4GB+) or RPi 5 | 8GB RAM recommended for Nav2 |
| microSD Card | 32GB+ Class 10/UHS-I | 64GB recommended |
| Power Supply | 5V 3A USB-C | Official RPi power supply recommended |
| Cooling | Heatsink + fan (optional) | Recommended for continuous operation |
- Case with fan
- External SSD for better performance (via USB 3.0)
Prepare SD Card
Step 1: Download Raspberry Pi Imager
- Website: https://www.raspberrypi.com/software/
- Available for Windows, Mac, Linux
- Install and launch
Step 2: Choose OS
- Click “Choose OS”
- Navigate: Other general-purpose OS → Ubuntu → Ubuntu Server 24.04.2 LTS (64-bit)
- Important: Select Server, not Desktop (no GUI needed)
Step 3: Choose Storage
- Click “Choose Storage”
- Select your microSD card
- Verify correct drive selected (all data will be erased!)
Step 4: Configure Settings
Click gear icon (⚙️) or “Edit Settings”: General Tab:- Hostname:
alpha-pi.local(or beta-pi, gamma-pi, etc.) - Username:
alpha-pi(match hostname for simplicity) - Password: Choose secure password (e.g.,
robotics2024) - Configure WiFi:
- SSID: Your WiFi network name
- Password: Your WiFi password
- WiFi country: Your country code
- Enable SSH: ✓ Use password authentication
Step 5: Write Image
- Click “Write”
- Confirm (all data on SD card will be erased)
- Wait for write + verify (~10-15 minutes)
- Remove SD card when complete
First Boot and SSH Connection
1
Insert SD Card and Power On
- Insert microSD card into Raspberry Pi
- Connect power (5V USB-C)
- Wait 2-3 minutes for first boot
- RPi will connect to WiFi automatically
2
Find IP Address
Method 1: Hostname (easiest)Method 2: Router admin panel
- Log into your router
- Look for device named “alpha-pi”
3
SSH into Raspberry Pi
From your development computer:
- Type “yes” to accept fingerprint
- Enter password
- You should see Ubuntu prompt:
alpha-pi@alpha-pi:~$
4
Update System
Important: First boot takes time for background updates. Wait 5-10 minutes, then:This may take 15-30 minutes. Be patient!Note: RPi may reboot itself during updates. If disconnected, wait 2 min and reconnect via SSH.
Install ROS2 Jazzy on Raspberry Pi
Once SSH connected and system updated:1
Set Locale
2
Enable Required Repositories
3
Update Package Cache
4
Install ROS2 ROS-Base
Important: Install ROS-Base (not Desktop - no GUI on RPi):ROS-Base includes:
- Core ROS2 libraries
- Command-line tools
- No GUI tools (RViz, Gazebo)
5
Install Development Tools
6
Install Demo Packages
For testing:
7
Source ROS2 Setup
Add to Verify:Should show
.bashrc:ROS_DISTRO=jazzyInstall Additional Packages
Essential for Robot
LiDAR Support
Camera Support (if using)
Test ROS2 Installation
Test 1: Talker Node
In SSH terminal on RPi:Test 2: Node List
/talker
Test 3: Topic List
/chatter, /parameter_events, /rosout
Configure Network for Multi-Machine
To communicate between PC and RPi:On Raspberry Pi
Check IP address:192.168.1.50)
Test Communication
On PC: Run listenerROS2 Discovery: By default, ROS2 nodes on same network auto-discover each other. No configuration needed for simple setups!
Performance Optimization
Reduce Swap Usage
Enable Fan Control (RPi 5)
If using active cooling:Disable Unnecessary Services
Remote Development Tips
VSCode Remote SSH
- Install “Remote - SSH” extension in VSCode
- Connect to RPi:
F1→ “Remote-SSH: Connect to Host” - Enter:
alpha-pi@alpha-pi.local - Edit code directly on RPi!
File Transfer
From PC to RPi:Troubleshooting
Cannot SSH to Raspberry Pi
Cannot SSH to Raspberry Pi
Solutions:
- Wait 5 minutes after first boot
- Check WiFi credentials in imager settings
- Verify RPi and PC on same network
- Try IP address instead of hostname
- Connect monitor + keyboard to RPi for direct access
apt update fails
apt update fails
Cause: Background auto-update runningSolution:
Wait 10-15 minutes after first boot, then retry
ROS2 installation very slow
ROS2 installation very slow
Expected: RPi is slower than PCTips:
- Be patient (10-20 min for ROS2 install)
- Use wired Ethernet if possible
- Good microSD card improves speed
PC and RPi can't see each other's nodes
PC and RPi can't see each other's nodes
Solutions:
- Ensure both on same WiFi network
- Check firewall settings
- Verify ROS_DOMAIN_ID matches (default: 0)
- Try:
ros2 daemon stop && ros2 daemon start
Raspberry Pi runs hot / throttles
Raspberry Pi runs hot / throttles
Solutions:
- Add heatsink
- Enable fan
- Ensure good airflow
- Check:
vcgencmd get_throttled(0x0 = good)
Power Considerations
Raspberry Pi Power:- RPi 4: ~2.5A @ 5V (12.5W)
- RPi 5: ~3A @ 5V (15W)
- Motors: 12V rail
- RPi + ESP32 + sensors: 5V rail (buck converter from 12V)
- Total 5V load: ~4-5A peak
Backup SD Card
Once configured, create backup image: Linux/Mac:Next Steps
ROS2 Basics
Learn ROS2 fundamental concepts
Communication Testing
Test PC ↔ RPi communication thoroughly
Robot Description
Create URDF model of your robot
Hardware Integration
Connect RPi to robot hardware