|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
|||
|
|||
|
Using the Gyro's "temp"?
While looking up documentation for wiring a gyro (specifically this one: http://frc-labs.com/wp-content/uploa...erometer1.jpg), many of the sources recommend using both rate and temp. However, while actually coding it doesn't seem that the Gyro class is able to use more than one analog port. Does anyone have any pointers for incorporating temp?
|
|
#2
|
||||
|
||||
|
Re: Using the Gyro's "temp"?
The output is wired up to the header, but I've never used it.
The Gyro class itself doesn't appear to have any way of taking in the temperature output of the sensor into account. But it does make an attempt at calibrating the sensor when the robot is turned on. It looks like it takes samples from the analog channel for 5 seconds on startup and uses these samples to determine the voltage value for a rate of rotation of zero. Quote:
The code we used for interfacing to the Gyro itself, boils down to the following: Code:
//Setup Gyro turnSense = new Gyro(RobotMap.gyroChannel); turnSense.setSensitivity(0.0070); resetAngle(); //Our auto mode code would perform a series of driving in straight // lines and turns to move around the field. //Before turning we would always zero out the gyro turnSense.reset(); //Then turn the robot while monitoring the current angle turnSense.getAngle(); You can see a video here. If you are set on making use of temperature compensation, I would suggest reading the application note from analog devices: http://www.analog.com/static/importe...es/AN-1049.pdf And this note in the datasheet may be of importance (page 9): Quote:
|
|
#3
|
||||||
|
||||||
|
Re: Using the Gyro's "temp"?
Quote:
|
|
#4
|
|||
|
|||
|
Re: Using the Gyro's "temp"?
I suppose what I meant was not that the temperature was "recommended for frc use" but rather that it was a standard part of the gyro's wiring. I'm not particularly set on using it, especially if most teams have found the gyro reliable without it.
|
|
#5
|
|||
|
|||
|
Re: Using the Gyro's "temp"?
My thought is to monitor it through a few matches and see if it is moving enough to be worth your effort. The effect I would be most concerned with is self-heating - can you see a difference between powering on the system from cold and rebooting the system after it has been on for a while?
|
|
#6
|
||||
|
||||
|
Re: Using the Gyro's "temp"?
Quote:
|
|
#7
|
|||
|
|||
|
Re: Using the Gyro's "temp"?
As others have mentioned the WPILib gyro class doesn't support temperature and most teams don't seem to use the temperature. They seem find just the gyro output calibrated from WPILib accurate enough. However, if you want to incorporate the temperature of the gyro, the best way to start is to look at the datasheet. If you look at the datatsheet[1] for your gyro, it should describe the relationship between temperature and the voltage reading. Then you can just copy the code of gyro class and create a custom class for a gyro with temperature correction that reads the temperature at calibration and uses that when calculating the angular rate. The biggest difficulty with this is that you can't do this and use the FPGAs hardware accumulator, which may make a bigger difference depending on your application.
[1] For the 2009 Gyro. Page 9: http://www.usfirst.org/uploadedFiles...%20Rev%20B.pdf |
|
#8
|
|||||
|
|||||
|
Re: Using the Gyro's "temp"?
Self heating is definitely a factor. If you read the yaw rate output voltage right after cold boot, and then read after it has been on for a few minutes, I guarantee you will see a difference. If you calibrate the gyro (which in WPIlib usually means calling the constructor for the gyro) as soon as the robot boots, but it takes ~5-10 minutes before the match begins, your gyro will be drifting quite a bit by the time you need it.
One way to deal with the effects of self heating would be to use the temperature input and derive a model that takes into account the effects of temperature on the yaw rate output. A far simpler way is to re-calibrate your gyro as close to the match start time as possible (this is easy to do if you make a couple of modifications to the WPIlib Gyro class - make the initGyro() method public and call it via button press from the Driver Station when you are in the Disabled state). |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|