ROBOTC.net forums
http://robotc.net/forums/

Gyro Senosr
http://robotc.net/forums/viewtopic.php?f=52&t=2804
Page 3 of 3

Author:  MHTS [ Fri Dec 21, 2012 4:56 am ]
Post subject:  Re: Gyro Senosr

We do have a gyro module in our FTC library. During initialization, it will determine the zero bias offset and noise margin. It has a GyroTask function that must be called periodically during which it does the integration for heading.
http://proj.titanrobotics.net/hg/Ftc/20 ... lib/gyro.h
To use this library module, you have to do the following:
1. Add an include line to include this library module
2. Declare the GYRO object as a global variable.
3. Call the GyroInit() function to initialize the GYRO object.
4. Call the GyroTask() function periodically in your robot loop.

Author:  zerroTC [ Sun Dec 23, 2012 3:58 am ]
Post subject:  Re: Gyro Senosr

MHTS wrote:
We do have a gyro module in our FTC library. During initialization, it will determine the zero bias offset and noise margin. It has a GyroTask function that must be called periodically during which it does the integration for heading.
http://proj.titanrobotics.net/hg/Ftc/20 ... lib/gyro.h
To use this library module, you have to do the following:
1. Add an include line to include this library module
2. Declare the GYRO object as a global variable.
3. Call the GyroInit() function to initialize the GYRO object.
4. Call the GyroTask() function periodically in your robot loop.

Thanks. I will try and put the feedback.

Author:  zerroTC [ Wed Dec 26, 2012 9:04 am ]
Post subject:  Re: Gyro Senosr

MHTS wrote:
We do have a gyro module in our FTC library. During initialization, it will determine the zero bias offset and noise margin. It has a GyroTask function that must be called periodically during which it does the integration for heading.
http://proj.titanrobotics.net/hg/Ftc/20 ... lib/gyro.h
To use this library module, you have to do the following:
1. Add an include line to include this library module
2. Declare the GYRO object as a global variable.
3. Call the GyroInit() function to initialize the GYRO object.
4. Call the GyroTask() function periodically in your robot loop.


Ok, I have problem with some procedures in yours header file.
For 1. procedure(TFuncName) i have this error:
**Error**:Undefined procedure 'TFuncName'.
**Error**:Too many parameters specified. Call to 'TFuncName'. Parameter: 'N/A' is '"GyroCal"' of type 'string'.

For 2. procedure(TLevel) i have this error:
**Error**:Undefined procedure 'TLevel'.
**Error**:Undefined variable 'API'. 'short' assumed.
**Error**:Too many parameters specified. Call to 'TLevel'. Parameter: 'N/A' is 'API' of type 'short'.

For last one(DEADBAND)i have this error:
**Error**:Undefined procedure 'DEADBAND'.
**Error**:Too many parameters specified. Call to 'DEADBAND'. Parameter: 'N/A' is 'gyro.turnRate' of type 'short'.


P.S. I understand what means this error, but i dont know were is the bodys of this procedures.
Thanks.

Author:  MHTS [ Wed Dec 26, 2012 1:38 pm ]
Post subject:  Re: Gyro Senosr

Sorry, forgot about those. Those are debug tracing macros. You can either delete them or include the following files in addition.
Code:
#include "dbgtrace.h"
#include "trcdefs.h"
#include "gyro.h"

You can find those here:
http://proj.titanrobotics.net/hg/Ftc/20 ... /trcdefs.h
http://proj.titanrobotics.net/hg/Ftc/20 ... dbgtrace.h

Author:  zerroTC [ Wed Dec 26, 2012 2:20 pm ]
Post subject:  Re: Gyro Senosr

MHTS wrote:
Sorry, forgot about those. Those are debug tracing macros. You can either delete them or include the following files in addition.
Code:
#include "dbgtrace.h"
#include "trcdefs.h"
#include "gyro.h"

You can find those here:
http://proj.titanrobotics.net/hg/Ftc/20 ... /trcdefs.h
http://proj.titanrobotics.net/hg/Ftc/20 ... dbgtrace.h

Thanks for information for solving the previus problem.

Anyway i have next problem, this is my code:
Code:
#include "gyro.h"
GYRO voziGyro;
task main()
{
   GyroInit(voziGyro,S3);
   while(true){
      GyroTask(voziGyro);   
      nxtDisplayCenteredBigTextLine(4, "%f.2",voziGyro.heading);
   wait1Msec(100);
   }
}

I have incrementation of degres.
Am I doing something wrong?

Author:  MHTS [ Wed Dec 26, 2012 3:09 pm ]
Post subject:  Re: Gyro Senosr

