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 :

[pastacode lang= »bash » manual= »%24%20bluetoothctl%0A%5Bbluetooth%5D%23%20agent%20KeyboardOnly%0A%5Bbluetooth%5D%23%20default-agent%0A%5Bbluetooth%5D%23%20power%20on%0A%5Bbluetooth%5D%23%20scan%20on%0A%5BNEW%5D%20Device%20B8%3A63%3ABC%3A00%3A46%3AED%20ROBOTIS%20BT-210%20%0A%5Bbluetooth%5D%23%20pair%20B8%3A63%3ABC%3A00%3A46%3AED%0A%5Bagent%5D%20Enter%20PIN%20code%3A%201234%0A%5Bbluetooth%5D%23%20trust%20B8%3A63%3ABC%3A00%3A46%3AED » message= »Connection with the Metabot » highlight= » » provider= »manual »/]

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

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

[pastacode lang= »bash » manual= »sudo%20modprobe%20rfcomm%0Asudo%20rfcomm%20bind%20rfcomm0%20B8%3A63%3ABC%3A00%3A46%3AED%0A » message= »Enabling serial port connection to the metabot. » highlight= » » provider= »manual »/]

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 :

[pastacode lang= »bash » manual= »%24%20sudo%20su%0A%23%20echo%20start%20%3E%20%2Fdev%2Frfcomm0″ message= »Starting the metabot » highlight= » » provider= »manual »/]

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 :

[pastacode lang= »bash » manual= »sudo%20minicom%20-s » message= »Minicom » highlight= » » provider= »manual »/]

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 :

[pastacode lang= »markup » user= »iscore-metabots » repos= »minuit-controller » path_id= »minuit_controller/metabot.cfg » revision= » » highlight= » » lines= » » provider= »github »/]

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.

[pastacode lang= »bash » manual= »sudo%20.%2Flinker%20%2Fdev%2Frfcomm0%209998%20..%2Fminuit_controller%2Fmetabot.cfg » message= »Command to launch the linker » highlight= » » provider= »manual »/]

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 Non classé