Log in

View Full Version : Gyro Heading always zero, yet operating?


marccenter
10-01-2008, 08:12
Can I get some help in determining why the gyro heading is always ZERO but the gyro counts change when I swing the device? I have captured screen shots into powerpoint and will zip them, then attach to this message.

TubaMorg
10-01-2008, 13:21
I had to look up the printTextToGD function call from WPLib.

void PrintTextToGD(unsigned char ucRow, unsigned char ucCol, unsigned long ulColor, rom const char *szText, ...);

Usually when we have a problem like yours, it is a typecast problem.
Other things to check:
Is your color valid?
Is your gyro type set correctly? You have the 300 deg/sec gyro?
What affect does the wait(200) have on your program? I always prefer to wrap my print statements in a if block for what you are trying to do:

if (time%$200 == 0)
{
printTextToGD.....
}

That way the program can continue to process gyro data, although WPLib documentation implies that sensor data is still processed during the wait.

artdutra04
10-01-2008, 14:26
Can I get some help in determining why the gyro heading is always ZERO but the gyro counts change when I swing the device? I have captured screen shots into powerpoint and will zip them, then attach to this message.It sounds like the sensor is recording the change (derivative) and not the elapsed angle (integral).

If you want to get the elapsed angle, you can just add/subtract the difference every time through the loop to keep track of the absolute angle. You may have to do some simple calculations to make the sensor value you are getting back correspond directly with degrees rotated.

marccenter
16-01-2008, 10:54
Hey guys, I finally got the gyro to work. It help's if you actually Start the thing.
Thread can be deleted, if desired by moderator. Thanks for CD help.