Collaboration diagram for lasersafe:
The general concept of this device is to not do much, but to provide a last line of defense in the case that higher level drivers or client software fails in its object avoidance. When the laser scanner detects an obstacle within the safe distance, it will prevent the robot from moving either forwards or backwards (depending on which way the laser scanner is facing). For example, if the laser scanner is facing forwards and it detects an obstacle, the robot will only be able to back away, not continue forwards into the obstacle.
- Compile-time dependencies
- Configuration requests
- PLAYER_POSITION2D_REQ_MOTOR_POWER : if motor is switched on then we reset the 'safe state' so robot can move with a bump panel active
- all other requests are just passed on to the underlying position2d device
- Configuration file options
- safedistance Default: 0.4m The distance at which to stop
- step Default: 5 The number of range readings to skip over. For example, the default value will check readings 0, 5, 10, and so on. A value of 10 will check readings 0, 10, 20, 30, ...
- history Default: 3 The driver will use a moving average of range readings to help overcome noise issues. This specifies the number of readings to consider in total (so a value of 3 gives the current plus the two previous readings). If set to 1, only the most recent scan data will be used.
- forward Default: 1 Indicates if the laser scanner is pointing forwards (1) or backwards (0).
- boxmode Default: 1 If 1, the driver uses a box model for the safety area instead of a radius distance from the laser scanner. This can allow you to, for example, ensure that the robot can pass through narrow passages without driving into an object ahead. Set to 0 to use the radius mode.
- boxwidth Default: -1m The width of the box. If less than zero, the position2d device will be queried for the width of the robot and that will be used as the box width.
- boxsafety default: 0.1 A safety margin to use if getting the width of the robot for box mode. Won't be used if specifying the width of the box manually in the config file. The default of 0.1 is a 10% safety margin, 0.25 would be 25%, and so on.
TODO: Make driver more advanced so that it can find the laser's pose and allow movement in the opposite direction to the way the laser is pointing.
driver ( name "lasersafe" provides ["position2d:0"] requires ["position2d:1" "laser:0"] safedistance 0.3 step 10 history 1 )