Table of Contents
How to add sensors in your simulator ?
This howto is a brief summary of what kind of sensors you can use in the simulator and on how to use them (e.g. how to create an instance of a sensor, initialize it, set its parameters,…).
Laser range finder simulation
To add a laser range finder simulator in mgEngine (i.e. the existing Sick simulator), you simply need to type the following command in mgEngine shell :
new SickSimulator sick
This line create a Sick simulator that runs on the CPU and might slow down you system. You may want to do it on the GPU, it is possible by using another Sick simulator that uses the ZBuffer :
new SickSimulatorZBuffer sick
Once your simulator is create, you can attach it to another positionnable object (e.g. the robot 3D model) and change its position :
sick.MakeChildOf cycab_mesh sick.SetPosition 1.68 0 0.7 sick.SetRotation 0 0 0
The default behaviour of the Sick simulator is to see every object in the scene. If you want to add some invisible objects (for example label that can be viewed only by the observer), you can ask the Sick simulator to render a given layer :
sick.SetProperty layers 1
You can also change the Sick range of view using this command :
To show the laser rays use this command :
and to hide them, type :
The simulator proposes several camera simulator. All these simulators have an OpenCV IplImage output format.
It is possible to have another output format, but you need to write your own simulator. See this howto to know how to write your sensor simulator.