Autonomous inconsistent from time to time

I was doing auton and I mastered the code to make 12 balls in, but when I come back the next day to try again it was doing some quacked up stuff. My auton is was only able to score 7. I don’t know if it is something wrong with the battery but it is mainly a drive train mess up.

As a computer scientist, I hear uninitialized variables, and as an an engineer I hear that a robot is doing exactly what you asked it to do but something about the environment has changed that means tiny errors pile up. The first one needs us to see a code listing after you’ve gone through to find uses of variables before they’re given values. Find other posts on the forum that include source code to learn how that is done sensibly. That might take you half an hour or so. The second one needs you to capture the first point at which the robot does something unexpected. Just like coding, until you’ve found the first error, everything else you see is harder to interpret. If you want to show that, take care to only video the robot and the field and elements if you’re going to post it here. Auton is one of the classic difficult things to get working, so expect to learn a lot of new bewildering stuff about how much of the robot’s behaviour you are personally responsible for in excruciating detail. The sense of achievement when you’ve got through that is wonderful, so go for it with an open mind about what you fundamentally don’t understand yet. We’ve all been there. For me it was decades ago and I envy you learning all the new things coming up. Your contemporaries will help you from here and we older folk will chip in if it seems to be going astray and when something I’ve missed is relevant, or if I’m ignorant of a feature of the coding system. (Everybody misses things, that’s why we work together.)


One more thought. There could be inadvertent state in the robot itself. If a system comes to rest with offsets or twist lingering or sticking within it, it might set off on a function subtly or significantly differently. Giving the robot an overall jiggle might release something like that. Pure speculation.


Thanks soo much this helped a lot, My robot started acting well when I instantly added the gyro, Its now taking precise turns and everything is falling in to place.

1 Like

It sounds like you’ve applied very general advice effectively to your specific problem. That right there is engineering :). I don’t know if you want to say more about what you did - other folk might learn something useful from it. Certainly get it written up in your notebook comparing lines the robot follows with and without. That sort of thing.


I agree with all the posts above, just food for thought, the environment in which your robot will run and all the subtle differences between them could cause your auton to perform differently in different places, you can account for this by using sensors, such as bump, distance, or for more advanced programmers a PID, I don’t want to come off as I’m pointing out the obvious but even things as simple as reducing give in your wheels can go a long way in making your code more reliable, you don’t want to use code to compensate for problems in the robot.


… and purposefully make it hard for your robot by misplacing elements or pointing it the wrong way during development and practice. Try to break the algorithm.