VEX Autonomous Behaving Differently on Competition Controller

Hey everyone! I’ve recently run into a super weird problem with my robot’s autonomous:

When I run an autonomous program by starting it via a controller, everything works fine and the program behaves as it should. When I have an autonomous started by a field controller for a match, the autonomous completely bugs out. Distances are wildly off, the motion is not as programmed, and commands execute multiple times.

Why is this?

In this forum post by @jpearman , he makes an interesting note about field controllers at the time:

One unusual aspect I found is that tournament manager constantly toggles the driver/auton control signal when the robots are disabled before and after a match. I have no idea why it does this, it may just be a bug or the joystick possibly detects this and takes some type of unknown action, who knows (well only VEX and DWAB I guess).”

This is my only lead to the behavior I’m experiencing. My odometry doesn’t drift at all, and all my IMEs are returning accurate positions. I built my own competition switch that can very quickly switch between driver and autonomous while disabled (uses buttons instead of switches).

Sure enough, I was finally able to replicate the behavior I was experiencing. I added some debug statements and the behavior is all over the place. Sometimes motor encoders just won’t return any value, sometimes move functions get called twice, etc.

What I’ve tried so far:

Adding an if statement to my autonomous to check that we’re in autonomous and not disabled:

if (!pros::competition::is_disabled() && pros::competition::is_autonomous)

Same behavior.

Anyone have any guesses as to what I can do about this?

Thanks!

2014 post, I would not be too concerned about how TM was working 9 years ago.

have you read this topic ?

6 Likes

Thanks! I’ll try the suggestions there. Only reason I was relying on info in that post was because I was able to reproduce the issue that way.

I’ll try that fix now, although I’ve been using a similar version of this code since last year without any issue. Difference this year is my support for IMEs which I don’t think would affect much. If the tasks issue fixes it (I use a task for odometry), I’ll mark that as a solution.

Tried this, unfortunately seems to have the same result. I made a method to kill my task while disabled if it even matters, but I just have the task starting in autonomous now anyways (and, as per the link you sent, I disable it in driver control as well). I’m happy to send any relevant code if needed, but I can’t really understand how it’s possible for the same code to behave differently under competition control given my (admittedly limited) understanding of how competition control works.

I was testing our smart controllers to verify all ports are working. I observed this issue and have been able to reproduce using Tournament Manager.

To test each port:
started the match
let autonomous run for 3 seconds
selected end early
resumed the match for driver
verified driver
ended selected end early
rested the timer
moved to a different port
repeated the process without restarting the robot brain

After a few(2-10) runs without a brain reset, the autonomous would not work correctly. I found I did not have to move ports, just restart the match via TM.

Once the issue occurred, I restarted the program on the brain and everything would work as expected.