We need to have obstacle avoidance by being aware of sonar topics
Stop when somebody or something blocks the robot path. It may be best to have a 'soft threshold' in terms of distance to the obstacle where we run at the speed to be run on the path but as we get to the soft threshold we need to ramp down speed.
We also then want a 'hard limit' which means we must be at a full stop if at the hard limit until the obstacle moves away.
In order to slow down to avoid hitting another magni in front of this magni if the back magni is going faster than the lead magni we need to back down the following magni when we are at the soft threshold.
There is also the issue of when to 'give up'. For our path finding conveyor belt app we may want by default these behaviors:
If we are stopped for an object in front of the robot, remain stopped until the object either is no longer there or is farther away than the hard limit. The trick here is how to ramp up speed to avoid leaping into action only to hard stop again. We should base speed on how far away the nearest obstacle is combined with some gradual acceleration logic
If the object moves past soft threshold we get back to full path speed and move on till next object.
A word on how to read sonar ranges and which ones to be looking at for obstacles
Assuming we have the robot.yaml file enabled with a line of
sonars: 'pi_sonar_v1' we can look at the topic that has all sonars which is /sonars
Then sonar_1 is 45 deg to the left
sonar_2 is 45 deg to the right
sonar_3 is the middle front sonar.
We need to have obstacle avoidance by being aware of sonar topics
We also then want a 'hard limit' which means we must be at a full stop if at the hard limit until the obstacle moves away.
There is also the issue of when to 'give up'. For our path finding conveyor belt app we may want by default these behaviors:
If we are stopped for an object in front of the robot, remain stopped until the object either is no longer there or is farther away than the hard limit. The trick here is how to ramp up speed to avoid leaping into action only to hard stop again. We should base speed on how far away the nearest obstacle is combined with some gradual acceleration logic
If the object moves past soft threshold we get back to full path speed and move on till next object.
A word on how to read sonar ranges and which ones to be looking at for obstacles Assuming we have the robot.yaml file enabled with a line of sonars: 'pi_sonar_v1' we can look at the topic that has all sonars which is /sonars Then sonar_1 is 45 deg to the left sonar_2 is 45 deg to the right sonar_3 is the middle front sonar.