ProgrammingRobotsStudyGroup / robo_magellan

Apache License 2.0
4 stars 6 forks source link

Fix turning tolerance on escaping cone and recovering #38

Open merose opened 6 years ago

merose commented 6 years ago

Currently the turning code depends on an angle tolerance. This is problematic because the rate at which we get robot state updates is only about 4Hz, and we may pass through the angle tolerance between updates. Instead, we should turn until the total turning exceeds a desired value. (Could exceed the value positively, for counter-clockwise turning, or negatively, for clockwise turning.)

This change will eliminate the need for an angle tolerance, so long as the desired turning is far enough away from 360 deg (= 0 deg) that we don't wrap around. Testing on 04-20 shows that an angle tolerance of +/- 30 deg works OK with the current code, so desired turning anywhere from 0-330 deg should work OK, and we'll probably never use more than 180 deg of desired turning.