Hi,
I recently saw a video of a 301 point prog skills and the person who made it said that they were using PID and the inertial sensor. In my programs, I currently use PID along with tracking wheels, and it works quite well for distances. The program always drives in a straight line and is within a couple centimeters of its target every time.
The main source of error in all of my programs is turning. For my turns I use the initial sensor’s heading to find my position. This usually works quite well for the first part of any run, but on some runs it quickly loses accuracy. Here are some examples:
In our programming skills autonomous, around 30 seconds in, we go to grab a neutral goal. However, the angle the robot goes to grab the neutral goal at is sometimes off by 2 degrees on either side and misses grabbing the goal as a result.
In one of our elimination autons, our robot rushes a neutral goal. It quickly comes back over to our home zone and turns to pick up our alliance goal. Sometimes this turn is off by over 10 degrees not even 10 seconds into the program. Our back lift is quite forgiving and we pick it up almost every time, but I am unsure how the program loses so much accuracy so quickly.
I am fairly certain it is not an issue with my “turn to” function. It is very simple and it prints the gyro heading on the screen. Every time the program turns, it thinks that it turned the correct amount. It usually says that it is within 0.1 degrees of were it is supposed to be. I know I am not using PID to make my turns, but I think the error is coming from drift not any errors with my turn.
Here is an example (Gyro is the name of the inertial sensor):
while(Gyro.heading() > (168)) {
leftFront.spin(reverse, 10, percent);
rightFront.spin(forward, 10, percent);
rightBack.spin(forward, 10, percent);
leftBack.spin(reverse, 10, percent);
Brain.Screen.clearLine();
Brain.Screen.print(Gyro.heading());
}
Drive.stop();
Every time the robot makes this turn it says the heading is around 168 degrees (within 0.1 degrees). However, sometimes it is off by 10 degrees of were it is supposed to be.
I think that the issue with this is drift in the inertial sensor. I make sure to calibrate the gyro before every run. It seems that other teams are not getting the same amount of drift that our team is. Does anyone know why this is the case, and how to prevent it?
Tl;Dr: I think our inertial sensor is getting a lot of drift.
Thanks in advance!