Tractobots, my attempts at field robots

BTW, here’s the meat of my steering code. (Prepare to be amazed.)

                            pid_output = self.pid_captured(self.cross_track_distance)
                            desired_heading = (self.course + minmax(-90, 90, pid_output)) % 360
                            bearing = degdiff(desired_heading - heading)
                            steer_for_bearing(bearing)  # horribly uncalibrated

Yup, that’s right; I send the cross-track distance into a PID and then use the PID output to determine how big my intercept angle should be. This was basically my first shot at a steering algorithm and it worked so well that I just kept using it. But it’s not working well enough now and there are so many parts that need improvement.

I’m thinking that if I throw an IMU into the mix, I could still use my algorithm but make the steering changes in response to IMU updates (at a very high rate). So I’d use the old code to say “Steer 305 degrees” but use the IMU to help me direct the steering wheels there.