auton codes

What are some of your guys’ Autonomous codes, and what are you exactly trying to accomplish with them?

(we are looking for ideas)

I gave up writing auton, so I made a program that records my driving. It exports an array of values based on the controller into a debug screen where I can copy and paste it

I assume you’re asking about strategy? It largely depends on your bot (shocking, I know). We have an internal stacker, so we can carry a goal and stack cones on it at the same time, so we have an auto that grabs the mobile goal (in the parking position) and the cone directly behind it and stack that while moving backwards. Then it drops it into the 10 zone. I also have one that does the same, but stacks the cone without bringing back the goal to avoid interfering with our partner. If all you do is stack, I’d recommend you try something like my second scenario or get the high stack with your preload on a stationary goal. If you’re a mobile goal carrier, try and get one into the 20.

If you’re looking for some guidelines on actually writing the code, I’m probably not the best person to ask (mine are only recently consistent enough to use in competitions), but pretty much everybody in the forum will recommend one thing: sensors; especially on your wheels. You wouldn’t believe how much of a difference it makes. If you do it right, you can always get exactly to the right spot, no matter your battery level or weird friction that decided to appear in your chassis and MAKE A SUPER ANNOYING SQUEAKING NOISE THAT WE CAN’T GET RID OF- ahem… Or something like that, I don’t know.

Another thing I have noticed that makes a big difference is “hard-stopping” the motors. By this I mean that whenever you want to stop a motor, instead of setting the power to 0, set it to -10 or 10 in the opposite direction that it was previously running. After 60-100 ms, set it to 0. This will effectively remove any drift when the motors stop, so the motors will always stop exactly where you tell them to and not go over.

My autonomous code uses time: (wait [1000]) to designate how far my robot goes. Anyway, my robot goes to the right, picks up a mobile goal, and brings it back to the 20 point zone.

How did you do that? I thought about doing something similar, but honestly I don’t have the time before our next competition.

My idea was to record motor values for all motors over time. How did you approach that? Also, did you use encoders for your approach?

@lathashivakumar It depends on how precise it needs to be. If you want the code to be simple, make it records the values of joysticks and buttons over time. You record your driving just before you go to your match, export those numbers onto a debug stream, and copy and paste them into a code.

A more complex one would integrate PID or sensor values to make sure you kept a constant velocity with voltage change. Perhaps this would allow for longer durations with relative accuracy (programming skills?)

Depending on your understanding of calculus (which I don’t have much so this could be completely wrong) You can make it work with only accelerators. By graphing the acceleration over time and taking the integral of multiple points, you can get an accurate measurement of the instantaneous velocity. This seems over complicated to me though.

My code is still in its beta stages so I am not sure how well it will perform or if it has potential to remain accurate over longer periods of time.

I am attempting to write a replay program that uses the Joystick values. I got the recording part working, but when I copy the array from the debug stream to my code, I get an error saying

**Severe*:Out of static memory for variable allocation.

. I defined my array as

const int f_joy[750][16] = {...};

. How do you define a large array without it erroring out on you?

RobotC is a base 8 language meaning that the largest array you can store is 128 long. To make it longer, you must make it global scope.