Go to Post ROBUST, ROBUST and ROBUST if you want to win - dan 322 [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
  #16   Spotlight this post!  
Unread 01-03-2004, 20:25
Steve Horton Steve Horton is offline
Registered User
#1180 (Atomsmashers)
Team Role: Teacher
 
Join Date: Mar 2004
Location: Savannah, Ga.
Posts: 3
Steve Horton is an unknown quantity at this point
Re: How do u get your robot to follow the white line??????????????????

Quote:
Originally Posted by Astronouth7303
Since the RC this year is about a jillion times faster, start going full speed and ratchet down the code if it doesn't work. All'a yous are still in the mindset of Slow, Tiny, and can't do squat.

For turning, us either 0:254 or 191:254. That way, you still go forward while turning.
I don't believe you or Ken or Phil above. I'd like to see you guys post some code to prove what you're doing......................
  #17   Spotlight this post!  
Unread 01-03-2004, 21:00
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: How do u get your robot to follow the white line??????????????????

Quote:
Originally Posted by Astronouth7303
Since the RC this year is about a jillion times faster, start going full speed and ratchet down the code if it doesn't work. All'a yous are still in the mindset of Slow, Tiny, and can't do squat.

For turning, us either 0:254 or 191:254. That way, you still go forward while turning.
its not a question of how fast the SW is running - last year the loop ran at 38Hz, same as this year and it was plenty fast

the problem with line following with only 2 or 3 sensors is you only have a gross idea of where the line is, its either this way or that way - you cant be sure how far

and the bot is relatively big and heavy, making it slow to turn and respond to commands - if you try to go too fast you end up overshooting the line and your bot will zigzag back and forth trying to track it

using a gyro sensor, by comparison, give you much greater information on how far off course you are, and you can implement a Proportional, Integral, Differential (PID) control loop to track your course and optimize it to stay tighly on the desired heading, no matter what your bot encounters along the way.

with the gyro, if you are a tiny bit off, you can apply a tiny bit of correction - if you are way off, you can apply a lot of correction - and everything inbetween is covered with very fine resolution.
  #18   Spotlight this post!  
Unread 01-03-2004, 23:10
Anthony Kesich's Avatar
Anthony Kesich Anthony Kesich is offline
Programmer Turned Engineer
AKA: SonKenshin
#1097 (Site 3 Engineernig)
Team Role: Leadership
 
Join Date: Jan 2003
Rookie Year: 2003
Location: Sacramento, CA
Posts: 186
Anthony Kesich has a spectacular aura aboutAnthony Kesich has a spectacular aura about
Send a message via AIM to Anthony Kesich
Re: How do u get your robot to follow the white line??????????????????

We decided to run with 6 sensors, 3 in front and 3 in back. That way we know whether to shift left or spin left or adjust left to different degrees. But thats just incase the IR dies completely. Otherwise, the two work in tandem. Nice to see but a real pain in the @$$ to program.

-Kesich
__________________
C is screwing up my English--I'm ending all my sentences in semi-colons;

Horray for most things! -George Carlin

"Sure, I'll play rugby. Besides, I have a lot of experience running from really big guys who want to cream me." -Me, Freshman year
  #19   Spotlight this post!  
Unread 02-03-2004, 16:05
Phil_Lutz's Avatar
Phil_Lutz Phil_Lutz is offline
Phil Lutz
#0851 (Froggers)
Team Role: Mentor
 
Join Date: Jan 2004
Location: El Segundo, CA
Posts: 67
Phil_Lutz is on a distinguished road
Send a message via Yahoo to Phil_Lutz
Re: How do u get your robot to follow the white line??????????????????

Quote:
Originally Posted by Steve Horton
I don't believe you or Ken or Phil above. I'd like to see you guys post some code to prove what you're doing......................
I don't like posting code, as it gives you the answer, instead, I would like you to have an understanding of the logic/process that is involved.

btw. I have emailed you.
  #20   Spotlight this post!  
Unread 02-03-2004, 20:25
Ryan M. Ryan M. is offline
Programming User
FRC #1317 (Digital Fusion)
Team Role: Programmer
 
Join Date: Jan 2004
Rookie Year: 2004
Location: Ohio
Posts: 1,508
Ryan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud of
Re: How do u get your robot to follow the white line??????????????????

Quote:
Originally Posted by Phil_Lutz
If you mount 3 sensors it's easier.
if left only sees, moved left "harder"
if left and center sees, move left "slightly"
if center only drive straight

same on the right.

too fast...(overran the line) what was the last sensor to see the line?
If left pivot left (right forward/left backward)
and versa visa.

We are counting the times we run off the line to determine where we are.

3 hard turns to re-aquire and we are there.

Phil
That is basically the same as what we are doing. It works almost every time. (if you line it up horribly unstraight with the line at the start it just sits there and jerks back and forth.)
__________________

  #21   Spotlight this post!  
Unread 03-03-2004, 16:44
Phil_Lutz's Avatar
Phil_Lutz Phil_Lutz is offline
Phil Lutz
#0851 (Froggers)
Team Role: Mentor
 
Join Date: Jan 2004
Location: El Segundo, CA
Posts: 67
Phil_Lutz is on a distinguished road
Send a message via Yahoo to Phil_Lutz
Re: How do u get your robot to follow the white line??????????????????

Quote:
Originally Posted by Texan
That is basically the same as what we are doing. It works almost every time. (if you line it up horribly unstraight with the line at the start it just sits there and jerks back and forth.)
During the scrimmage we attended one student aligned the robot at about a 45~ angle to the line. He was asked to align it he replied "It will be fine". The robot's first command turned out to be drive forward. it went off the line, spun to reaquire, crossed the line again at 90~ to the line spun hard again and crossed the line at about 45~. Total distance travelled in auto. 2 ft from the wall.


Ah youth.
  #22   Spotlight this post!  
Unread 03-03-2004, 17:26
deltacoder1020's Avatar
deltacoder1020 deltacoder1020 is offline
Computer Guy
AKA: Dav
#1020 (The Indiana Prank Monkeys)
Team Role: Programmer
 
Join Date: Jan 2004
Location: Muncie, Indiana
Posts: 340
deltacoder1020 has a spectacular aura aboutdeltacoder1020 has a spectacular aura about
Send a message via AIM to deltacoder1020
Re: How do u get your robot to follow the white line??????????????????

Quote:
Originally Posted by Phil_Lutz
During the scrimmage we attended one student aligned the robot at about a 45~ angle to the line. He was asked to align it he replied "It will be fine". The robot's first command turned out to be drive forward. it went off the line, spun to reaquire, crossed the line again at 90~ to the line spun hard again and crossed the line at about 45~. Total distance travelled in auto. 2 ft from the wall.


Ah youth.
this is why you always want to utilize the factors you can precisely control, such as the alignment. Human error just adds onto any error in a program, so try to get the best possible scenario for your program to run in.
__________________
Team 1020, the Indiana Prank Monkeys (www.team1020.org)
  #23   Spotlight this post!  
Unread 03-03-2004, 23:14
JBabbie's Avatar
JBabbie JBabbie is offline
Registered User
#0201
 
Join Date: Mar 2004
Location: Michigan
Posts: 10
JBabbie is on a distinguished road
Talking Re: How do u get your robot to follow the white line??????????????????

ok , you need 2 banner cells, one of the left or your bot (l_banner) . and one on the right (r_banner)

if ( l_banner == 1)
turn robot left 45 degrees ( run trial and error tets to find out how long it takes to turn your bot 45 degrees left)
if (r_banner == 1)
turn your robot right 45 degrees

so... if you had 4 wheel tank drive , and your left drive motors were pwm01 & pwm02 , and your right were pwm03 & pwm04. and run a counter ((int)count_me)
Code:
 if (l_banner == 1)
 {
 count_me ++ ; 
       if (count_me <=2)
         {
          pwm01 = pwm02 =  200; /* runs your left motors at a medium 
                                                speed forward */
          pwm03 = pwm04 = 75;   /*runs your right motors at a medium speed 
                                              reverse */
          }
      if(count_me >=3)
        {
         count_me = 0; /*resets the counter */
        }
}   
else  
if (r_banenr == 1)
 {
 count_me ++ ;
      if (count_me <= 2)
        {
         pwm01 = pwm 02 = 75; /*left motors run reverse */
         pwm03 = pwm04 = 200; /*left motors run forward */
        }
        if (count_me >= 3)
        {
        count_me = 0; /* resets the counter */
        }
}
else
 pwm01 = pwm02 = pwm03 = pwm04 = 255 ;  /*runs robot full forward */
keep in mind that the values I gave the motors and the counter are guesses , you might want to play with those on your own =), and also ... thats for a tank drive robot.. so if you use that.. keep your wheels pointed straight if you have swivel drive

