View unanswered posts | View active topics It is currently Tue Oct 21, 2014 12:50 pm






Reply to topic  [ 42 posts ]  Go to page Previous  1, 2, 3
Gyro Senosr 
Author Message
Guru
User avatar

Joined: Sun Nov 15, 2009 5:46 am
Posts: 1347
Post 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.


Fri Dec 21, 2012 4:56 am
Profile
Rookie

Joined: Mon Sep 24, 2012 8:32 am
Posts: 13
Post 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.


Sun Dec 23, 2012 3:58 am
Profile
Rookie

Joined: Mon Sep 24, 2012 8:32 am
Posts: 13
Post 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.


Wed Dec 26, 2012 9:04 am
Profile
Guru
User avatar

Joined: Sun Nov 15, 2009 5:46 am
Posts: 1347
Post 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


Wed Dec 26, 2012 1:38 pm
Profile
Rookie

Joined: Mon Sep 24, 2012 8:32 am
Posts: 13
Post 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?


Wed Dec 26, 2012 2:20 pm
Profile
Guru
User avatar

Joined: Sun Nov 15, 2009 5:46 am
Posts: 1347
Post 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);
   }
}


Wed Dec 26, 2012 3:09 pm
Profile
Rookie

Joined: Mon Sep 24, 2012 8:32 am
Posts: 13
Post 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.


Wed Dec 26, 2012 4:32 pm
Profile
Guru
User avatar

Joined: Sun Nov 15, 2009 5:46 am
Posts: 1347
Post 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);
   }
}


Wed Dec 26, 2012 5:38 pm
Profile
Guru
User avatar

Joined: Sun Nov 15, 2009 5:46 am
Posts: 1347
Post 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.


Wed Dec 26, 2012 10:58 pm
Profile
Rookie

Joined: Mon Sep 24, 2012 8:32 am
Posts: 13
Post 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.


Thu Dec 27, 2012 6:55 am
Profile
Rookie

Joined: Mon Sep 24, 2012 8:32 am
Posts: 13
Post 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.


Thu Dec 27, 2012 6:55 am
Profile
Guru
User avatar

Joined: Sun Nov 15, 2009 5:46 am
Posts: 1347
Post 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.


Thu Dec 27, 2012 1:58 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 42 posts ]  Go to page Previous  1, 2, 3

Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  



Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.