Controlling Metabots with i-score

This article explains how to control the Metabot robots with i-score.
The goal is to create a full interactive robot choreography.

The Metabots are small, open-source, 3D-printable robots built in France by Rhoban.
They can be bought in http://metabot.fr/

1. Presentation

i-score can control some parameters of the metabots in real-time.
The metabots can be connected in Bluetooth, or with an USB cable (but this
is less practical for shows !).

This technology currently only works in Linux, however.

Requirements :

  • A Metabot.
  • A Linux system with development packages, SDL, i-score and Bluetooth support with bluetoothctl.
  • A build of this repository : https://github.com/iscore-metabots/minuit-controller

The tutorial uses the command-line to connect to the metabots but graphical managers can also be used.

i-score communicates via the Minuit protocol with an intermediary program, named « linker ».
Linker then converts the Minuit messages into serial-port commands adapted for the Metabot.

2. Connecting the metabots.

First, ensure that the metabot is correctly charged and turn it on.
Then, run bluetoothctl.
Bluetoothctl is a shell of its own. Inside it, follow this procedure :

$ bluetoothctl
[bluetooth]# agent KeyboardOnly
[bluetooth]# default-agent
[bluetooth]# power on
[bluetooth]# scan on
[NEW] Device B8:63:BC:00:46:ED ROBOTIS BT-210 
[bluetooth]# pair B8:63:BC:00:46:ED
[agent] Enter PIN code: 1234
[bluetooth]# trust B8:63:BC:00:46:ED
Connection with the Metabot

The MAC address of the Metabot will be different for each Metabot.

Once this is done, open a standard shell and run :

sudo modprobe rfcomm
sudo rfcomm bind rfcomm0 B8:63:BC:00:46:ED
Enabling serial port connection to the metabot.

This will open a virtual file that allows « reading » and « writing » to the Metabot.
To test if it works, you can try to write the start message to the bot :

$ sudo su
# echo start > /dev/rfcomm0
Starting the metabot

The metabot should then wake up.

To keep the Bluetooth connection alive, the safest bet is to open a shell via minicom or cu inside the metabot.
For instance :

sudo minicom -s
Minicom

Edit the settings by going to « Serial port configuration », setting the port to /dev/rfcomm0 and going to « Leave ».
This drops yourself to a shell where commands can be sent to the metabot.

e.g. : dx 10   => the metabot moves laterally at 10 centimeter per second
The command « help » lists the metabot options.

3. Set-up the Minuit controller

We have to launch the linker software with correct parameters for the Metabot.
The linker translates Minuit (OSC) messages to serial messages, with a configuration file :

Metabot
Metabot = {objectType={Container}, subnodes={moves, sys, modes}, description={"Metabot, un robot très sympatique"}}
moves = {objectType={Container}, subnodes={h, dx, dy, turn}, description={"Fonctions de mouvement"}}
sys = {objectType={Container}, subnodes={start, stop, quit}, description={"Fonctions"}}
modes = {objectType={Container}, subnodes={alt, crab, backleg, back, freq, gait}, description={"Fonctions changeant la pose que prend le robot"}}
h = {objectType={Data}, type={decimal}, rangeBounds={-30,-120}, description={"Change la hauteur du metabot"}}
dx = {objectType={Data}, type={decimal}, rangeBounds={-300,300}, description={"Le robot avance d'autant de centimetres par pas dans la direction x"}}
dy = {objectType={Data}, type={decimal}, rangeBounds={-300,300}, description={"Le robot avance d'autant de centimetres par pas dans la direction y"}}
turn = {objectType={Data}, type={decimal}, rangeBounds={-300,300}, description={"Le robot effectue une rotation d'autant de centimetres par pas"}}
start = {objectType={Data}, type={integer}, rangeBounds={0,1}, description={"Activer les moteurs"}}
stop = {objectType={Data}, type={integer}, rangeBounds={0,1}, description={"Désactiver les moteurs"}}
alt = {objectType={Data}, type={integer}, rangeBounds={0,10}, description={"Change l'altitude du robot"}}
crab = {objectType={Data}, type={decimal}, rangeBounds={0,10}, description={"Taux de crabe"}}
backleg = {objectType={Data}, type={decimal}, rangeBounds={0,10}, description={"Change la hauteur des pattes arrières"}}
back = {objectType={Data}, type={integer}, rangeBounds={0,1}, description={"Retourner les pattes"}}
freq = {objectType={Data}, type={decimal}, rangeBounds={0,3}, description={"Change la fréquence du robot"}}
gait = {objectType={Data}, type={integer}, rangeBounds={0,1}, description={"gait"}}
quit = {objectType={Data}, type={integer}, rangeBounds={0,1}, description={"Ordonne au serveur de s'arreter"}}

The first line is the name of the Minuit device that has to be put in i-score.
Launch the linker like this : it will open a port and wait for i-score.

sudo ./linker /dev/rfcomm0 9998 ../minuit_controller/metabot.cfg
Command to launch the linker

4. Set-up i-score

The Linker exposes by default the device named « Metabot » to i-score.
Once loaded (this takes time), you can score the Metabot parameters.

Publié dans Tutorials