Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | Related Pages

ArAnalogGyro Class Reference

Gyro plugin for the analog devices gyro. More...

#include <ArAnalogGyro.h>

List of all members.

Public Member Functions

void activate (void)
 Lets the gyro correct readings.
 ArAnalogGyro (ArRobot *robot)
 Constructor.
void deactivate (void)
 Stops the gyro from correcting readings (still accumulates).
double encoderCorrect (ArPoseWithTime deltaPose)
 internal function for correcting the encoder readings with the gyro data
double getAverage (void) const
 Gets the average value.
ArTime getAverageTaken (void) const
 Gets the time the last average was taken.
double getHeading (void) const
 Gets the heading the gyro thinks.
int getPacCount (void)
 Returns the number of readings taken in the last second.
double getScalingFactor (void) const
 Gets the scaling factor used for multiplying the readings (default 1.626).
int getTemperature (void) const
 Gets the temperature the gyro has.
bool handleGyroPacket (ArRobotPacket *packet)
 Internal packet handler for the gyro packets.
bool haveGottenData (void)
 Gets if we really have a gyro or not.
bool isActive (void)
 Gets if we really have a gyro or not.
void setFilterModel (double gyroSigma, double inertialVar, double rotVar, double transVar)
 Set the kalman filter model.
void setLogAnomalies (bool logAnomalies)
 Sets whether we log anomalies or not (temporary function for debugging).
void setScalingFactor (double factor)
 Sets the scaling factor used for multiplying the readings.
void stabilizingCallback (void)
 Internal connection callback.
virtual ~ArAnalogGyro ()
 Destructor.

Protected Attributes

double myAccumulatedDelta
int myAverageCount
ArTime myAverageStarted
double myAverageTotal
ArRetFunctor1C< double, ArAnalogGyro,
ArPoseWithTime
myEncoderCorrectCB
double myGyroSigma
ArRetFunctor1C< bool, ArAnalogGyro,
ArRobotPacket * > 
myHandleGyroPacketCB
bool myHaveGottenData
double myHeading
double myInertialVarianceModel
bool myIsActive
double myLastAverage
ArTime myLastAverageTaken
double myLastHeading
bool myLogAnomalies
int myPacCount
int myPacCurrentCount
bool myReadingThisCycle
ArRobotmyRobot
double myRotVarianceModel
double myScalingFactor
ArFunctorC< ArAnalogGyromyStabilizingCB
int myTemperature
time_t myTimeLastPacket
double myTransVarianceModel


Detailed Description

Gyro plugin for the analog devices gyro.

The gyro is an accessory connected to the robot's microcontroller. The gyro's purpose is to correct for large errors due to wheel slippage, wheels coming off the ground, and other factors like this (or for the skid steer of an AT). The readings come back from the gyro over the robot's analog ports. The microcontroller then packages up the readings and sends the readings to us just before sending us the standard packet. We use these analog readings to calculate the heading of the robot (integrating the velocities to give position). Then when the standard packet comes in it calls our encoder correction callback which does a simple kalman filter and fuses the encoder information's heading with the gyro's heading to compute the most probable heading which it then returns and the ArRobot object uses as its heading.

The robot's dead reconing angle is fairly good if you have properly inflated tires (if you have pneumatic tires) and if you have revcount sent correctly. You can look at the operation manual to see how to change the revcount.

For the gyro, the reading changes based on temperature (both the readings and temperature are reported in the packets from the microcontroller). The gyro here will auto calibrate itself to the center of the range (which is what drifts with temperature) whenever the robot is still for a second (judged by if its translational and rotational velocities are less than 1 the whole time and if the gyro readings are within .5% of the average). The scaling factor (between change of voltage and amount of turn) didn't seem to change between temperatures, though it is a little different per gyro. This scaling factor is what you can get and set with getScalingFactor and setScalingFactor. The default was within 3% of correct most of the time. The default resides in the parameter file for the robot that is loaded or used when a connection is made. If you want to tune this more you can, by finding a different scale factor. There is just one so there doesn't have to be alot of calibration in flash that is lost if parameters are loaded from a file. The function of the gyro is to correct for wheel slippage and large errors, not to totally correct for all errors, but to bring the errors into smaller zones that software can correct for more easily (such as by localization). With gyros and inertials that try to correct for all errors they wind up not very robust and with built in assumptions. This is why we've gone with just integrating this gyro as opposed to someone elses inertial (we used to use one, which is when we figured out the trouble with them).

If you create one of these objects it'll add itself to the robot, if you delete it, it will remove itself from the robot. There is one added in examples/demo.cpp. Other examples of use are in examples/gyroExample.cpp and examples/gyroDrive.cpp.

Definition at line 89 of file ArAnalogGyro.h.


Member Function Documentation

void ArAnalogGyro::setFilterModel double  gyroSigma,
double  inertialVar,
double  rotVar,
double  transVar
[inline]
 

Set the kalman filter model.

Parameters:
gyroSigma the amount its off statically
inertialVar the proportional amount it is off
rotVar the amount the rotation is off proportionally
transVar the amount the translation throws off the heading proportionally

Definition at line 119 of file ArAnalogGyro.h.


The documentation for this class was generated from the following files:
Generated on Wed Oct 19 12:56:43 2005 for Aria by  doxygen 1.4.0