View Full Version : Ever use a helicopter heading hold gyro before?
seanwitte
15-01-2008, 21:20
RC helicopters use gyros to control the tail rotor. They sit between the receiver and the servo/esc for the tail and modify the control signal sent to the output. The input is the desired PWM value and the output is the modified PWM value. The gyro will attempt to hold the heli tail in a fixed position when the input is neutral, but will allow the tail to move when a non-neutral input is applied.
We used the ADXRSxxx gyros on the robot to integrate the heading, but I never thought of using one of these simple gyros to make the robot drive straight. For a holonomic platform you have three components to your drive commands: X, Y, and rotation (W). Take the W value and send to to one of the user-controlled PWM outputs connected to the gyro input. Connect the gyro output back to the RC and read the pulse width to determine the modified signal value. Use the modified value to drive the robot instead of the original W value. I have no idea whether it would work or how well, but I was curious whether anyone has done it.
All sounds good, but you can't read in PWM with the controller. Have looked into it ourselves though.
All sounds good, but you can't read in PWM with the controller. Have looked into it ourselves though.
You can read a PWM signal, but it's a little tricky. You'll need to use one interrupt pin and a timer. When the input signal goes high, that'll trigger an interrupt. Start the timer. When the input signal goes low, that'll trigger another interrupt. Stop the timer. The PWM value is the timer value. Of course, you'll have to make sure you choose appropriate values for the timer. The PWM signal will give you a high bit that ranges from approximately 1.0 ms to 2.0 ms.
On the other hand, if you don't actually care what the value of the PWM signal is, you just want to "copy" it to an output PWM signal, you could just have an interrupt on the input PWM signal, and toggle your output pin. You would not need to use a timer at all.
The only difference between a heading hold gyro and the regular gyro they give us in the kit is that in the Heading hold Gyro there is a separate chip (of which I know nothing about) that interprets the input from the driver/flyer.
I’m not sure if it would work with the FRC controller, but if it doesn’t than you can do the same thing with the kit gyro and some creative code.
seanwitte
16-01-2008, 10:36
The only difference between a heading hold gyro and the regular gyro they give us in the kit is that in the Heading hold Gyro there is a separate chip (of which I know nothing about) that interprets the input from the driver/flyer.
I’m not sure if it would work with the FRC controller, but if it doesn’t than you can do the same thing with the kit gyro and some creative code.
Yes, that's true. My point was that you can offload that processing and not deal with it at all. It would be straight-forward to use an edge triggered interrupt and a timer to measure the pulse width of the input PWM signal. What I don't know is how well those units are suited to driving a robot.
Alan Anderson
16-01-2008, 11:23
I’m not sure if it would work with the FRC controller, but if it doesn’t than you can do the same thing with the kit gyro and some creative code.
The basic framework for such code is already available from Kevin Watson (http://www.kevin.org/frc/frc_gyro.zip). You'd just have to add the part that applies control to the drivebase motors based on the measured heading.
AdamHeard
16-01-2008, 12:49
I've used them in battlebots before and they work amazingly.
But, to make them work within the rules of FIRST it requires more complex code than just using a gyro + Kevin's code. I was looking into it in 2005 when we last used a gyro.
All sounds good, but you can't read in PWM with the controller. Have looked into it ourselves though.
If the frequency is all that is needed you can use an frequency to voltage converter. Then all you would need to do is read the value off an ADC.
vBulletin® v3.6.4, Copyright ©2000-2017, Jelsoft Enterprises Ltd.