Raspberry Pi Code - ArthurGuy/Holly GitHub Wiki

Initial Setup

sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'

sudo apt-key adv --keyserver hkp://ha.pool.sks-keyservers.net:80 --recv-key 421C365BD9FF1F717815A3895523BAEEB01FA116

sudo apt-get update
sudo apt-get upgrade

apt-get install -y
ros-kinetic-desktop
ros-kinetic-imu-filter-madgwick
ros-kinetic-robot-localization
ros-kinetic-robot-state-publisher
ros-kinetic-joint-state-publisher
ros-kinetic-rosserial-arduino
ros-kinetic-rosserial
ros-kinetic-robot-upstart
ros-kinetic-xiaoqiang-freenect-launch
ros-kinetic-freenect-launch
ros-kinetic-pointcloud-to-laserscan
ros-kinetic-map-server
ros-kinetic-move-base
ros-kinetic-amcl
ros-kinetic-range-sensor-layer
freenect
supervisor
ntpdate
chrony
htop
libqt4-dev

pip

sudo pip install adafruit-ads1x15
sudo pip install smbus2
sudo pip install pigpio

Autostart pigpio

This is needed to talk to the IMU over i2c rather than the smbus system

sudo systemctl enable pigpiod.service

Manual libraries

IMU Library

https://github.com/RPi-Distro/RTIMULib/tree/master/Linux

  • Build and install library and run calibration
  • Build and install python library

VL53L0X library

https://github.com/johnbryanmoore/VL53L0X_rasp_python

  • Code in the codebase, navigate to the right directory and make

Setup

Download Ubuntu Mate 16.04

https://ubuntu-mate.org/download/

ROS Setup process

http://wiki.ros.org/kinetic/Installation/Ubuntu

RTC

https://www.raspberrypi.org/forums/viewtopic.php?t=161133

sudo nano /boot/config.txt

Append to the bottom

dtoverlay=i2c-rtc,ds3231

sudo nano /lib/udev/hwclock-set

Comment out the following

if [ -e /run/systemd/system ] ; then
exit 0
fi
Old method, might not be needed

sudo nano /etc/modules Ensure the following are listed

i2c-bcm2708
i2c-dev

Download and install the PiFace RTC code.

https://github.com/piface/PiFace-Real-Time-Clock

Custom messages

catkin_make needs to be run to build the custom messages

Shutdown button

This library is used but with a modified pin of 26 and a shutdown timeout of 2 seconds https://github.com/scruss/shutdown_button

Motor USB Serial connection

Map the teensy to a consistent name through a udev rule

SUBSYSTEM=="tty", ATTRS{idVendor}=="16c0", ATTRS{idProduct}=="0483", SYMLINK+="rosSerial"

Startup environment

Ensure ~./bashrc contains

export ROS_IP=192.168.1.60
source /opt/ros/kinetic/setup.bash
#source ~/ros_catkin_ws/devel/setup.bash

Autostart

Supervisor is used to manage the execution of the script by the root user on startup

cp /home/holly/catkin_ws/src/Holly/holly-ros.conf /etc/supervisor/conf.d/holly-ros.conf`

sudo supervisorctl reread
sudo supervisorctl update
sudo service supervisor restart

Time NTP Server

Add the following lines to /etc/ntp.conf

Master

restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap

Slave

Comment out the pool entries and add the following

pool 192.168.1.60 iburst

RTL8812au USB WiFi Adapter

https://raspberrypi.stackexchange.com/questions/64502/install-drivers-for-rtl8812au-wireless-usb-adapter

Debug

Check nodes and connections roswtf