Gyro to readjust shooter?

So we’ve essentially finished our robot, but we have a small problem and we were wondering if a Gyro sensor would work to fix it. Our frisbee shooter is mounted on two separate threaded rods controlled by separate speed controllers and motors. Because the one side is heavier, we have the motors running at separate speeds to move it up and down. However, even with a large amount of fine tuning there is some unevenness in the shooter’s orientation after some use (it should be parallel to the ground).

We were wondering if a Gyro could be used to adjust the shooter constantly back to the angle it started at when it was turned on (so we wouldn’t have to use an accelerometer), and if so, what the code look like.

Thanks!

A gyro will drift enough during a match, and lose accuracy during bumps and collisions, to make it a very poor solution for what you want. An accelerometer might work well, letting you detect “down” based on gravity and thus compensate for tilt. Why don’t you want to use one?

I’d suggest a mechanical solution, though: Chain the two threaded rods together so that they always move in sync with each other.

We tested a gyro and unless you have a clever way to reset the angle to calibrate it every thirty seconds it won’t be very accurate. You may want to look into potentiometers for measuring the angle. Although in your case the potentiometer solution does not seem practical. An accelerometer may be your best bet unless you want to go with the mechanical solution suggested above.

We tried using a gyro for our shooter angle because placement of an encoder was “inconvenient.” However, as the others have said, the drift is a problem; you have to take the shooter to a known position to re-calibrate the gyro fairly often as it will drift a degree in 10 seconds. Or not; it’s very random.

We have switched to an encoder.

How exactly should the encoder be programmed.

I don’t think an encoder could give you useful information on how misaligned your shooter has gotten. You might perhaps be able to use two encoders, one on each threaded rod, and move the motors to keep them synchronized.

Is there a good reason you can’t use a mechanical solution to ensure that the rods are always moving together?