Go to Post This isn't just a robot competition, it's not robots driving robots. It's people driving robots, and teams of people who have put a lot into making the robots work. - Gadget470 [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 Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 09-03-2004, 19:15
Salik Syed Salik Syed is offline
Registered User
FRC #0701 (RoboVikes)
Team Role: Alumni
 
Join Date: Jan 2003
Rookie Year: 2001
Location: Stanford CA.
Posts: 514
Salik Syed has much to be proud ofSalik Syed has much to be proud ofSalik Syed has much to be proud ofSalik Syed has much to be proud ofSalik Syed has much to be proud ofSalik Syed has much to be proud ofSalik Syed has much to be proud ofSalik Syed has much to be proud ofSalik Syed has much to be proud of
Send a message via AIM to Salik Syed
Question Wierd gyro code problems...pls help

Hi, i've coded a VERY simple code for a gyro ..... the gyro outputs 10bits so i shifted 2....but now the gyro stays at 135 even when not moving or being shaked etc... I can't figure out the problem...the gyro is working (we monitored voltage)

can you please read the code and help thank you
Code:
gyro1=rc_ana_in01;
2<<gyro1;
if(gyro1>136)
{
heading++;
}
if(gyro1<119)
{
heading=heading-1;
}


if(mode==1)
{

if(heading<turn+error) 
{
pwm01=184;
pwm02=70;
}
if(heading>turn-error)   //error is a tolerance!!!! i set it to 400
{
pwm01=70;
pwm02=184;
}
}

Thank You
Salik Syed Team 701
btw we are using the BEI gyro from 2k3 (we know...its not allowed...we'll get another gyro soon)
__________________
Team 701
  #2   Spotlight this post!  
Unread 09-03-2004, 19:23
KenWittlief KenWittlief is offline
.
no team
Team Role: Engineer
 
Join Date: Mar 2003
Location: Rochester, NY
Posts: 4,213
KenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond repute
Re: Wierd gyro code problems...pls help

you cant equate the gyro to the analog input - you have to use the Get_Analog_Value() function like this:

gyro1 = Get_Analog_Value( rc_ana_in01);

its detailed in the 2004 Programming Reference Manual from innovationfirst.com - page 16

and if you want to shift it down to 8 bits its the other way

gyro1 = gyro1>>2;

:^)
  #3   Spotlight this post!  
Unread 09-03-2004, 19:23
Joe Ross's Avatar Unsung FIRST Hero
Joe Ross Joe Ross is offline
Registered User
FRC #0330 (Beachbots)
Team Role: Engineer
 
Join Date: Jun 2001
Rookie Year: 1997
Location: Los Angeles, CA
Posts: 8,574
Joe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond repute
Re: Wierd gyro code problems...pls help

You will find your answer on page 16 of the 2004 Programming Reference guide, or in several other threads here on chiefdelphi.

edit: Ken beat me by seconds
  #4   Spotlight this post!  
Unread 09-03-2004, 21:24
Salik Syed Salik Syed is offline
Registered User
FRC #0701 (RoboVikes)
Team Role: Alumni
 
Join Date: Jan 2003
Rookie Year: 2001
Location: Stanford CA.
Posts: 514
Salik Syed has much to be proud ofSalik Syed has much to be proud ofSalik Syed has much to be proud ofSalik Syed has much to be proud ofSalik Syed has much to be proud ofSalik Syed has much to be proud ofSalik Syed has much to be proud ofSalik Syed has much to be proud ofSalik Syed has much to be proud of
Send a message via AIM to Salik Syed
Re: Wierd gyro code problems...pls help

haha ......lol i'm a noob.......thanx both of you

one more question........you know how it says : gyro1=>>gyro1 (or whatever) ..... will it shift every time the cycle loops.....like one loop it is 8 bit then 6 then 4????I hope not!....we have the shift in our program loop (outside of initilization) because we have to shift it after making it equal to the analog ....is that correct?
__________________
Team 701

Last edited by Salik Syed : 09-03-2004 at 21:28.
  #5   Spotlight this post!  
Unread 14-03-2004, 01:29
KenWittlief KenWittlief is offline
.
no team
Team Role: Engineer
 
Join Date: Mar 2003
Location: Rochester, NY
Posts: 4,213
KenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond repute
Re: Wierd gyro code problems...pls help

Quote:
Originally Posted by Salik Syed
haha ......lol i'm a noob.......thanx both of you

one more question........you know how it says : gyro1=>>gyro1 (or whatever) ..... will it shift every time the cycle loops.....like one loop it is 8 bit then 6 then 4????I hope not!....we have the shift in our program loop (outside of initilization) because we have to shift it after making it equal to the analog ....is that correct?
only if you stop reading it in with the Get_analog statement in each loop.

if you put shift right (gyro>>2) statements after each other, then yes, each statement will shift it right another two places

but in your code Im sure you are reading in new data on each loop, the old data is overwritten, so the new data is whats getting shifted.
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
IR reflective (tape) sensor code problems Argoth Programming 8 07-02-2004 21:32
problems assigning unsigned chars in FRC Code LoyolaCubs Programming 6 26-01-2004 23:21
ADC problems with C library and new code Larry Barello Programming 1 09-01-2004 22:31
gyro code odin892 Programming 2 08-04-2003 14:50
[white paper] Auto-Balance Gyro Code Brandon Martus Technical Discussion 3 21-06-2001 10:36


All times are GMT -5. The time now is 10:12.

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