MRC/Tutorials/Adding clutter and simulating wheelslip

From Control Systems Technology Group
Jump to navigation Jump to search

In the real world, the odometry that is returned by the robot is not perfect and will have a certain amount of drift. Furthermore, the internal representation of the map never matches 100% with the real world. To add these discrepancies to the simulator (which are disabled by default), a JSON config file can be supplied. In this file it is easy to specify an array of objects that will be added to the world and to enable wheelslip. An example of this file is shown below:

```json

{

"uncertain_odom":true,

"objects":[

{"length": 1.0,

"width": 1.0,

"trigger_radius": 1.0,

"repeat": false,

"velocity": 0.6,

"init_pose": [-1.0, 0.0, 0.0],

"final_pose": [-1.0, -2.0, 0.0]

},

{

"length": 0.2,

"width": 0.4,

"trigger_radius": 1.0,

"repeat": true,

"velocity": 1.3,

"init_pose": [1.4, 0.0, 0.0],

"final_pose": [1.4, 1.0, 0.0]

} ]

}

```

In this file, the "uncertain_odom" is enabled. Furthermore, two objects are added, which will start to move from their "init_pose" to (approximately) their "final_pose", supplied in (x,y,theta) coordinates.

This movement is triggered when the robot comes within the "trigger_radius" of the object, and the second object will keep repeating its movement. To supply such a file to the simulator, use the following argument:

mrc-sim --config ./relative/path/to/<YOUR_CONFIG_FILE>.json

or

mrc-sim --map ./relative/path/to/<YOUR_METADATA_FILE>.yaml --config ./relative/path/to/<YOUR_CONFIG_FILE>.json

The wheelslip is simulated by random sampling a slip factor every few seconds, making the simulator stochastic. The result is that, just like with the real robot, no two trials will result in exactly the same robot position and odometry.