In this iteration of the
Controller class, we attempt to resolve two issues, namely limiting the sweep to a specified maximum angle and keeping the robot from deviating from a straight-line segment.
This solution involves modifications to
sweepClockwise() as a prototype. I will only present the parts of the code that have changed since the last iteration. The first change we made is to introduce two new members (variables) in the class:
private final static float DELAYS_PER_DEG = 100.0f / 180; private final static int SMALL_ROT = 10;
The first variable
DELAYS_PER_DEG encapsulates our empirical knowledge that 100 delays roughly corresponds to 180 degrees of rotation (this number may be different for ...