Go to Post Earlier this week it took me a little bit too long to realize that the reason my pen wasn't writing correctly was that it was actually a screwdriver. I'm going to have to ask for a few nights of honest sleep before signing off on a report. - EricVanWyk [more]
Home
Go Back   Chief Delphi > Technical > Programming > NI LabVIEW
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 16-03-2011, 20:15
jhellr13 jhellr13 is offline
Registered User
FRC #4272
Team Role: Mentor
 
Join Date: Jan 2011
Rookie Year: 2010
Location: US
Posts: 187
jhellr13 is an unknown quantity at this point
Check My Code

My team is competing in the long island regional next week, and we want to make sure our autonomous works. I have attached my code, and hope that anyone can look it over and tell me if I need to fix some things. A question i have is how to make a motor run for certain amounts of time, especially a relay. I put a wait function in these sections in the code, figuring that is what i need, but am unsure. Most of my questions/concerns are in the code itself, so please read all the text boxes i have added.
Basically what we want is the robot to follow the line, then raise the arm, drive forward, lower the arm for a slight period of time, then backup.

Thanks for the help in advanced.
Attached Files
File Type: vi Arcade Drive Autnomous FINAL.vi (15.7 KB, 38 views)
Reply With Quote
  #2   Spotlight this post!  
Unread 16-03-2011, 22:58
Alan Anderson's Avatar
Alan Anderson Alan Anderson is offline
Software Architect
FRC #0045 (TechnoKats)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Kokomo, Indiana
Posts: 9,112
Alan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond repute
Re: Check My Code

I have three quick comments.

First, you don't need to use that "At T" local variable. You can just wire the value out of the first while loop into the beginning of your flat sequence. That way, the sequence will not run until the line-following loop ends and provides a value.

Second, it's really easy to have a relay hold a value for a certain amount of time. Since relays don't have motor safeties to shut them down if you don't keep setting them every so often, just put the Relay Set and a Wait function next to each other in the sequence frame. That frame will not finish until the Wait time has elapsed, and you can put another Relay Set in the next frame to turn it off.

Finally, the motor safeties make it not so easy to do the same thing for your drive motors. You can turn off the safety and try it that way, or you can try to adapt something Greg McKaskle posted a while back.
Reply With Quote
  #3   Spotlight this post!  
Unread 18-03-2011, 23:18
jhellr13 jhellr13 is offline
Registered User
FRC #4272
Team Role: Mentor
 
Join Date: Jan 2011
Rookie Year: 2010
Location: US
Posts: 187
jhellr13 is an unknown quantity at this point
Re: Check My Code

Quote:
Originally Posted by Alan Anderson View Post
I have three quick comments.

First, you don't need to use that "At T" local variable. You can just wire the value out of the first while loop into the beginning of your flat sequence. That way, the sequence will not run until the line-following loop ends and provides a value.

Second, it's really easy to have a relay hold a value for a certain amount of time. Since relays don't have motor safeties to shut them down if you don't keep setting them every so often, just put the Relay Set and a Wait function next to each other in the sequence frame. That frame will not finish until the Wait time has elapsed, and you can put another Relay Set in the next frame to turn it off.

Finally, the motor safeties make it not so easy to do the same thing for your drive motors. You can turn off the safety and try it that way, or you can try to adapt something Greg McKaskle posted a while back.
Hey Alan,
Thanks for the help. I went with your advice of disabling the drive safety and putting wait functions in. I didn't really want to use greg's method as great as it is, because it would have gotten pretty confusing for me, and the other method seemed simplier in my mind. I have attached my new version, if you can just take a glance at it. Thanks again.

Jared
Attached Files
File Type: vi Arcade Drive Autnomous with correct timing.vi (27.4 KB, 16 views)
Reply With Quote
  #4   Spotlight this post!  
Unread 20-03-2011, 15:36
Alan Anderson's Avatar
Alan Anderson Alan Anderson is offline
Software Architect
FRC #0045 (TechnoKats)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Kokomo, Indiana
Posts: 9,112
Alan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond repute
Re: Check My Code

Quote:
Originally Posted by jhellr13 View Post
I have attached my new version, if you can just take a glance at it.
At first glance, it seems okay. A deeper look reveals a couple of things I would have done differently, such as getting the Arm relay reference only once and passing the reference through the sequence to each relay set function, but that's not a major issue. I'm also a little concerned that you might not be driving your motors hard enough, with 0.3 seeming a little low.
Reply With Quote
  #5   Spotlight this post!  
Unread 20-03-2011, 15:39
jhellr13 jhellr13 is offline
Registered User
FRC #4272
Team Role: Mentor
 
Join Date: Jan 2011
Rookie Year: 2010
Location: US
Posts: 187
jhellr13 is an unknown quantity at this point
Re: Check My Code

Quote:
Originally Posted by Alan Anderson View Post
At first glance, it seems okay. A deeper look reveals a couple of things I would have done differently, such as getting the Arm relay reference only once and passing the reference through the sequence to each relay set function, but that's not a major issue. I'm also a little concerned that you might not be driving your motors hard enough, with 0.3 seeming a little low.
Yeah, i guess it would be a smart idea to increase the speed and decrease the time. I set it low to avoid it driving into the wall, but your thought seems valid. Thanks
Reply With Quote
  #6   Spotlight this post!  
Unread 20-03-2011, 16:10
jhellr13 jhellr13 is offline
Registered User
FRC #4272
Team Role: Mentor
 
Join Date: Jan 2011
Rookie Year: 2010
Location: US
Posts: 187
jhellr13 is an unknown quantity at this point
Re: Check My Code

Alan,
I have recently seen the video posted herehttp://www.chiefdelphi.com/forums/sh...ad.php?t=93404 by team 1678. I have been thinking about it, and think it could be useful for our robot. Are they just simply taking the line following code from autonomous, and copying it into a case structure in teleop attached to a button? Or is there more to it then what i believe?
Reply With Quote
  #7   Spotlight this post!  
Unread 20-03-2011, 18:33
Alan Anderson's Avatar
Alan Anderson Alan Anderson is offline
Software Architect
FRC #0045 (TechnoKats)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Kokomo, Indiana
Posts: 9,112
Alan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond repute
Re: Check My Code

Ask someone on 1678 about their code. It's obviously not exactly the same as the default autonomous line tracking, as theirs begins by driving forward rather than turning to find the line.
Reply With Quote
Reply


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 09:32.

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