- Connect a Teensy to the main computer using a micro-USB cable.
- Open Arduino IDE (by either entering 'arduino' on a terminal or clicking 'Show Applications' icon on the bottom left corner of the screen)
- Open 'defaultOperation.ino' located in '~/git/gritsbotx/firmware/teensyCode' directory.
- Click the upload icon (right arrow icon).
This section details how to make the base image. Relatively few changes are made to keep the image small. Once the changes in this section have been made, copy the new image to an SD card and use that as the base image.
- Install and run the Raspberry Pi Imager (https://www.raspberrypi.com/software/).
- For 'Operating System,' select 'Raspberry Pi OS (other)' and select 'Raspberry Pi OS Lite (32-bit).'
- For 'Storage,' choose the SD card to be used.
- Before clicking the 'WRITE' button, click on the gear icon below the 'WRTIE' button to open the 'Advanced options.'
- Check 'Enable SSH' and 'Use password authentication.'
- Then, check 'Set username and password' and type 'pi' for the 'Username' and 'raspberry' for 'Password.'
- Next, check 'Configure wireless LAN' and enter 'SSID' and 'Password' of the router.
- Change 'Wireless LAN country' to 'US.' Click 'SAVE' and click 'WRITE' button to start loading the image to the SD card.
Assign an unallocated robot index for the MAC address of the Raspberry Pi. Then, on the main computer,
- Add/Replace the MAC address of the Raspberry Pi in '~/git/gritsbot_2/config/mac_list.json'
- Add/Replace the robot ID in '~/git/vicon_tracker_python/config/node_desc_tracker.json'
- Add/Replace the robot ID in '~/git/robotarium_matlab_backend/config/node_desc_api.json'
- Build the firmware Docker image by running
cd ~/git/gritsbot_2/docker/
./docker_build.sh 192.168.1.5 1884
- When making making multiple robots, register the MAC address of all new robots in the files listed above before building the firmware image. Otherwise, the firmware needs to be built as many as the number of new robots.
- When assigning an index to a new robot, assign the number engraved on the Vicon hat plate. Make sure not to use any numbers that are assigned to existing robots.
- Eject the card from the computer and insert it onto a Raspberry Pi and power it up. It should automatically connect to the wifi. The Pi needs some time to boot for the first time. The boot up process can be visually inspected by plugging the Raspberry Pi to a monitor through a mini HDMI cable. When the Pi completes the booting process it will prompt a login. If the Pi shows a blue screen prompting to enter a new username, something is wrong with uploading the image to Pi, and the Raspbian OS needs to be reinstalled. Before loading another image to the SD card, make sure to re-type the passwords for the Pi and the Wifi. The Raspberry Pi Imager seems to be ruining the passwords saved in the advanced setting when the program is restarted.
- Navigate to the router settings page by navigating to '192.168.1.1' using a web browser (admin credential for the router is currently saved in Firefox). The new Pi will appear as 'RASPBERRYPI.'
- Click on it to look up its IP address and MAC address.
- After looking up the IP address of the new Pi, ssh to it by
ssh pi@<IP-address-of-Pi>
When promted to enter password, type 'raspberry'
- Open /boot/config.txt file by
sudo nano /boot/config.txt
- Add to /boot/config.txt the text
# Disable bluetooth
dtoverlay=pi3-disable-bt
This section assumes that you have built a base image as previously detailed.
-
Copy '.git-credentials' in '~/git/gritsbot_2/docker' directory and 'setup' in '~/git/gritsbot_2/setup' directory to 'rootfs/home/pi' directory of the SD card.
-
Connect the Pi and Teensy with a USB cable. If the Pi is not connected with a programmed Teensy as instructed in Step 1, the firmware will not successfully be started by the setup script in the next step.
-
On the Pi, run the setup script with
./setup
This can be done either by directly on the Pi by connecting a mini HDMI cable and a keyboard to the Pi or SSHing to the Pi as instructed in Step 2.3.
This process changes the name of the Raspberry Pi on the network. This helps to identify each robot easily on the router page (192.168.1.1). See Step 2.3, if you forgot how to access the router page.
After the setup script is completed, Run
sudo raspi-config
on the Raspberry Pi, and change the Host Name to 'robot#' where # is the new robot index assigned to the Pi in Step 2.3.
Reboot the Pi to apply the new network host name by selecting 'yes' when the raspi-config asks for a restart, or by using
sudo reboot
This section details the installation process for the firmware. This process can be made automatic via the setup scripts.
Remove plymouth with
sudo apt-get purge --remove plymouth
Disable unused services with
sudo systemctl disable triggerhappy.service
sudo systemctl disable hciuart.service
sudo systemctl disable keyboard-setup.service
sudo systemctl disable dphys-swapfile.service
This section follows from the official (Docker)[https://docs.docker.com/install/linux/docker-ce/ubuntu/]. First, remove old versions of Docker.
sudo apt-get remove docker docker-engine docker.io
Next, install Docker using the convenience script.
curl -fsSL get.docker.com -o get-docker.sh && export VERSION=23.0 && sh get-docker.sh
Now tie Docker to the pi user so that we don't need sudo to use Docker.
sudo usermod -aG docker pi
Install pip for python3
sudo apt-get install python3-pip
To clone the firmware, run
sudo apt-get install git
git clone https://github.com/robotarium/gritsbot_2
Also, install the MAC discovery repository
git clone https://github.com/robotarium/mac_discovery
as well as the python serial library used to communicate to the robot.
python3 -m pip install pyserial
Turn off power management by adding the line
/sbin/iw dev wlan0 set power_save off
in the file /etc/rc.local. This line disables WiFi power management on boot.
From wherever the git repository is cloned, run
cd <path_to_gritsbot_2_repo>/docker
./docker_run.sh
./docker_watch.sh
which will permanently start a Docker container running the firmware and the watchtower container. Watchtower watches containers and automatically updates them from Dockerhub. This watchtower instance checks and updates all running containers, so this instance will also update the MAC container as well.
Start MAC discovery as well with
cd <path_to_mac_discovery_repo>/docker
./docker_run.sh