Go to Post I have a pocket full of Gracious Professionalism! How about you? - Schnabel [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 19-02-2004, 15:06
MisterX's Avatar
MisterX MisterX is offline
Alumni
AKA: Mr. X
FRC #0521
Team Role: College Student
 
Join Date: Feb 2003
Rookie Year: 2000
Location: Around
Posts: 486
MisterX is a splendid one to beholdMisterX is a splendid one to beholdMisterX is a splendid one to beholdMisterX is a splendid one to beholdMisterX is a splendid one to beholdMisterX is a splendid one to behold
Thumbs down line seeking help needed

I have this and i know it works but i have 3 digital ins that are set as inputs
rc_dig_in01
rc_dig_in02
rc_dig_in03
they are all optical sensors, i know the optical sensors are working properly becuase i get on and off lights on the operator interface. I just cant seem to "word" the way to get all 3 sensors to work together.
roughly i want tit to work like this

if dig in 1 is on then it should turn left
if dig in 2 is on both motors should dturn equally
if dig in 3 is on then it should turn right

PWM01= left side drive
PWM02= right side drive

... but how do i get the sesors to all work together.
I cant seem to think on how to get them to all work together i tried a switch statement and stacking else if 's i just cant think of how to get it to work.

Code:
if (rc_dig_in02 == 1) {
    pwm01= 200;
    pwm02= 200; 
}
else {
    pwm01= 127;
    pwm02= 127;
}
  #2   Spotlight this post!  
Unread 19-02-2004, 16:04
jerry w's Avatar
jerry w jerry w is offline
Free Agent Mentor
no team (Team Krunch)
Team Role: Engineer
 
Join Date: Nov 2003
Rookie Year: 2002
Location: dunedin fl
Posts: 113
jerry w has much to be proud ofjerry w has much to be proud ofjerry w has much to be proud ofjerry w has much to be proud ofjerry w has much to be proud ofjerry w has much to be proud ofjerry w has much to be proud ofjerry w has much to be proud ofjerry w has much to be proud of
Re: line seeking help needed

Quote:
Originally Posted by MisterX
if dig in 1 is on then it should turn left
if dig in 2 is on both motors should dturn equally
if dig in 3 is on then it should turn right

PWM01= left side drive
PWM02= right side drive
i think what you are trying to do is

Code:
if (rc_dig_in01 == 1) ||  (rc_dig_in02 == 1) {
    pwm01= 200;
}
else {
    pwm01= 127;
}
if (rc_dig_in02 == 1) ||  (rc_dig_in03 == 1) {
    pwm02= 200;
}
else {
    pwm02= 127;
}
jerrw w
__________________
Happiest when people tell the truth... However, I am blessed with many friends.
  #3   Spotlight this post!  
Unread 19-02-2004, 16:16
kristen's Avatar
kristen kristen is offline
PI loves you!
#0639 (Code Red)
Team Role: Human Player
 
Join Date: Jan 2003
Location: Ithaca, NY
Posts: 283
kristen will become famous soon enough
Send a message via AIM to kristen
Re: line seeking help needed

Our head programmer suggested:

Code:
if (rc_dig_in02) {
	pwm01 = 200;
	pwm02 = 200;
} else if (rc_dig_in01) {
	pwm02 = 200;
	pwm01 = 127;
} else if (rc_dig_in03) {
	pwm02 = 127;
	pwm01 = 200;
}else {
        /* No line found.... */
}
  #4   Spotlight this post!  
Unread 19-02-2004, 16:20
MisterX's Avatar
MisterX MisterX is offline
Alumni
AKA: Mr. X
FRC #0521
Team Role: College Student
 
Join Date: Feb 2003
Rookie Year: 2000
Location: Around
Posts: 486
MisterX is a splendid one to beholdMisterX is a splendid one to beholdMisterX is a splendid one to beholdMisterX is a splendid one to beholdMisterX is a splendid one to beholdMisterX is a splendid one to behold
Re: line seeking help needed

Thank you both for your fast reply I will test both of those now and let you know when I get my results. THANK YOU SOOOOOOOO MUCH!!!! and best of luck to both of your teams.

Heres the code i ended up using:

Code:
if (rc_dig_in02) {
	pwm01 = 200;
	pwm02 = 200;
} else if (rc_dig_in01) {
	pwm02 = 200;
	pwm01 = 127;
} else if (rc_dig_in03) {
	pwm02 = 127;
	pwm01 = 200;
} else {
    pwm01= 127;
    pwm02= 127;
}
and it works perfectly thank you for your help

Last edited by MisterX : 19-02-2004 at 18:28.
  #5   Spotlight this post!  
Unread 20-02-2004, 10:12
Catastrophy Catastrophy is offline
Registered User
AKA: Vince
#0704
Team Role: Programmer
 
Join Date: Feb 2004
Location: Grand Prairie
Posts: 18
Catastrophy is an unknown quantity at this point
Send a message via AIM to Catastrophy Send a message via MSN to Catastrophy
Re: line seeking help needed

Hey Mister, just a suggestion, the more sensors you have on your robot for line following, the more accurate, and the faster you can run it. We're using 9 sensors and we can run at almost full speed with about a 95% of the time staying on the line.
  #6   Spotlight this post!  
Unread 20-02-2004, 10:18
MisterX's Avatar
MisterX MisterX is offline
Alumni
AKA: Mr. X
FRC #0521
Team Role: College Student
 
Join Date: Feb 2003
Rookie Year: 2000
Location: Around
Posts: 486
MisterX is a splendid one to beholdMisterX is a splendid one to beholdMisterX is a splendid one to beholdMisterX is a splendid one to beholdMisterX is a splendid one to beholdMisterX is a splendid one to behold
Re: line seeking help needed

Wowser, and to think originally some of my team wanted to only do two and we had to convince them three was better. Thanks for the information Catastrophy I'll probably try and work somethign like that during the offseason but right now with the little time we have left we will probably stick with three unless a miracle happens. Thanks for the info though, I would love to try something like that.


P.S. if you are at Nats do you think me and one of my other programmers could swing by your booth to check it out? P.M. me
  #7   Spotlight this post!  
Unread 20-02-2004, 16:56
Astronouth7303's Avatar
Astronouth7303 Astronouth7303 is offline
Why did I come back?
AKA: Jamie Bliss
FRC #4967 (That ONE Team)
Team Role: Mentor
 
Join Date: Jan 2004
Rookie Year: 2004
Location: Grand Rapids, MI
Posts: 2,071
Astronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud of
Re: line seeking help needed

I don't think 9 is necesary, but trim the positions of the sensors based on the width of the line. I think 5 would be good:
Code:
    |   |
1  2| 3 |4  5
    |   |
1,5- perimeter, just to make sure your bot doesn't get lost.
2,4- if these hit the line, turn that way.
_ 3- Keep this on the line.

ps-the code was just to get a fixed-width font.
  #8   Spotlight this post!  
Unread 20-02-2004, 19:00
Catastrophy Catastrophy is offline
Registered User
AKA: Vince
#0704
Team Role: Programmer
 
Join Date: Feb 2004
Location: Grand Prairie
Posts: 18
Catastrophy is an unknown quantity at this point
Send a message via AIM to Catastrophy Send a message via MSN to Catastrophy
Re: line seeking help needed

Heres a tip if your having problems staying on the line, make it go in reverse if no line is being read. Heres a picture of the temp configuration (gonna have a metal plate for final all neatly up under the hood. and holes in chasse for beam to get out.)) and a video of this year's sensors on last year's bot. The video is kinda bad example of how the code's working, the video is 15 sec, but it usually only take 7-11 seconds to get to the ball stand

