Go to Post I may be right or wrong but I’ll be happily senile doing it. - ebarker [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

 
Closed Thread
 
Thread Tools Rating: Thread Rating: 3 votes, 4.67 average. Display Modes
  #1   Spotlight this post!  
Unread 08-02-2005, 10:44
marccenter's Avatar
marccenter marccenter is offline
Registered User
FRC #3548 (RoboRavens2)
Team Role: Coach
 
Join Date: Sep 2004
Rookie Year: 2004
Location: Royal Oak
Posts: 406
marccenter has a spectacular aura aboutmarccenter has a spectacular aura about
Smile Re: FRC/Kevin 01/30/05 Gyro code Operational - Team 1286

Quote:
Originally Posted by Kevin Watson

How far from zero is it?

-Kevin
Kevin, downloaded your new 01/30/05 code and everything seems to work right now. Bias was 32382. (512 * 64 samples per update = 32768)
32768(2.5 volts) -32282(Bias)=486. 486/64 = 7.59 a/d counts * 5 mV/count = 38 mV above 2.50. Null bias should equal 2.538 volts. Verfied with DVM. Hooray!
Sampling rate was 1600 Hz, samples per update
rate set to 64, ADXRS300EB utilized, #define TENTHS__OF_A_DEGREE.
#define GYRO_CAL_FACTOR = 1000/1000 (no change).

Simple 180 degree spin test executed. Learn bias at 0 degrees, verify
for 4/5 readings on terminal that angle = 0 degrees. Next, spun gyro 180 degrees - reading about 900 counts (90 degrees * 10 counts/degree).
Return to 0 degree position - read 0 counts (plus/minus 30 - remember,
very coarse test).

Next, tried the GEI GYROCHIP AQRS_00075. Changed the #define GYROCHIP_75 at top of gyro.h. Same spin test gave similiar results. Spun
360 degrees and back - similiar results. Sampling rate 1600 Hz, samples per update rate equal 64, #define TENTHS_OF_A_DEGREE, #define GYRO_CAL_FACTOR = 1000/1000 (no change).



Quote:
Originally Posted by Kevin Watson

Yes, just for grins, run the sampling rate up to 1600Hz and change the samples per update to 32 and try again.

-Kevin
Kevin,
Did you work some new magic in the new 01/30/05 software release, or do
you think the 1600 Hz, samples = 64 is what made this work? I did not
have time last night to experiment with various settings. I tried the
01/22/05 software and found my head bloody from beating it against the
wall to make it work. BTW, thanks for responding to previous e-mail and
publishing 01/30/05 release.
__________________
Marc Center
FIRST FRC Mentor/Coach - Team 3548 Royal Oak RoboRavens#2 - on Sabbatical 2017 season
marc.center@gmail.com
Mobile: 248-255-7377
  #2   Spotlight this post!  
Unread 08-02-2005, 12:34
Kevin Watson's Avatar
Kevin Watson Kevin Watson is offline
La Cañada High School
FRC #2429
Team Role: Mentor
 
Join Date: Jan 2002
Rookie Year: 2001
Location: La Cañada, California
Posts: 1,335
Kevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond repute
Re: FRC/Kevin 01/30/05 Gyro code Operational - Team 1286

Quote:
Originally Posted by marccenter
Did you work some new magic in the new 01/30/05 software release...
No, not really. In the earlier code/readme.txt, I documented a way to integrate the bias over a longer period of time and then set the bias using Set_Gyro_Bias(). The latest code just automates this process. The real magic will come when I get a Kalman Filter integrated into the code.


Quote:
Originally Posted by marccenter
...or do you think the 1600 Hz, samples = 64 is what made this work?
Probably both. The new code, out-of-the-box, does a much better job of calculating the bias. Sampling at a higher frequency and down sampling with more samples also helps. I'd advise setting the sample rate to be as low as possible while still getting the performance you need.

-Kevin
__________________
Kevin Watson
Engineer at stealth-mode startup
http://kevin.org
  #3   Spotlight this post!  
Unread 09-02-2005, 10:54
neilsonster's Avatar
neilsonster neilsonster is offline
Registered User
AKA: Andrew Neilson
FRC #0772 (Sabre Bytes)
Team Role: College Student
 
Join Date: Jan 2005
Rookie Year: 2005
Location: Waterloo, ON, Canada
Posts: 188
neilsonster is a name known to allneilsonster is a name known to allneilsonster is a name known to allneilsonster is a name known to allneilsonster is a name known to allneilsonster is a name known to all
Send a message via MSN to neilsonster
Re: Example gyro code released.

Hi, I just wanted to let you know we implemented your code with the ADXRS300EB last weekend and it has been performing *perfectly* all week. Thanks for the excellent work . Now the camera is another story....
  #4   Spotlight this post!  
Unread 09-02-2005, 11:28
Kevin Watson's Avatar
Kevin Watson Kevin Watson is offline
La Cañada High School
FRC #2429
Team Role: Mentor
 
Join Date: Jan 2002
Rookie Year: 2001
Location: La Cañada, California
Posts: 1,335
Kevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond repute
Re: Example gyro code released.

Quote:
Originally Posted by neilsonster
Hi, I just wanted to let you know we implemented your code with the ADXRS300EB last weekend and it has been performing *perfectly* all week. Thanks for the excellent work .
Cool!


Quote:
Originally Posted by neilsonster
Now the camera is another story....
Well, as Nietzsche said: That which does not kill us, makes us stronger <grin>.

-Kevin
__________________
Kevin Watson
Engineer at stealth-mode startup
http://kevin.org
  #5   Spotlight this post!  
Unread 09-02-2005, 11:35
Mark McLeod's Avatar
Mark McLeod Mark McLeod is offline
Just Itinerant
AKA: Hey dad...Father...MARK
FRC #0358 (Robotic Eagles)
Team Role: Engineer
 
Join Date: Mar 2003
Rookie Year: 2002
Location: Hauppauge, Long Island, NY
Posts: 8,782
Mark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond repute
Re: Example gyro code released.

Quote:
Originally Posted by Kevin Watson
Well, as Nietzsche said: That which does not kill us, makes us stronger <grin>.
Isn't Nietzsche dead?
__________________
"Rationality is our distinguishing characteristic - it's what sets us apart from the beasts." - Aristotle
  #6   Spotlight this post!  
Unread 09-02-2005, 11:40
Kevin Watson's Avatar
Kevin Watson Kevin Watson is offline
La Cañada High School
FRC #2429
Team Role: Mentor
 
Join Date: Jan 2002
Rookie Year: 2001
Location: La Cañada, California
Posts: 1,335
Kevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond repute
Re: Example gyro code released.

Quote:
Originally Posted by Mark McLeod
Isn't Nietzsche dead?
Yeah, but I doubt it was the camera that did him in <grin>.

-Kevin
__________________
Kevin Watson
Engineer at stealth-mode startup
http://kevin.org
  #7   Spotlight this post!  
Unread 09-02-2005, 20:30
ak_Knight ak_Knight is offline
Gee
#1219 (Iron Eagles)
 
Join Date: Jan 2004
Location: Toronto
Posts: 5
ak_Knight is on a distinguished road
Re: Example gyro code released.

Hi,
i used your gyro code with a ADXRS300. The user_routines.c executes pretty good, the gyro bias is mostly stable there is almost no change in angle. But the autonomous mode is giving us a lot of trouble. I am trying to accomplish two tasks, one give robot an angle and have to turn, like turn(90) and it should turn 90 degree, The other thing is being able to go in a straight line with out drifting. But after about 2-3 seconds in the autonomous i encounter an runtime error( the program state starts blinking red). Here is my user_routines_fast.c please take a look and help me out.

Quote:
void User_Autonomous_Code(void)
{
/* Initialize all PWMs and Relays when entering Autonomous mode, or else it
will be stuck with the last values mapped from the joysticks. Remember,
even when Disabled it is reading inputs from the Operator Interface.
*/
pwm01 = pwm02 = pwm03 = pwm04 = pwm05 = pwm06 = pwm07 = pwm08 = 127;
pwm09 = pwm10 = pwm11 = pwm12 = pwm13 = pwm14 = pwm15 = pwm16 = 127;
relay1_fwd = relay1_rev = relay2_fwd = relay2_rev = 0;
relay3_fwd = relay3_rev = relay4_fwd = relay4_rev = 0;
relay5_fwd = relay5_rev = relay6_fwd = relay6_rev = 0;
relay7_fwd = relay7_rev = relay8_fwd = relay8_rev = 0;

while (autonomous_mode) /* DO NOT CHANGE! */
{
if (statusflag.NEW_SPI_DATA) /* 26.2ms loop area */
{
Getdata(&rxdata); /* DO NOT DELETE, or you will be stuck here forever! */

/* Add your own autonomous code here. */

if (counter < sec(2) )
{
move_Forward();
}
else if( counter < sec(4) )
{
pause();
}
else
{
turn_Right(200);
}

counter++;

Generate_Pwms(pwm13,pwm14,pwm15,pwm16);

Putdata(&txdata); /* DO NOT DELETE, or you will get no PWM outputs! */
}
}
}

/************************************************** *****************************
* FUNCTION NAME: Process_Data_From_Local_IO
* PURPOSE: Execute user's realtime code.
* You should modify this routine by adding code which you wish to run fast.
* It will be executed every program loop, and not wait for fresh data
* from the Operator Interface.
* CALLED FROM: main.c
* ARGUMENTS: none
* RETURNS: void
************************************************** *****************************/
void Process_Data_From_Local_IO(void)
{
/* Add code here that you want to be executed every program loop. */

}

/************************************************** *****************************
* FUNCTION NAME: Serial_Char_Callback
* PURPOSE: Interrupt handler for the TTL_PORT.
* CALLED FROM: user_SerialDrv.c
* ARGUMENTS:
* Argument Type IO Description
* -------- ---- -- -----------
* data unsigned char I Data received from the TTL_PORT
* RETURNS: void
************************************************** *****************************/

void Serial_Char_Callback(unsigned char data)
{
/* Add code to handle incomming data (remember, interrupts are still active) */
}



/************************************************** ****************************
/USER FUNCTIONS/
************************************************** ****************************/


/************************************************** ****************************
* FUNCTION NAME: move_Forward, move_Backward, pause
* PURPOSE: Routine handling (name speaks for it self)
* CALLED FROM: user_routines_fast.c
* ARGUMENTS: none
* RETURNS: none
************************************************** ****************************/
void move_Forward(void)
{
set_Right(160);
set_Left(94);
}

void move_Backward(void)
{
set_Right(94);
set_Left(160);
}

void pause(void)
{
set_Right(127);
set_Left(127);
}

void set_Right(int value)
{
pwm13=value;
pwm14=value;
}

void set_Left(int value)
{
pwm15=value;
pwm16=value;
}

/************************************************** ****************************
* FUNCTION NAME: sec
* PURPOSE: Handles the program loop so that we work in terms of seconds.
* CALLED FROM: user_routines_fast.c
* ARGUMENTS:
* Argument Type Description
* -------- ---- -----------
* number_of_seconds int The amount of seconds to be converted
* RETURNS: INT
************************************************** ****************************/
int sec( int number_of_seconds)
{
return number_of_seconds*38;
}




void turn_Right(int angle)
{

int temp_gyro_rate= Get_Gyro_Rate();
int temp_gyro_bias= Get_Gyro_Bias();
int temp_gyro_angle = (int)Get_Gyro_Angle();

if ( ((int)Get_Gyro_Rate) > angle)
{
Reset_Gyro_Angle();
}

while( temp_gyro_angle < angle )
{
set_Right(160);
set_Left(127);

temp_gyro_rate= Get_Gyro_Rate();
temp_gyro_bias= Get_Gyro_Bias();
temp_gyro_angle = (int)Get_Gyro_Angle();

printf("Gyro Bias=%d\r", temp_gyro_bias);
printf("Gyro Rate=%d\r", temp_gyro_rate);
printf("Gyro Angle=%d\r", temp_gyro_angle);
printf("Gyro Required Angle=%d\r", angle);
printf("--------------%d\r");

}
}
__________________
<--Gee-->
Emery Robotics
  #8   Spotlight this post!  
Unread 10-02-2005, 12:57
marccenter's Avatar
marccenter marccenter is offline
Registered User
FRC #3548 (RoboRavens2)
Team Role: Coach
 
Join Date: Sep 2004
Rookie Year: 2004
Location: Royal Oak
Posts: 406
marccenter has a spectacular aura aboutmarccenter has a spectacular aura about
Unhappy Re: Gyro problems - again - Team 1286

Kevin,
I tried working last night with all three gyros and none worked
like the last time. So, first time was bad. Second time was like
a good dream. Third time was bad again.

Gryo angle had drift and bias reported unusual numbers. Voltmeter
on output agreed with gyro angle drift output. I can't remember
the number right now (like 3.0 volts). At one point I measured
a solid 4.98 volts powering one of the gyro's over the PWM
cable.

Same laptop. software, gyros, FRC controller -- the works.

Has there been any reported FRC_Board sensitivity to electical noise
like issues? Should I be extra careful with noise sources? Should
I get away from using A/d channel 01?

I didn't have any caps to place on output to see if that would help
to stabilize the gyro output. Will all three gyros flaky performance,
however, I am leaning away from viewing the gyro's as the problem
but the FRC controller.

Have you tried same software on multiple platforms yourself and/or
seen strange problems like this on FRC controllers?

I hope some of the high school student's end up reading this thread
so that they can see how difficult it can be to make what seems to
be something simple work properly.
__________________
Marc Center
FIRST FRC Mentor/Coach - Team 3548 Royal Oak RoboRavens#2 - on Sabbatical 2017 season
marc.center@gmail.com
Mobile: 248-255-7377
  #9   Spotlight this post!  
Unread 15-02-2005, 15:35
marccenter's Avatar
marccenter marccenter is offline
Registered User
FRC #3548 (RoboRavens2)
Team Role: Coach
 
Join Date: Sep 2004
Rookie Year: 2004
Location: Royal Oak
Posts: 406
marccenter has a spectacular aura aboutmarccenter has a spectacular aura about
Talking Re: Gyro problems - again - Team 1286

Follow up to previous message.

I went home to try the gyro software on a new controller.
So, same software, gyro, different FRC controller.
Gyro operational again. Rotate 180 degrees and get
1800 on display. Return slowly to 0 degrees, get
0 on display. No gyro drift.

I suspect some funny issues with the FRC controller
that we are using in our old robot. When I get a chance,
I will power up the 2005 FRC controller and see what
happens with the gyro.

I will continue to explore different angles as to the reason
for the differing results and update this message accordingly.
__________________
Marc Center
FIRST FRC Mentor/Coach - Team 3548 Royal Oak RoboRavens#2 - on Sabbatical 2017 season
marc.center@gmail.com
Mobile: 248-255-7377
  #10   Spotlight this post!  
Unread 17-03-2005, 18:32
Code\\Pilot Code\\Pilot is offline
< Only smart people see my avatar
AKA: Rafael Estrada
FRC #1065 (Tatsu)
Team Role: Programmer
 
Join Date: Jan 2004
Rookie Year: 2004
Location: Florida
Posts: 53
Code\\Pilot is an unknown quantity at this point
Send a message via AIM to Code\\Pilot Send a message via MSN to Code\\Pilot
Re: Gyro problems - again - Team 1286

This may seem like a weird question, but oh well... How do you wire the BEI AQRS-0075-FIRST gyrochip?
I read the readme but it only gives instructions for wiring other gyros. I suppose you need to wire the white cable to rate out pin1, the ground black wire to common pin2, and the red wire to +5 VDC input pin3. I think that is how it goes, but i just want to make sure is right before i blow something out. Any quick reply will be greatly appreciated.
Thanks.
__________________
Join the Red revolution, give me some RED rep!!!!
if it doesn't work, don't force it. Go get a bigger hammer.

int run = 0;
int robot_chasing_you = 1;

if (robot_chasing_you)
{
run = 254;
}

I got 48 Gmail invites left, pm me with your e-mail so i can send you one.
Closed Thread


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
Sourceforge for Code Repository and other stuff SilverStar Programming 9 15-01-2005 21:16
heres the code. y this not working omega Programming 16 31-03-2004 15:18
Wierd gyro code problems...pls help Salik Syed Programming 4 14-03-2004 01:29
Infrared Beacon and Sensor Diagnostics Code Released Kevin Watson Programming 3 25-02-2004 17:50
gyro code odin892 Programming 2 08-04-2003 14:50


All times are GMT -5. The time now is 16:53.

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