

You must consider the difference between the dynamic measurement and the static measurement conditions.

However, you must be careful when using an accelerometer this way. Figuring out what that corrective action should be on-the-fly is another matter entirely, as described here by FullMetalMentor on the VEX Forum (this thread has many helpful/instructive comments and links). Using the z-axis of the accelerometer could tell you when the robot is tipping, and initiate some sort of corrective action. In many VEX games, robots have tall lifts for stacking things sometimes they fall over when the lift is extended up high. The first is to detect if you’ve run into something (like the field perimeter) and have come to a halt unexpectedly. I’ve seen 2 uses mentioned that seem reasonable for competitive robotics. This video from a presentation at Google explains what’s going on inside an accelerometer, and why using it is hard (start around the 8:50 mark in the video).
#Robotc tutorial vex code
Double-integration results in large amounts of noise/error, which requires employing sophisticated filtering code (Kalman filter) on top of that. To get position on the field, one must then integrate that velocity result (while the gyro sensor looks very similar to this one, the gyro actually does this integration for you, before you even get the data into your program). To get from acceleration to velocity, one must use calculus integration for your answer. However, this component measures acceleration, not velocity or position. Chassis like an x-wing holonomic drive do not easily lend themselves to using shaft encoders, what with the wheels going in all directions, so it seems at first blush that an accelerometer would be a useful replacement when combined with a gyro. However, most teams that think about using this sensor want to do so because they want to use it to calculate the robot’s position on the field. RobotC has an info-sheet with some sample code to do that. Simply getting data out of the accelerometer is not that hard read the analog port to a variable, and there you go. The accelerometer also comes with a little doo-dad called a jumper (photo, left) that can be used to increase or decrease sensitivity of the measurement that choice is a tradeoff with responsiveness. There is also a teeny-tiny green light (next to the word “Power”) that will turn on if you’ve got it plugged in correctly. One is not required to measure all axes just attach a 3-wire extension from a cortex analog port to whichever direction(s) you want to measure.Īs with the gyro (yaw) sensor, the black pin of the 3-wire extension goes on the side with the teeny-tiny “B”. As shown in the image at left, there are 3 rows of 3 pins in a block, with “X Y Z” printed on the component. This sensor can measure acceleration in the x, y, and/or z axes.

Product page for the VEX accelerometer cost: $40 for one sensor analog.

Surprisingly, this sensor has more technical details available than the gyro does, but by all accounts, using the accelerometer in VEX competitive robotics is either (a) limited, or (b) really, really hard. The accelerometer is a sensor type that falls into the same category as the gyro (and is made by the same company).