fixed the indentation =)

Last edited by JBabbie : 04-03-2004 at 13:31. Reason: forgot part
  #24   Spotlight this post!  
Unread 03-03-2004, 23:57
deltacoder1020's Avatar
deltacoder1020 deltacoder1020 is offline
Computer Guy
AKA: Dav
#1020 (The Indiana Prank Monkeys)
Team Role: Programmer
 
Join Date: Jan 2004
Location: Muncie, Indiana
Posts: 340
deltacoder1020 has a spectacular aura aboutdeltacoder1020 has a spectacular aura about
Send a message via AIM to deltacoder1020
Re: How do u get your robot to follow the white line??????????????????

it will, you just need to use the CODE vB tag.
__________________
Team 1020, the Indiana Prank Monkeys (www.team1020.org)
  #25   Spotlight this post!  
Unread 04-03-2004, 10:29
Phil_Lutz's Avatar
Phil_Lutz Phil_Lutz is offline
Phil Lutz
#0851 (Froggers)
Team Role: Mentor
 
Join Date: Jan 2004
Location: El Segundo, CA
Posts: 67
Phil_Lutz is on a distinguished road
Send a message via Yahoo to Phil_Lutz
Re: How do u get your robot to follow the white line??????????????????

Use CODE in square brackets to start a code segment and /CODE in square brackets to stop the code segment.



