PID is a programming algorithm that’s used to make a robot drive straight, hold an arm in place, or slow down as it approaches a target. Making precise and smooth movements using PID on your competition robot will take you a long way toward winning the autonomous bonus.
My team recently encountered an unfortunate aspect of sensor data: “noise”. In order to make use of sensors for precision movements, such as driving straight, one needs a way to identify and filter out the junk. Here’s a step-by-step description of our median filtering process.
There is much information on the VEX Forum and various websites concerning PID, and most of them do a better job of explaining how it works and how to implement it than I could hope to achieve. Here’s a post with links to the resources I found useful.
There is much code available online for how to program an auton selector LCD menu. This post reviews our favorite code. It’s simple to understand and customize, provides 100% unambiguous feedback, and allows you to change your mind or fix an accidental button-push.
The Pre-autonomous / Initialize part of your competition template can be used for handy stuff, including sensor calibration and autonomous code selection.
The VEX accelerometer component’s usefulness in competition seems to be limited to a tilt sensor or an unexpected-stop sensor. Using it for position calculation involves double-integration, which introduces noise.
The VEX light sensor does not see a lot of use in competitive robotics. This analog sensor returns a numerical value that corresponds to the amount of ambient light detected.
RobotC’s datalog functionality allows you to see your program’s numerical data in complete detail, captured as your program is running. You can scroll through every iteration of a function and see the value of variables at each step. Plus one-click download to CSV and one-click customizable graphs. I love it.
RobotC tasks are a powerful tool that allow you to write code that can run simultaneously (sort of faux-multitasking, since the cortex cannot actually do two things at once). This is pretty high on the list of why we switched to RobotC from easyC; if your robot can handle several movement instructions at once, you can do a lot more, for example, in those 15 seconds of autonomous.
The ternary statement in RobotC is a way of writing an if-else statement all in one line, comprised of a (condition check), (what to do if true), and (what to do if false). Read on for some samples and explanation. While no one *needs* to write code this way, *everyone* should be able to read it to take advantage of code snippets available online.