Raspberry Pi Setup
This guide will outline the steps taken to setup the baseline software on the Raspberry Pi 4.
Info
This project recommends using a Raspberry Pi with at least 4GB of RAM. Compiler issues have been encounter with the 2GB variant.
Setup OS Installation
- Install Raspberry PI Imager https://www.raspberrypi.com/software/
 - Select gear for advance option to specify a hostname, username, password, and network configurations ^rpi-os-config
 - Flash Raspberry PI OS 64-bit to Micro SD Card   
- Alternatively setup NVMe boot with NVMe hat
 
 
Setup SSH
- Test ssh access 
ssh <user>@<rpi-local-ip>Use the password you configured in the step - Reserve a static local IP address for within the router's configuration
 - Reboot the pi  
On host machine:ssh -t <user>@<rpi-local-ip> "reboot"
Or, within the pi ssh terminalreboot - Test ssh access with machine name 
ssh <user>@<hostname> - Create SHH Key Pair 
On host machine:ssh-keygen -f ~/.ssh/<key-name> - Copy SHH pubic key to the raspberry pi 
On host machine:ssh-copy-id -i ~/.ssh/<key-name> <user>r@<rpi-machine-name> - Add ssh config to host machine ^rpi4-ssh-config   
- On host machine: 
xdg-open ~/.ssh/config - Copy-paste the following, this project is using 
rpi4as the config-name 
 - On host machine: 
 
Host <config-name>
    HostName <local-reserved-static-ip>
    User bot
    IdentityFile ~/.ssh/<key-name>.pub
    ForwardAgent yes 
    ForwardX11 yes
    ServerAliveInterval 120
- Test ssh 
ssh <config-name> 
Setup VS Code and ROS2 Workspace Repository
- Open a ssh terminal on the Raspberry Pi 4
 - Install Visual Studio Code on the pi
 
sudo apt update
sudo apt install code
- Clone the ros2 workspace repo into the Raspberry Pi's home directory for the current user
 
cd
git clone https://github.com/digitalhabitat/bot_ros2_workspace
Install Docker
- Open a ssh terminal on the Raspberry Pi 4
 - Install docker will the following commands
 
sudo apt-get update && sudo apt-get upgrade
curl -fsSL https://get.docker.com -o get-docker.sh
 sudo sh get-docker.sh
- more Info about script
 - These next steps maybe necessary for docker to work it VS Code remote development click here for more info
 
sudo groupadd docker
sudo usermod -aG docker $USER
exit
Setup VS Code Remote Development
- Install VS Code on your host machine
 - Open VS Code on host machine
 - Install the remote Remote Development extension pack more info about remote development here
 - Connect to the 
rpi4via VS Code on your host machine - Open ros2 workspace folder   
- With VS Code, Select File, Open Folder, 
/home/bot/bot_ros2_workspace/then click okay 
 - With VS Code, Select File, Open Folder, 
 - Make sure the repo is currently on the 
humble-rpi4branch- Check that the bottom left hand corner reads 
humble-rpi4 - if not, on VS Code press Ctrl + Shift + P and enter "Checkout to... "
 - Select "origin/humble-rpi4"
 
 - Check that the bottom left hand corner reads 
 - Open Docker the Humble ROS2 container   
- on VS Code press Ctrl + Shift + P and enter "Rebuild and Reopen in Container"
 - Check out the readme for the workspace to get started. Click hereto read a blog about this ROS2 workspace template
 
 
Setup GitHub ssh keys
- Create private-public key pair and add public key to github
 
ssh-keygen -t ed25519 -C "<youremail>" -f ~/.ssh/<key_file>
- Test credentials
 
ssh -T -i ~/.ssh/<private-key> git@github.com
- Configure global settings
 
git config --global user.email "youremail@yourdomain.com"
git config --global user.name "Your Name"