I’ve been working on the GoPiGo lately, and I came across a behavior I don’t understand.
I am trying to make the robot rotate as precisely as possible, as I want it to rotate 90 degrees all the time. I am using the compass to get a precise angle (if possible less than 5° error). I am slowing down the robot while it is rotating, otherwise it will overshoot its target angle.
The thing is that sometimes one of the motor, generally the left one, does not turn back to maximum speed after a rotation, thus making it turn instead of driving forwards. Any idea why this is happening?
I am using this code for the rotation for the moment:
–if math.fabs(current - target) < 5:
and this code to drive forwards:
-if self.sideFollowed == WallFollowed.Right:
-self.isTurnPossible = True
-while gopigo.read_status() == 1:
–if gopigo.us_dist(15) < self.ROBOTLENGTH*3:
–self.isTurnPossible = False
I am also having overshooting problem because the compass doesn’t seem to update fast enough.
Edit: the “-” is the indentation, I can’t seem to find a way to make it show on my post