Go to Post Seriously, when I grow up (or if I grow up) I want to be just like Al. - Paul Copioli [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #9   Spotlight this post!  
Unread 24-02-2008, 22:52
Guarana Guarana is offline
Registered User
FRC #1706
 
Join Date: Jan 2008
Location: Wentzville, Missouri
Posts: 16
Guarana is an unknown quantity at this point
Re: gyro problem

Code:
	signed int speed, turn, slide;
	signed int front_r, front_l, back_r, back_l;
	long int l_y, r_y, l_x, r_x;
	static unsigned int i = 0;
	static unsigned int j = 0;
	int temp_gyro_rate;
	long temp_gyro_angle;
	int temp_gyro_bias;
	long temp_gyro_angle_fast;
	long Encoder_Count;

	i++;
	j++; // this will rollover every ~1000 seconds


	// enable this block of code to test your gyro 
	if(j == 10)
	{
		printf("\r\nCalculating Gyro Bias...\r\n");
	}
	if(j == 38) // let the gyro stablize for a second before starting a calibration
	{
		// start a gyro bias calculation
		Start_Gyro_Bias_Calc();
	}
	if(j == 191) // allow calibration routine to run for four seconds 
	{
		// terminate the gyro bias calculation
		Stop_Gyro_Bias_Calc();

		// reset the gyro heading angle
		Reset_Gyro_Angle();

		temp_gyro_bias = Get_Gyro_Bias();
		printf("Gyro Bias=%d\r\n", temp_gyro_bias);
	}
	if(i == 35 && j >= 191)
	{
		temp_gyro_rate = Get_Gyro_Rate();
		temp_gyro_angle = Get_Gyro_Angle();
		printf("Gyro Rate=%d\r\n", temp_gyro_rate);
		printf("Gyro Angle=%d\r\n\r\n", (int)temp_gyro_angle);
Here is the gyro calibration code. Is there anything wrong with this? Something I noticed, is that i and j both add one for each loop. So how does i = 35 and j be higher than 191 if they are always the same (for the last section). maybe i am missing something. would that be any reason?
 


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem with gyro... capenga Programming 21 16-02-2006 19:25
Gyro not accurate - Problem naor52 Programming 15 27-01-2006 16:50
Gyro code problem AMIRAM Programming 10 23-01-2006 04:26
Gyro magical hands Programming 2 14-01-2005 20:57


All times are GMT -5. The time now is 17:35.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi