MRC/Tutorials/Adding doors
Jump to navigation
Jump to search
The real environment might contain a door that the robot needs to open. The simulator is capable of simulating these doors, such that you can test your software before it gets real! To add doors to the simulated world, simply edit your heightmap and add grey lines to it. To be specific:
- The door should be a straight line (but not necessarily axis-aligned), with a minimum thickness of 2 pixels. To be more specific, all pixels in the door line should be connected
- The average RGB value should be between 25 and 230 (on a scale of 0-255). So for example, the RGB value (100, 100, 100) is a door, while (20, 20, 20) is a wall (and (255, 255, 255) is open space).
- You can have multiple doors in your world. However, make sure that they are always separated by at least one pixel, otherwise the simulator will interpret them as one big door.
The doors should be visible as green blocks in the simulator. Now, you can use the emc::IO object from your code to open these doors (but only if you are standing in front).
You will learn more about the emc::IO object later in these tutorials.
// ... Make sure robot is in front of a possible door io.sendRequestOpenDoor();
To manually open a door in the simulator open a terminal and type
mrc-open-door