zerroTC wrote:
Anyway i have next problem, this is my code:
Code:
#include "gyro.h"
GYRO voziGyro;
task main()
{
   GyroInit(voziGyro,S3);
   while(true){
      GyroTask(voziGyro);   
      nxtDisplayCenteredBigTextLine(4, "%f.2",voziGyro.heading);
   wait1Msec(100);
   }
}

I have incrementation of degres.
Am I doing something wrong?

I am not sure I understand your problem. What do you mean by "I have incrementation of degres"? Would you describe your problem in more details?
In any case, I do spot some minor problems in your code (display text formatting). The correction is below:
Code:
#include "gyro.h"
GYRO voziGyro;
task main()
{
   GyroInit(voziGyro,S3);
   while(true){
      GyroTask(voziGyro);   
      nxtDisplayCenteredBigTextLine(4, "%6.1f",voziGyro.heading);
   wait1Msec(100);
   }
}

Author:  zerroTC [ Wed Dec 26, 2012 4:32 pm ]
Post subject:  Re: Gyro Senosr

Quote:
I am not sure I understand your problem. What do you mean by "I have incrementation of degres"? Would you describe your problem in more details?
In any case, I do spot some minor problems in your code (display text formatting). The correction is below:
Code:
#include "gyro.h"
GYRO voziGyro;
task main()
{
   GyroInit(voziGyro,S3);
   while(true){
      GyroTask(voziGyro);   
      nxtDisplayCenteredBigTextLine(4, "%6.1f",voziGyro.heading);
   wait1Msec(100);
   }
}

So, I get accumulated error degrees.
I do not touch the robot, and the degrees are incremented by themselves and i would say with great speed.

Author:  MHTS [ Wed Dec 26, 2012 5:38 pm ]
Post subject:  Re: Gyro Senosr

zerroTC wrote:
So, I get accumulated error degrees.
I do not touch the robot, and the degrees are incremented by themselves and i would say with great speed.

Make sure you did not touch the robot when it is "initializing". That's when it is calibrating the zero bias and noise level deadband. Also, you may want to print out the raw value from the gyro and see if it is outputting reasonable numbers. For example:
Code:
task main()
{
   GyroInit(voziGyro,S3);
   nxtDisplayTextLine(0, "ZeroOffset=%d", voziGyro.zeroOffset);
   nxtDisplayTextLine(1, "DeadBand=%d", voziGyro.deadBand);
   while(true){
      GyroTask(voziGyro);
      nxtDisplayTextLine(3, "RawValue=%d", SensorValue[S3]);
      nxtDisplayTextLine(4, "Heading=%6.1f",voziGyro.heading);
      wait1Msec(100);
   }
}

Author:  MHTS [ Wed Dec 26, 2012 10:58 pm ]
Post subject:  Re: Gyro Senosr

BTW, did you modify gyro.h or used it as is? If you have modified gyro.h, please tell me what you did. I want to make sure it is not due to the modification.

Author:  zerroTC [ Thu Dec 27, 2012 6:55 am ]
Post subject:  Re: Gyro Senosr

MHTS wrote:
BTW, did you modify gyro.h or used it as is? If you have modified gyro.h, please tell me what you did. I want to make sure it is not due to the modification.

Now everything is fine, becouse i include trcdefs.h file in gyro.h and the procedure DEADBAND is working.
I do not have incrementation of degres, but when i turn the robot from 0 degres to 90 degres and back again on 0 degres. I get sam "error" in degres eg. 3 degres instead of 0 degres.

Author:  zerroTC [ Thu Dec 27, 2012 6:55 am ]
Post subject:  Re: Gyro Senosr

zerroTC wrote:
MHTS wrote:
BTW, did you modify gyro.h or used it as is? If you have modified gyro.h, please tell me what you did. I want to make sure it is not due to the modification.

Thanks.
Now everything is fine, becouse i include trcdefs.h file in gyro.h and the procedure DEADBAND is working.
I do not have incrementation of degres, but when i turn the robot from 0 degres to 90 degres and back again on 0 degres. I get sam "error" in degres eg. 3 degres instead of 0 degres.

Author:  MHTS [ Thu Dec 27, 2012 1:58 pm ]
Post subject:  Re: Gyro Senosr

3 degrees is quite small. I consider it within tolerance. There are a number of reasons why you didn't get back to zero degree:
- It could be that your robot is really not back to zero degree quite precisely
- It could be that you are turning the robot too fast and exceeding the maximum degrees/sec of the gyro (not likely).
- It could be that your integration loop is not frequent enough. In your main robot loop, you have a wait1Msec(100) there (this is the likely reason). Try reducing it to 50 or even 20 and see if it improves.
Like I said, 3 degrees is not that significant. So I wouldn't worry about it too much.

Page 3 of 3 All times are UTC - 5 hours [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/