The Robots
Our current trend is to promote one repository per robot design. This enables robot developers to be the administrators of their own projects, while maintaining cleaner branches on main repositories. The repository that aims to act as a centralized hub that points to all the rest is robotDevastation-robots. Another relevant repository which will be mentioned in this chapter is yarp-devices, which contains software we often reuse.
Raspi-based robots
Many of our robots are based on Raspi, essentially because we need to move camera and motors via IP. In general, we use: OS (Raspbian Stretch Lite), camera via YARP opencv_grabber
device to publish images via MJPEG protocol (or default YARP protocol as a fallback), and motors via our custom YARP devices at yarp-devices.
Prepare Raspi Peripherals
- Screen (HDMI)
- Keyboard (USB type A)
- Mouse (USB type A)
- Power supply (USB type micro-B)
- Network (ethernet or wifi)
Install Raspbian Stretch Lite on Raspi
- Download Raspbian Stretch Lite image from https://www.raspberrypi.org/downloads/raspbian/
- Unzip and use plain
dd
as a copying mechanism to SD card as explained here:dd bs=4M if=2019-04-08-raspbian-stretch-lite.img of=/dev/sdX # rename as required, e.g. /dev/mmcblk0
- Boot Raspi from SD card
- See your OS version via:
cat /etc/debian_version cat /etc/os-release
- Mandatory on Raspi 3B+:
sudo raspi-config
>4 Localisation Options
>I4 Change Wi-fi Country
> Set and accept rebooting - For keyboard layout, use
sudo raspi-config
1 (you do not needsudo apt install console-data; sudo loadkeys --verbose es
- To connect to a wireless network, some alternatives:
- Via
sudo raspi-config
(you do not need/etc/network/interfaces
, as explained here) - On the router side: assignment of IP based on MAC address
- Temporal via
sudo iwconfig wlan0 essid ASROB
, appendkey password
to command if required
- Via
- To see pinout you can
sudo apt install python3-gpiozero
and then usepinout
as explained here - Activate
ssh
as indicated in https://www.raspberrypi.org/documentation/remote-access/ssh/
Install YARP on Raspbian Stretch Lite on Raspi
sudo apt update
sudo apt install git cmake
sudo apt install libjpeg8-dev # Only required for mjpeg that should improve video comms
# opencv in fact replaces by libjpeg62-dev
sudo apt install --no-install-recommends libopencv-dev # Only required for opencv_grabber
git clone https://github.com/robotology/yarp
mkdir yarp/build && cd yarp/build
cmake .. -DSKIP_ACE=ON
cmake .. -DENABLE_yarpcar_mjpeg=ON
cmake .. -DENABLE_yarpmod_opencv_grabber=ON
make -j$(nproc) # Compile
sudo make install
Install yarp-devices on Raspbian Stretch Lite on Raspi
Documentation here
Configure YARP devices as services on Raspi
Both camera and motors are set as services
via daemontools
.
Install
daemontools
(more here):apt-get install daemontools daemontools-run csh
Activate
daemontools
in/etc/rc.local
through the line (before exit):/bin/csh -cf '/usr/bin/svscanboot &'
Create the folder for services if it does not exist:
sudo mkdir -p /etc/service
Install the required
daemontools
services and.ini
files used by them:git clone https://github.com/asrob-uc3m/robotDevastation-robots mkdir robotDevastation-robots/build && cd robotDevastation-robots/build cmake .. make -j$(nproc) # Compile sudo make install
Review your camera
.ini
files: Camera YARP device should be fine withopencv_grabber
, therobotDevastation-robots/share/launch/launchCamera.ini
should be installed at/usr/local/share/robotDevastation-robots/contexts/launch/launchCamera.ini
.Review your robot motor
.ini
files: therobotDevastation-robots/share/launch/launchRobot.ini
should be installed at/usr/local/share/robotDevastation-robots/contexts/launch/launchRobot.ini
. At least two possibilities here:- Direct PWM to servo, such as RD1 and RD2: RaspiOnePwmMotorController device (permalink)
- H-Bridge, such as RD Ambassador: RaspiTwoPwmMotorController device (permalink)
Finally, remember to reboot for changes in
/etc/rc.local
to take effect.
Arduino-based robots
Such is the case of Laser Tower Of Death. Relevant software:
- Camera on PC side: via
opencv_grabber
- Motors on PC side: yarp-devices/LaserTowerOfDeathController
- Motors on Arduino side: arduinoServer