Skip to content

Install Thymio related software

mezdahun edited this page Apr 7, 2021 · 7 revisions

Aseba on Raspberry Pi 4 (with Raspbian 10 Buster)

The software package aseba is a bundle including all necessary software to control a Thymio2 robot from a chosen controller system. Unfortunately at the time of writing this page aseba's official build guide to build their latest official version on different OS fails many times, e.g. on Ubuntu 20 or on Raspbian 10 as well. Therefore we need to use the latest compiled and distributed version of Aseba on the Raspberries. To install Aseba 1.5.5 on a Pi4 with Raspbian 10/Buster follow these steps:

  1. As both building aseba locally and using a package manager to get the latest versions we need to install the 3 main deb packages manually. At the time of writing this page this is v1.5.5 and you can find the source links on this page

The following commands will make a directory and download the 3 main packages in this directory so that we can install the deb files with dpkg.

mkdir aseba_install
cd aseba_install
# getting dashel
wget http://wiki.thymio.org/local--files/en:linuxinstall/libdashel_1.3.0_armhf.deb
# getting enki
wget http://wiki.thymio.org/local--files/en:linuxinstall/libenki_2.0~git.20161121_armhf.deb
# getting aseba
wget http://wiki.thymio.org/local--files/en:linuxinstall/aseba_1.5.5_armhf.deb
# installing dashel
sudo dpkg -i libdashel_1.3.0_armhf.deb
# installing enki
sudo dpkg -i libenki_2.0~git.20161121_armhf.deb
# installing aseba
sudo dpkg -i aseba_1.5.5_armhf.deb
# deleting deb files and temp folder
cd ..
sudo rm -rf aseba_install
  1. After installing them some dependencies will be broken and you will have to fix them with apt. apt will show you the command for that. (apt --fix-broken install)

  2. If some dependencies are still missing use this line to install all noted dependencies of aseba according to their github repo:

sudo apt-get install libqt4-dev libqtwebkit-dev qt4-dev-tools libqwt5-qt4-dev libudev-dev libxml2-dev libsdl2-dev libavahi-compat-libdnssd-dev cmake g++ git make

  1. Install libqt4-sql-sqlite as

sudo apt install libqt4-sql-sqlite

  1. Note, that if you use an "Nvidia" graphics card with an official nvidia driver, it will break all X forwarding of aseba related user interface windows (using LibGl) to you PC. This is something you are not able to fix without digging very deep into your graphics settings and drivers. I highly recommend not to do this because you can mess up your PC configuration big time. Instead, create a virtual machine with Oracle VM with e.g. ubuntu18 base image. This fresh install will use "mesa" graphics driver and it allows you to use ssh -Y pi@<pi address> forwarding any aseba related graphics from the Pi to your virtual machine. Don't forget to set the default NAT network settings of your VM to Bridged Network so that you are able to reach the network of the host machine as well as other computers can reach your VM. Only use bridged network when you trust the network you use!

  2. Test your installation by running asebachallenge. Create a new simulated Thymio2 robot on port 33333, then run asebastudio and connect to this robot via tcp:localhost;33333. If a coding window with parameters on the left side pops up the connection has been established and you can be sure that your installation succeded.

Dependencies to use Aseba from python3

Our final goal is to use the previously installed aseba package from python3. To do so, we need to install a few dependencies to use pycairo and PyGObject both necessary to interface python3 with asebamedulla. Read more about PyGObject here

  1. If python3.7 is not the default python3 version (i.e. you have additional python3.x version as a default) you will need to do the following so that PyGObject can build properly.
sudo apt-get install python3.7-dev
  1. Install the dependencies of pycairo and PyGObject. Without this step pip will fail into install the mentioned 2 packages from setup.py
sudo apt install libgirepository1.0-dev gcc libcairo2-dev pkg-config python3-dev gir1.2-gtk-3.0
  1. To meet the requirements of dbus-python you might also need to install:
sudo apt install libdbus-1-3 libdbus-1-dev

Ensure correct Thymio2 Driver

As per the previous sections, only Aseba v1.5.5 can be installed to PI4 with Rapsbian 10 as this is the last readily built distribution and newer versions do not build anymore on Raspbian.

Thymio firmwares (on the actual robot) use a so called "aseba protocol version". If aseba (controller side, Pi4) and Thymio firmware (slave side, Thymio2) has different "aseba protocol versions", they will not work together anymore. Unfortunately this is not very well documented, but here are the steps to ensure that you can use your freshly installed Pi4 and your Thymio2 together.

  1. Check the firmware version of your Thymio. Start asebastudio and connect to your Thymio2. Now if you try to connect from your Pi with aseba v1.5.5 and you get a "Version Mismatch" error popup, you can be sure, that you will have to do the following steps. If the connection has been established, you still need to check the firmware version as the optimal firmware version is v12. To do so, in asebastudio click on "View>>Show Hidden Variables and Functions", then check the variable _fwversion on the left side. If this shows something different than 12, follow the next steps to up or downgrade your thymio to the desired version.

  2. Make sure that you have "Thymio Firmware Upgrader". This comes automatically with aseba versions lower than 1.6. Probably the easiest to do is to install some lower version aseba on windows so that "Thymio Firmware Upgrader" gets installed too.

  3. Download the firmware version 12 hex file from here

  4. follow this guide to install the downloaded firmware hex file on your Thymio2.

  5. If the installation takes more than 10 seconds your upgrade is stuck (for some unknonw reason). Try turning the robot on and off (during running installation), as well as replugging it (plus any combinations of these). According to Mobsya's instructions here is what you should try:

If the update is stuck at 1% and the robot works normally: the update did not happen and you can try again. Exit "Thymio Firmware Upgrader" (should leave any process "thymioupgrader"), disconnect and reconnect the robot and try again. The update is blocked at x% and the robot does not work: there was a problem and the robot is in safety mode. It is in fact blocked in the "bootloader" and reset every 1 to 2 seconds. Here are two solutions: Start a terminal and go to the directory where you installed ASEBA. You must use the command line program asebacmd with the following options: asebacmd -t "ser:name=Thymio" WUSB 1 "Thymio2-V10.hex", replacing the path to the .hex as required Install version 1.4 Aseba and use the old "Thymio Firmware Upgrader", here is the link for windows. Then it is just a question of timing. You have to press the upgrade button at the right time to be in the right timing with the bootloader. Just try several times and it should work.

Summary

At the end of these steps you should have

  • A thymio2 robot with firmware v12
  • A Raspberry Pi 4 with Raspbian 10 / Buster with Aseba v1.5.5

Please check all these versions NOW before continuing. Version mismatches can cause unwanted or untested behavior of the package VisualSwarm

Now you can go back to this page and continue the installation process