The Robots

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 need sudo apt install console-data; sudo loadkeys --verbose es
  • To connect to a wireless network, some alternatives:
    1. Via sudo raspi-config (you do not need /etc/network/interfaces, as explained here)
    2. On the router side: assignment of IP based on MAC address
    3. Temporal via sudo iwconfig wlan0 essid ASROB, append key password to command if required
  • To see pinout you can sudo apt install python3-gpiozero and then use pinout 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.

  1. Install daemontools (more here):

    apt-get install daemontools daemontools-run csh
    
  2. Activate daemontools in /etc/rc.local through the line (before exit):

    /bin/csh -cf '/usr/bin/svscanboot &'
    
  3. Create the folder for services if it does not exist:

    sudo mkdir -p /etc/service
    
  4. 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
    
  5. Review your camera .ini files: Camera YARP device should be fine with opencv_grabber, the robotDevastation-robots/share/launch/launchCamera.ini should be installed at /usr/local/share/robotDevastation-robots/contexts/launch/launchCamera.ini.

  6. Review your robot motor .ini files: the robotDevastation-robots/share/launch/launchRobot.ini should be installed at /usr/local/share/robotDevastation-robots/contexts/launch/launchRobot.ini. At least two possibilities here:

    1. Direct PWM to servo, such as RD1 and RD2: RaspiOnePwmMotorController device (permalink)
    2. H-Bridge, such as RD Ambassador: RaspiTwoPwmMotorController device (permalink)
  7. 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:

results matching ""

    No results matching ""