Skip to content

Simulate specific robots (Thymio) and generic Aseba nodes in CoppeliaSim

License

Notifications You must be signed in to change notification settings

jeguzzi/coppeliasim-aseba

Repository files navigation

Simulate Aseba, Thymios and E-Pucks in CoppeliaSim

This repository contain code to simulate specific robots (Thymio2 and e-puck) and generic Aseba nodes in CoppeliaSim.

You can control the robots/nodes

Installation

Dependencies

Linux

sudo apt install cmake libopencv-dev xsltproc [libxml2-dev] [libavahi-compat-libdnssd-dev]
[python3 -m pip install Jinja2 xmlschema]

MacOs

brew install cmake opencv [libxml2]
[python3 -m pip install Jinja2 xmlschema]

CoppeliaSim

To compile and then use the CoppeliaSim plugin you need ... CoppeliaSim. Download the latest release and export the location where you place it with

export COPPELIASIM_ROOT_DIR=<path to the folder containing the programming subfolder>

which on Linux is the root folder that you download, while on MacOs is /Applications/coppeliaSim.app/Contents/Resources, if you install the app to the default location.

Build

Linux and MacOs

$ git clone --recursive https://github.com/jeguzzi/coppeliasim-aseba.git
$ cd coppeliasim-aseba
$ mkdir -p build
$ cd build
$ cmake -DCMAKE_BUILD_TYPE=Release ..
$ make install -j4

This will build the plugin and install it together with the robot model[s].

Running

Launch CoppeliaSim. In the model browser, you will find models for Thymio, MightyThymio, and e-puck (called e-puck-aseba to distinguish it from the model already installed) in robots > mobile, which you can drag into the scene. Press play.

Aseba lua interface

If you want to program your own custom Aseba node, in the init callback of a lua script, use

node = simAseba.create_node()

You can then add Aseba variables, functions and events using this lua API.

Thymio lua interface

The simulated Thymio emulates the Aseba firmware available on real Thymios. Inside CoppeliaSim, we also expose a lua interface similar to the Aseba interface: take a look at the list of supported functions. For example, in Aseba, you can change the color of the large top LED like this (Aseba is integer-only and in this case a value of 32 corresponds to maximal brightness)

call leds.top(32, 0, 0)

while inside CoppeliaSim, you control the LED color like this

simThymio.set_led(0, 0, 1.0, 0.0, 0.0)

where the first two arguments identifies the robot and the LED, and where rgb colors are encoded in float instead.

If you want, you can customize the Aseba node of the simulated Thymio too, using the same API.

e-puck lua interface

Similarly, the simulated e-puck, emulates the Aseba firmware available for real e-pucks, while we also expose a lua interface.

Multiple robots

You can have as many robots/nodes as you like and attach them to the same or to different Aseba networks. Nodes on the same network will be assigned different IDs and can exchange Aseba events among themselves.

Thymio

The simulated Thymio implements all features of the real robot (firmware v14).

Full support

  • motors
  • LEDs
  • proximity sensors
  • ground sensors
  • accelerometer
  • buttons (you can click on them)
  • tap detection
  • proximity communication
  • SD card

Partial support

Aseba interface and programmatic read/write access from coppeliaSim
  • battery
  • temperature sensor
  • RC sensor
  • Microphone
Only Aseba interface
  • speaker (accepts sound.{play|replay|freq} and triggers the event sound.finished after waiting during the sound duration without actually playing it.)

The implementation is heavily inspired by the excellent 2D simulator Enki. In particular, the Thymio LEDs and 3D model are taken directly from Enki. Enki provides the core functionality of Aseba playground, which is the simulator mostly commonly used with Thymios and Aseba.

With respect to Enki/Aseba playground, coppeliaSim together with this plugin, share these features:

  • simulate one or more Thymios, emulating the Aseba-based firmware (and are therefore compatible with Aseba Studio and/or VPL)
  • motors, LEDs, proximity sensors, buttons, ground sensors
  • compatible with the new autodiscovery of Thymio Suite

CoppeliaSim together with this plugin, adds:

  • fully featured 3D robotics simulation (this from CoppeliaSim alone :-))
  • ground sensors detect steps/holes/ too
  • proximity sensors responds to material color too
  • some more LEDs (2 for ground sensors and 3 for the battery-level)
  • accelerometer
  • proximity communication
  • tap detection from accelerometer
  • basic support for rc, microphone, speaker, battery, and temperature sensor.
  • option to enable the same behavior of the real robot that provides feedback about proximity and ground sensors, battery level, accelerometer, microphone, temperature and rc, when the LEDs are not controlled by an Aseba script.
  • support for firmware v14
  • multiple robots on the same Aseba network (without the need of running asebaswitch)
  • customizable Thymio Aseba node
  • custom Aseba nodes implemented in lua
  • loading Aseba scripts from lua

e-puck

The simulated e-puck implements all features of the real robot exposed in the Aseba firmware.

Full support

  • motors
  • LEDs
  • proximity sensors
  • accelerometer
  • gyroscope
  • camera

Partial support

Aseba interface and programmatic read/write access from coppeliaSim
  • battery
  • selector
  • RC sensor
  • microphones

Like for the Thymio, the object model is taken directly from Enki. With respect to Enki/Aseba playground, coppeliaSim together with this plugin, shares these features:

  • simulate one or more e-puck, emulating the Aseba-based firmware (therefore compatible with Aseba Studio).
  • motors, proximity sensors, camera

In addition to the list presented before for the Thymio, this simulation adds specific e-puck features:

  • 8 red LED on the ring
  • green body LED
  • green front LED
  • accelerometer
  • gyroscope
  • basic support for rc, microphones, battery, and selector
  • customizable e-puck Aseba node

About

Simulate specific robots (Thymio) and generic Aseba nodes in CoppeliaSim

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published