Running Thymio Wireless with Python on Ubuntu Virtual Machine

I have written a post on running Thymio using Raspberry Pi. Somehow the wireless connection was not working for me even after I plug the usb wifi. So I decided to try using Ubuntu Virtual Machine on Windows host. And it works.

Setup:

  • Host OS: Windows 10
  • VirtualBox
  • Virtual Machine OS: Ubuntu 16.04 LTS

After finish installing Ubuntu on the VirtualBox. These are the steps:

  1. Install aseba following the steps here. The official documentation provides steps for Ubuntu.
  2. Install dbus: sudo apt-get install python-dbus
  3. Install gobject: sudo apt-get install python-gobject

Now you can follow the steps to run the python code:

  1. run asebamedulla: sudo asebamedulla “ser:name=Thymio-II”
  2. run python code on a different terminal: sudo python pithymio.py
Advertisements

Running Python on Thymio

I found a link that describes the process here:

http://www.adambowes-portfolio.com/blog/2014/11/3/thymio-ii-control-with-python

The setup that I use is Raspberry Pi 2 Model B+ running Jessie. First we need to setup the hardware connection:

  1. Connect USB from Pi to Thymio
  2. Connect power from socket to Pi
  3. Start Pi

Now, we need to install some software. There is a bug in the software provided by Thymio websites, so I found a forum where they provided the fix for Pi. On your pi, open terminal, and type the following:

sudo apt-get install apt-transport-https

This is to enable apt-get to get source from https.

 

Now, we add the source by editing /etc/apt/sources.list:

sudo sh -c 'echo "deb https://dl.bintray.com/msprunck/Aseba jessie main" | sudo tee -a /etc/apt/sources.list'
sudo apt-get update
sudo apt-get install libenki libdashel aseba

After it is installed, we can test if asebamedulla is running. To do this, open a new terminal, and type:

sudo asebamedulla "ser:name=Thymio-II"

If it works, it will output something like the following:

Found Thymio-II on port /dev/ttyACM0

Now, download the sample code. Open a new terminal or a new tab, and run the sample code as follows:

sudo python pithymio.py

It will output:

dbus.Array([dbus.STring(u'thymio-II')], signature=dbus.Signature('s'))
0 0 0 0 0

At this point, it waits for you to enter the command.

  • Type “w” and press Enter to move forward for 1 second.
  • Type “s” and press Enter to move backward for 1 second.
  • Type “a” to rotate to left
  • Type “d” to rotate to right

Type CTRL-C to exit.