Programming Gyro

Hello everyone! I was wondering if it is possible to use a gyro to set the angle at which a pneumatic catapult launches the ball. If it is possible, how should I approach this? Thanks!

  • Team 2064

Its technically possible but you would be better off using a mechanical stop, an encoder, or something more reliable. A gyro tends to need a lot of recalibration (the ones I’ve ever used with a FRC robot that is). Its not something you want to rely on exact measurements for. Even it it was easier to work with I think there are simpler options.

In my experience, gyros are best used for relative angle measurements (i.e. turning 90 degrees relative to your current position). They tend to have a lot of “drift”, meaning the angle will change from the true value over time. This doesn’t matter if you only need a relative angle, but I wouldn’t trust a gyro for an accurate absolute angle.

If you want to measure the angle of an apparatus on your robot, I recommend using some kind of angular potentiometer. The angle potentiometer will output a current between 0V and 5V. After you have the potentiometer set up, it’s a matter of taking empirical measurements and creating a function to map the voltage returned to an actual angle. This is the method my team used last year to measure the angle of our disc launcher.

You can also look at using an accelerometer that measures acceleration due to gravity. So it measures 1G when straight up in the axis it’s measuring and changes by the cosine of the angle as it rotates. Since it’s an absolute measurement, there’s no drift.

But if there is a simple rotary joint where the shooter pivots and you can do the mounting, a potentiometer is probably the easiest way to measure the shooter angle. It will give you a voltage output that is directly proportional to the joint angle.

We actually tried to use this method last year before we settled on the use of the potentiometer. Unfortunately, the oscillations of our shooter greatly lowered the precision of our measurements by introducing new sources of acceleration.

Noise made this almost useless for my team last year. I’ll be testing whether running it through a cRIO-side low-pass filter will help, though.

Another option is to use a string potentiometer e.g. AndyMark sells a kit
They have the advantage that the pot can be mounted at some distance from your axle, simplifying mounting and field maintenance. It won’t measure angle directly but you can calculate angle by simple trig or just use a predetermined value for specific setpoints.