Phil
  #26   Spotlight this post!  
Unread 04-03-2004, 19:49
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: How do u get your robot to follow the white line??????????????????

How do you get a heading using the Yaw rate sensors? is it really easy ? i would think u just keep a timer then multiply the reading from Gyro * TIME * TIME... also how do you turn the 0-254 value to something that is a actual value like m/s etc...or not?
but i heard that integrating causes a LOT of errors etc...
__________________
Team 701
  #27   Spotlight this post!  
Unread 04-03-2004, 19:59
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: How do u get your robot to follow the white line??????????????????

took me a minute to find this in another thread - this is the crash course in turning a yaw rate sensor into a compass heading - only difference this year is the analog in gives you a 10 bit number - I just did a ' >>2' to divide it by 4 (shift right twice) - 8 bits is plenty...

__________________________
last year we used the supplied yaw rate sensor to figure out our compass heading - you can do it with ONE line of code!

when the bot is not turning the output of the yaw rate sensor was 127 - when you turn in one direction the number goes up, the other, the number goes down (yaw rate sensor wired directly to analog input - no external circuits/filters or anything else)

start off with a 16 bit variable initialized to 32000. then somewhere in your code add the value of the sensor to that heading variable, and subtract 127 (to correct for zero being 127)

THATS IT! thats all it takes - as your bot turns in one direction, the heading variable will increase - as it turns the other way, it decreases. If you turn 180° right, then turn 180° left, it will go back to 32000

it works EXTREEMLY well - the errors tend to cancle themselves out - the only refinement you might want to add is to let the bot sit for minute while its not moving, and see if zero is 126, 127, 128... and use that as your zero offset.

with a little testing you can find out how many counts in the heading register is equal to 1 degree - turn the bot 90° right and read the register. but dont bother dividing the heading register by a constant to work in degrees - just use whatever units the register comes out to be - for example, if 32,000 is zero heading, maybe 45,153 will be +90° and so on.

thats all there is too it - since the SW loop runs at a consistant rate, simply adding the sensor signal to the variable is all you need to do to intergrate degrees/second into degrees!
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


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

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