The Robots (robotDevastation-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
For keyboard layout, some alternatives:
sudo raspi-config
(ref) >4 Localisation Options
>I3 Change Keyboard Layout
sudo apt install console-data
and thensudo loadkeys --verbose es
There are several methods to see your OS/distribution version (ref). Not all the files mentioned here may exist on a specific distribution, so
cat
may fail sometimes:lsb_release -a
lsb_release -d
cat /etc/issue
cat /etc/os-release
cat /etc/debian_version
cat /etc/lsb-release
hostnamectl
Mandatory on Raspi 3B+:
sudo raspi-config
>4 Localisation Options
>I4 Change Wi-fi Country
> Set and accept rebootingTo 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
To see pinout you can
sudo apt install python3-gpiozero
and then usepinout
as explained hereEnable
ssh
(https://www.raspberrypi.org/documentation/remote-access/ssh/):sudo raspi-config
>5 Interfacing Options
>P2 SSH
>Yes
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
Last updated