Log in

View Full Version : Autonomous Inconsistencies


Sav01027
28-03-2015, 15:13
We're coding an Autonomous mode in preparation for our next regional, and we're running into a very odd issue. We have our code set up so that it calls methods into the autonomous code (i.e. drive() would make it drive forward a set number of encoder rotations).

The issue that we're having is that when we enable the robot to run Auto, it acts unpredictably. Say, one time it would do it perfectly, but the next it would turn for a different number of degrees, or drive for a different distance, while running on identical code.

We have tried resetting the code and the roboRio, as well as checking the encoder values in Teleop. At least in Teleop, the encoders seem to be working fine.

Has anyone encountered this problem before, or has a solution for it?

Thanks

Nyxyxylyth
28-03-2015, 18:07
We have our code set up so that it calls methods into the autonomous code (i.e. drive() would make it drive forward a set number of encoder rotations).

The issue that we're having is that when we enable the robot to run Auto, it acts unpredictably. Say, one time it would do it perfectly, but the next it would turn for a different number of degrees, or drive for a different distance, while running on identical code.
Are you calling SetPosition(0) in your AutonomousInit() for the encoders, etc? Or whatever the appropriate equivalent initialization spot is in your setup.

Pault
28-03-2015, 18:51
What kind of Drivetrain do you have?

How are you driving? Are you using a PID loop or just driving until the encoders read a large enough value or what?

GeeTwo
28-03-2015, 19:23
I would try printing the encoder count to the smart dashboard on a heartbeat (perhaps 0.1 or 0.5 sec, depending on how fast you're going) and compare the results of the trials that work vs the ones that don't. There should be some sort of clue there.

Also, presuming that you are driving this on some variant of tank, you need to ensure that the counts of the two sides increase together. If one is getting ahead of the other, slow that side down a notch. Otherwise, you'll wind up curving off course, though the robot should straighten out to the correct orientation at the end if it hasn't hit anything.

WillNess
29-03-2015, 13:56
Check how you're treating the encoder during TeleopInit and TeleopPeriodic, are you reseting it in teleopinit and not autonomous init?

ozrien
30-03-2015, 16:45
Post your code?