http://home.comcast.net/~Catastrophy/picture.jpg
http://home.comcast.net/~Catastrophy/movie.avi

Here's the code tweaked for our bot if anyones interested.
Code:
		if (dig12 == 1 && dig18 == 1){
			pwm14=76; 
			pwm16=76; 
		}
		if (dig18 == 1 && dig1 == 1 &! dig12 == 1 &! dig6 == 1){
			pwm16=96;
			pwm14=115;
		} 
		if (dig18 == 1 &! dig1 == 1 &! dig12 == 1){
			pwm16=86;
			pwm14=115; 
		}
		if (dig1 == 1 &! dig18 == 1 &! dig6 == 1){
			pwm16=76; 
			pwm14=178; 
		}
		if (dig12 == 1 && dig4 == 1 &! dig18 == 1 &! dig10 == 1){
			pwm16=96; 
			pwm14=115; 
		}
		if (dig4 == 1 &! dig12 == 1 &! dig10 == 1){
			pwm16=178;
			pwm14=76; 
		}
		if (dig12 == 1 &! dig4 == 1 &! dig18 == 1){
			pwm16=115; 
			pwm14=86; 
		}
		if (dig1 == 0 && dig4 == 0 && dig12 == 0 && dig18 == 0 && dig8 == 0 && dig10 == 0 && dig6 == 0){
			pwm14=155;
			pwm16=155;
		}
		if (dig6 == 1 &! dig1 == 1){
			pwm14=204;
			pwm16=50;
		}	
		if (dig8 == 1){
			pwm14=127;
			pwm16=127;
		}
		if (dig10 == 1 &! dig4 == 1){
			pwm14=50;
			pwm16=204;
		}

Last edited by Catastrophy : 20-02-2004 at 20:04.
  #9   Spotlight this post!  
Unread 21-02-2004, 01:33
boostaddict boostaddict is offline
Registered User
#0069
 
Join Date: Feb 2003
Location: Quincy, MA
Posts: 8
boostaddict is an unknown quantity at this point
Re: line seeking help needed

for those that actually have this working on the 2004 bot, what times are you getting to track the complete line?
  #10   Spotlight this post!  
