Turtlebot3 Raspberry Pi Setup 20210126
Contents
Install Background
There were several attempts to get an install in which wireless functioned. It was discovered that the upgrade step in the "Install ROS Dashing Diademata" messed up wireless (Section 3.2.5 step 2).
Warning: Do not do an upgrade at this time. "sudo apt ugrade".
References
- Robotis Turtlebot3 eMnuall SBC Setup
- Section 3.2 SBC Setup
Prepare micoSD Card
- Section 3.2.1
- Download the ubuntu-18.04.3-preinstalled-server-arm64+raspi3.img.xz image for your SBC from the links below.
$ cd TB3Install TB3Install$ mv ~/Downloads/ubuntu-18.04.3-preinstalled-server-arm64+raspi3.img.xz . TB3Install$ unxz < ubuntu-18.04.3-preinstalled-server-arm64+raspi3.img.xz > ubuntu-18.04.3-preinstalled-server-arm64+raspi3.img
- Run the Disks application
- To find it go to the "Show Applications" icon in the bottom left corner of the desktop.
- Search for "Disks"
- In the upper right corner of the Disks app window is a "hamburger" menu (3 horizontal lines).
- Select the "Restore Disk Image" menu item
- Do what makes sense
Useful References
If for some reason the tar solutions don’t work (perhaps because you’re using the OS X built-ins), try this: unxz < file.tar.xz > file.tar which is equivalent to: xz -dc < file.tar.xz > file.tar Then use tar to untar the file.
- https://www.maketecheasier.com/backup-hard-drive-gnome-disk-utility/ Backup Hard Drive Gnome Disk Utility]
Boot Up the Raspberry Pi
- Section 3.2.2
Configure the Raspberry Pi
- Section 3.2.3
- I believe this is what I did but I couldn't capture my keystrokes
Log into the Pi
- username: ubuntu
- passwd: ubuntu which I changed
Disable Automatic update
$ sudo nano /etc/apt/apt.conf.d/20auto-upgrades
Change the update settings
APT::Periodic::Update-Package-Lists "0"; APT::Periodic::Unattended-Upgrade "0";
Configure wifi (I had trouble with the syntax and indention so it took a few tries0
$ sudo nano /etc/netplan/50-cloud-init.yaml
$ cat /etc/netplan/50-cloud-init.yaml # This file is generated from information provided by # the datasource. Changes to it will not persist across an instance. # To disable cloud-init's network configuration capabilities, write a file # /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg with the following: # network: {config: disabled} network: version: 2 ethernets: eth0: dhcp4: true match: macaddress: b8:27:eb:0b:5d:ce set-name: eth0 network: version: 2 renderer: networkd ethernets: eth0: dhcp4: yes dhcp6: yes optional: true wifis: wlan0: dhcp4: yes dhcp6: yes access-points: "xxx": password: "xxx"
Apply configuration
$ sudo netplan apply $ reboot
Prevent boot-up if no network setup
$ systemctl mask systemd-networkd-wait-online.service unit sleep.target does not exist, proceeding anyway
Disable Suspend and Hibernate
$ sudo systemctl mask sleep.target suspend.target hibernate.target hybrid-sleep.target Created symlink /etc/systemd/system/hybrid-sleep.target → /dev/null.
Enable SSH
$ sudo apt install ssh $ sudo systemctl enable --now ssh $ reboot
Ops
TBD Check this out. I did this on Sisters (Remote PC) by mistake
$ sudo systemctl mask sleep.target suspend.target hibernate.target hybrid-sleep.target [sudo] password for eepp: Created symlink /etc/systemd/system/sleep.target → /dev/null. Created symlink /etc/systemd/system/suspend.target → /dev/null. Created symlink /etc/systemd/system/hibernate.target → /dev/null. Created symlink /etc/systemd/system/hybrid-sleep.target → /dev/null.
Add Swap Space
- Section 3.2.4
$ sudo swapoff /swapfile swapoff: /swapfile: swapoff failed: No such file or directory $ sudo fallocate -l 2G /swapfile $ sudo chmod 600 /swapfile $ sudo mkswap /swapfile Setting up swapspace version 1, size = 2 GiB (2147479552 bytes) no label, UUID=95adf48c-622b-418f-95ee-0918a19da735 ubuntu@ubuntu:~$ sudo swapon /swapfile
TBD Missed doing this at swap creation. Now I can't. Does this mean the swap came on at boot???
$ sudo swapon /swapfile swapon: /swapfile: swapon failed: Device or resource busy
Append "/swapfile swap swap defaults 0 0" to the end of this file
$ sudo nano /etc/fstab $ sudo free -h total used free shared buff/cache available Mem: 912M 106M 618M 4.4M 187M 786M Swap: 2.0G 0B 2.0G $ cat /etc/fstab LABEL=writable / ext4 defaults 0 0 LABEL=system-boot /boot/firmware vfat defaults 0 1 /swapfile swap swap defaults 0 0
install ROS Dashing Diademata
- Section 3.2.5
Update and upgrade our software
$ sudo apt update ... $ sudo apt upgrade ...
Setup local
$ sudo locale-gen en_US en_US.UTF-8 Generating locales (this might take a while)... en_US.ISO-8859-1... done en_US.UTF-8... done Generation complete. $ sudo update-locale LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8 $ export LANG=en_US.UTF-8
Setup sources
$ sudo apt install curl gnupg2 lsb-release ... $ curl -s https://raw.githubusercontent.com/ros/rosdistro/master/ros.asc | sudo apt-key add - $ sudo sh -c 'echo "deb [arch=amd64,arm64] http://packages.ros.org/ros2/ubuntu `lsb_release -cs` main" > /etc/apt/sources.list.d/ros2-latest.list'
Install ROS 2 packages
$ sudo apt update ... $ sudo apt install ros-dashing-ros-base ...
Install ROS Packages
- Section 3.2.6
$ sudo apt install python3-argcomplete python3-colcon-common-extensions libboost-system-dev build-essential ... $ sudo apt install ros-dashing-turtlebot3-msgs ... $ sudo apt install ros-dashing-dynamixel-sdk ... $ mkdir -p ~/turtlebot3_ws/src && cd ~/turtlebot3_ws/srcmkdir -p ~/turtlebot3_ws/src && cd ~/turtlebot3_ws/srcmkdir -p ~/turtlebot3_ws/src && cd ~/turtlebot3_ws/srcmkdir -p ~/turtlebot3_ws/src && cd ~/turtlebot3_ws/srcmkdir -p ~/turtlebot3_ws/src && cd ^C $ mkdir -p ~/turtlebot3_ws/src && cd ~/turtlebot3_ws/src $ git clone -b dashing-devel https://github.com/ROBOTIS-GIT/turtlebot3.git ... $ cd ~/turtlebot3_ws/src/turtlebot3 $ rm -r turtlebot3_cartographer turtlebot3_navigation2 $ cd ~/turtlebot3_ws/ $ echo 'source /opt/ros/dashing/setup.bash' >> ~/.bashrc $ source ~/.bashrc
Errors: in Raspberry Pi console for the following but it compiled successfully
$ colcon build --symlink-install --parallel-workers 1 ... ... Starting >>> turtlebot3_bringup Finished <<< turtlebot3_bringup [11.0s] Starting >>> turtlebot3 Finished <<< turtlebot3 [11.2s] Summary: 6 packages finished [11min 52s]
These were 18 errors on the Pi console similar to the following. They were not in the remote PC's ssh window
mmcblk0: error -22 transffering data, sector 2080384, nr 8, cmd response 0x900, card status 0,0
and also this one
kworker/3:1 ... blocked for more than 120 seconsd Tainted: G W 4.15.0- 1077 - raspi2 #82-ubuntu
Environment Setup
- Section 3.2.7
$ echo 'export ROS_DOMAIN_ID=30 #TURTLEBOT3' >> ~/.bashrc $ source ~/.bashrc
Who are We
$ cat /proc/device-tree/model Raspberry Pi 3 Model B Plus Rev 1.3
SD Storage
I saved a backup image of the Pi SD card on the remote PC. it takes about 17% of the PC's storage
I checked how much of the Pi SD's 16GB storage is use. It looks like about 37%. See below
$ df Filesystem 1K-blocks Used Available Use% Mounted on udev 450572 0 450572 0% /dev tmpfs 93404 4512 88892 5% /run /dev/mmcblk0p2 15021764 5240780 9130784 37% / tmpfs 467000 0 467000 0% /dev/shm tmpfs 5120 0 5120 0% /run/lock tmpfs 467000 0 467000 0% /sys/fs/cgroup /dev/mmcblk0p1 258095 107443 150652 42% /boot/firmware tmpfs 93400 0 93400 0% /run/user/1000