SIMULATION ENGINE
Using anyKode Marilou simulation engine with RTMaps
Duration: 20 min.

OBJECTIVES
Simulate robots behaviors using the anyKode Marilou simulation engine in cooperation with RTMaps.
KEYWORDS
Robotics, simulation, odometry, vision, lidar, control.
USED COMPONENTS
MarilouExec, Robot explorer, Robot positions Keyboard, Lidar tools, OSG viewer...
PREREQUISITE
Basic knowledge of RTMaps and Marilou is needed. You should find informations about both products on the RTMaps tutorial site and anyKode Marilou web site.
- Download and install RTMaps. - For versions earlier than RTMaps 3.4.7, download and install packages rtmaps_anykode_marilou, rtmaps_lidar_tools, rtmaps_osg_viewer from here. - Download and install anyKode Marilou. You can find instructions here. - Download and install the Marilou sample 1setup. - Please upgrade "standards components" package on the Intempora support website if needed.
I. RUNNING THE SAMPLES
I.1 Installing the tutorial files
The tutorial setup will install several files under the path <RTMaps install dir>/samples/marilou_sample_1 (by default). Some files will be used by the anyKode Marilou simulation engine (“resources” directory) and others in RTMaps (it actually contains 1 RTMaps diagram).
I.2 Diagram marilou_sample_1_triloblue.rtd
This world is composed of a small room and a triloblue robot. It can be driven with the arrow keys from the keyboard.
II. COMPONENTS PACKAGE AND DESCRIPTIONS
II.1 Marilou Package
This package is specific to anyKode Marilou. It contains three components:
- Marilou exec - Robot devices - Robot positions - Keyboard -> Left/Right motos control

II.2 MarilouExec
Marilou exec is responsible of the Marilou world loading. It works as if launched through the anyKode Marilou menu. To test it, first create a new empty diagram into RTMaps and register the rtmaps_anykode_marilou.pck package. This package may be located into the standard RTMaps package directory: <rtmaps install directory>/packages
Now drag and drop Marilou exec onto the RTMaps workspace. Marilou exec has only one property file that specifies the anyKode Marilou world to load. Click on “help” button on the window property to obtain help on this component. Set this property file to any .mdsp file. There is one provided with this tutorial situated in <rtmaps install directory>/samples/marilou_sample_1/marilou_files/triloblue/fullRoom.mdsp
Note : To start the simulation, right click on the Marilou exec component and choose "Launch Marilou World".

II.3 Robot interface
The Robot devices component connects to the Marilou world and queries a list of available physics objects which can be interfaced.

1) The MODA server is the network name of the computer that hosts the simulator. It is set to localhost by default.
2) Choose the /triloblue robot in the Robot name property to create the corresponding IOs (inputs for motor control, outputs for sensor data).
You can use the Marilou device explorer to find every the entity names known by the simulator. When the diagram containing only the MarilouExec component is running (see above), launch the program file "DevicesExplorer.exe" located into <Marilou install diretroy>\Samples\Tools\DevicesExplorer\bin\Release
You can also open the device explorer directly from the simulation window that is running, in the tool menu, by choosing Devices Explorer. When the device explorer is opened, you have to configure the host that is running the simulation.

You will then be able to explore the structure of every loaded entity. In this example, the robot name is triloblue. This name will then be used internally to find every core devices like sonars, lidars, cameras or motors the robot is equipped with.
II.4 Controlling the robot
The triloblue is a differential robot which means it is controlled by commanding the speed of the left and right wheels motors. In order to be able to use the Keyboard component to control the robot, we need an intermediate component which will be able to convert an integer code (a virtual key code from the keyboard in our case) into speed commands for the left and right wheels. The component Keyboard -> Left/Right motors control is the one we need. It is configured by default for translating the arrow keys into the corresponding motors commands. Edit its properties to make any change you need (change the keys mapping, change the motor speeds...)

II.4 Displaying sensors data
The robot is also equipped with several sensors such as sonars, a Hokuyo lidar, a camera...
In order to display the robot camera, just take an Image viewer and connect it to the viewpoint0_cam output of our robot_devices_2 component.
In order to display the lidar scans, we can for instance do the following:
- register package "rtmaps_lidar_tools.pck"
- the "Laser scan to 3D points" component will be able to convert the vectors of distances issued on output zone0_laser measured on the virtual lidar into a set of 3D points (e.g. a vector of floats to be interpreted as a sequence of X,Y,Z coordinates).
- register package "rtmaps_osg_viewer.pck"
- place a OSG viewer component and provide it the cloud of 3D points from the Laser scan to 3D points component
- eventually adjust the position and orientation of the view camera: this point of view can also be controlled with the mouse on the 3D viewing window.
Here is how the final diagram looks like:

II.5 Ground truth
In order to get the positions and orientation of any object in the world, it is possible to use the Robot positions component from package rtmaps_anykode_marilou.pck: select the object you want to query, then Apply and select the part of the object to get the position from. Example : Robot name: "/triloblue", position_acq_1: "center"
|