Unread 21-02-2004, 07:09
Jamie_Richard's Avatar
Jamie_Richard Jamie_Richard is offline
I'm IN - RIT HERE I COME
#0782 (The Kilowatts)
Team Role: Student
 
Join Date: Oct 2002
Location: Hartford, CT
Posts: 29
Jamie_Richard is an unknown quantity at this point
Send a message via AIM to Jamie_Richard
Re: line seeking help needed

This looks excellent, after sitting around looking out our programmers figure out nothing last night this is a breath of fresh air. I personally am not a programmer, but I am going to try to implement this tonight after the Suffield Scrimmage. We were using two sensors, and something didn't seem right about it, does anyone have any reccomendations, when using three sensor, on how to make the robot go backwards if its not seeing the line. I have a very limited knowledge of C, and I feel our programmers are uncomfortable with the platform this year. so...

If you guys can help me make this work, there will be Krispy Kreme's at Hartford (or Atlanta) for you, on me.

Thanks a Bunch!
Jamie
__________________
DOO-DOO-DOO - Team 7-8-2 will not be competing in the 2005 FIRST Season. Please make a note of it.
  #11   Spotlight this post!  
Unread 21-02-2004, 07:23
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: line seeking help needed

Quote:
Originally Posted by Jamie_Richard
This looks excellent, after sitting around looking out our programmers figure out nothing last night this is a breath of fresh air. I personally am not a programmer, but I am going to try to implement this tonight after the Suffield Scrimmage. We were using two sensors, and something didn't seem right about it, does anyone have any reccomendations, when using three sensor, on how to make the robot go backwards if its not seeing the line. I have a very limited knowledge of C, and I feel our programmers are uncomfortable with the platform this year. so...

If you guys can help me make this work, there will be Krispy Kreme's at Hartford (or Atlanta) for you, on me.

Thanks a Bunch!
Jamie
Catastrophy might have a more advanced solution, but basically, if you don't see the the line with any of your sensors, reverse. Something like this:
Code:
if(rc_dig_01 == 0 && rc_dig_02 == 0 && rc_dig_03 == 0)
{
   pwm01 = 0;
   pwm02 = 0;
}
You would, of course, have to add the code for actually following the line, but that is basically all you have to do to reverse if you don't see anything on the sensors.

PS the digital inputs are your sensors and the pwmXXs are the drive motors.

PPS Nine banners. Crazy.
__________________

  #12   Spotlight this post!  
Unread 21-02-2004, 08:04
Team1425's Avatar
Team1425 Team1425 is offline
Registered User
#1425 (Wilsonville Robotics)
 
Join Date: Jan 2004
Location: Wilsonville, OR
Posts: 10
Team1425 is an unknown quantity at this point
Re: line seeking help needed

Our team is actually going with two custom built analog sensors, we like analog because its not just a 1 or a 0, it brings back a range as it slides on and off the line, so you can actually program for it to follow a line quite fast with only one sensor as opposed to having 3 - ... 9 sensors

Our sensors have a potentiometer on each that allows us to adjust the sensitivity and they each have their own LED light, so they could even follow a line if it were in a dark room. (not that following lines in the dark is useful for the competition, but its something its capable of)
  #13   Spotlight this post!  
Unread 21-02-2004, 12:38
Catastrophy Catastrophy is offline
Registered User
AKA: Vince
#0704
Team Role: Programmer
 
Join Date: Feb 2004
Location: Grand Prairie
Posts: 18
Catastrophy is an unknown quantity at this point
Send a message via AIM to Catastrophy Send a message via MSN to Catastrophy
Re: line seeking help needed

If anyone has any questions on line following please feel free to PM me or IM, i'd be happy to help with what I can.

P.S. I extremely recommend using atleast 3 sensors for line following, with 2 the bot will not act right at all, will be very jittery.

P.P.S the more banner sensors you have the better it will work. I've learned from personal experience.

Last edited by Catastrophy : 21-02-2004 at 12:42.
  #14   Spotlight this post!  
Unread 21-02-2004, 19:42
Astronouth7303's Avatar
Astronouth7303 Astronouth7303 is offline
Why did I come back?
AKA: Jamie Bliss
FRC #4967 (That ONE Team)
Team Role: Mentor
 
Join Date: Jan 2004
Rookie Year: 2004
Location: Grand Rapids, MI
Posts: 2,071
Astronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud of
Re: line seeking help needed

The ultimate engineering attitude: "Why? 'cause we can." Why not?
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
Sprockets and Roller Chain Models Madison Inventor 3 04-02-2003 11:51
Q&A Discuss: Does the line continue up the ramp? CD47-Bot Extra Discussion 5 18-01-2003 01:01
iParts on firstcadlibrary.com Ed Sparks Inventor 3 08-01-2003 23:30
approach to autonomy Mike375 Programming 32 08-01-2003 14:04
emulationFIRST v0.04 Matt Leese Programming 7 09-07-2002 08:54


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

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