Go to Post Don't take things too seriously; It's supposed to be fun. :) - ScoutingNerd175 [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 22-02-2011, 16:22
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
AUTONOMOUS CODE! HELP!

It's coming down to the last hours. I need help with our autonomous code. Can anyone look at the attached code, and either give suggestions, or even better fix it for me?

Thank you all very much in advance
Reply With Quote
  #2   Spotlight this post!  
Unread 22-02-2011, 16:24
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: AUTONOMOUS CODE! HELP!

Here's the code
Attached Files
File Type: vi Autonomous Independent With Arm trial 2.vi (29.5 KB, 31 views)
Reply With Quote
  #3   Spotlight this post!  
Unread 22-02-2011, 17:03
j.cole j.cole is offline
Registered User
FRC #0379
 
Join Date: Jan 2010
Location: Girard
Posts: 159
j.cole has much to be proud ofj.cole has much to be proud ofj.cole has much to be proud ofj.cole has much to be proud ofj.cole has much to be proud ofj.cole has much to be proud ofj.cole has much to be proud ofj.cole has much to be proud ofj.cole has much to be proud of
Re: AUTONOMOUS CODE! HELP!

I feel like all of those tunnels should have shift registers in there instead of tunnels. Other than that check all of your RefNum Gets.
__________________

It's not normally a good idea to give a programmer a drill but rules are made to be broken.
Reply With Quote
  #4   Spotlight this post!  
Unread 22-02-2011, 22:46
kamocat's Avatar
kamocat kamocat is offline
Test Engineer
AKA: Marshal Horn
FRC #3213 (Thunder Tech)
Team Role: Mentor
 
Join Date: May 2008
Rookie Year: 2008
Location: Tacoma
Posts: 894
kamocat is just really nicekamocat is just really nicekamocat is just really nicekamocat is just really nicekamocat is just really nice
Send a message via AIM to kamocat Send a message via MSN to kamocat
Re: AUTONOMOUS CODE! HELP!

I don't think shift registers are neccessary here; the data in those refnums aren't changing, except perhaps the error state. However, if you would like to pass on the error every iteration, feel free.

One thing here that doesn't make sense to me is the use of the relay output. I see you have values such as -200 or even the iteration counter, wired to the relay state.
In fact, there are only four meaningful values: Off (0), On (1), Forward (2), and Reverse (3).
Anything outside that range will be coerced to the nearest meaningful value. That means -200 will be coerced to 0 (Off), and the iteration counter will go through all four states, and end on Reverse.

I also see that the only thing measured here is time. That being the case, there is a simpler way to write your code.
  • Disable the timeout on the drive base.
  • Use a "wait" function to wait the entire time something should execute.
  • Compartmentalize each action with flat sequence structures, forcing sequential execution through data dependency.
I've attached an example of this.
Attached Files
File Type: vi Autonomous Independent With Arm trial 2.vi (14.8 KB, 19 views)
__________________
-- Marshal Horn

Last edited by kamocat : 22-02-2011 at 22:49. Reason: Attached example
Reply With Quote
  #5   Spotlight this post!  
Unread 22-02-2011, 23:16
DavidGitz's Avatar
DavidGitz DavidGitz is offline
Lead Technical Advisor
FRC #1208 (MeTool Brigade)
Team Role: Coach
 
Join Date: Dec 2006
Rookie Year: 1996
Location: O'Fallon, IL
Posts: 341
DavidGitz has much to be proud ofDavidGitz has much to be proud ofDavidGitz has much to be proud ofDavidGitz has much to be proud ofDavidGitz has much to be proud ofDavidGitz has much to be proud ofDavidGitz has much to be proud ofDavidGitz has much to be proud of
Send a message via AIM to DavidGitz Send a message via MSN to DavidGitz Send a message via Yahoo to DavidGitz
Re: AUTONOMOUS CODE! HELP!

More issues with the original posted code:
-"Stand Still", "Stop Arm", "Stand Still", "Stop Arm", "Stop" will never finish (False constant wired to Stop Condition.
-"Lower Arm for 200 ms" will execute exactly once due to True constant wired to Stop Condition.
__________________
Reply With Quote
  #6   Spotlight this post!  
Unread 22-02-2011, 23:21
DavidGitz's Avatar
DavidGitz DavidGitz is offline
Lead Technical Advisor
FRC #1208 (MeTool Brigade)
Team Role: Coach
 
Join Date: Dec 2006
Rookie Year: 1996
Location: O'Fallon, IL
Posts: 341
DavidGitz has much to be proud ofDavidGitz has much to be proud ofDavidGitz has much to be proud ofDavidGitz has much to be proud ofDavidGitz has much to be proud ofDavidGitz has much to be proud ofDavidGitz has much to be proud ofDavidGitz has much to be proud of
Send a message via AIM to DavidGitz Send a message via MSN to DavidGitz Send a message via Yahoo to DavidGitz
Re: AUTONOMOUS CODE! HELP!

Quote:
Originally Posted by kamocat View Post
I've attached an example of this.
I have a question concerning the Safety Config.vi Since you disabled this, what would happen if a User hits Disable from the Driver Station while this is executing? Or hits Emergency Stop? Just my ignorance showing, but we try to avoid configuring these vi's. I assume they will operate as normal as they are part of the System Watchdog, but I haven't used them at all so I am just checking.
__________________

Last edited by DavidGitz : 22-02-2011 at 23:23. Reason: clarification
Reply With Quote
  #7   Spotlight this post!  
Unread 22-02-2011, 23:24
kamocat's Avatar
kamocat kamocat is offline
Test Engineer
AKA: Marshal Horn
FRC #3213 (Thunder Tech)
Team Role: Mentor
 
Join Date: May 2008
Rookie Year: 2008
Location: Tacoma
Posts: 894
kamocat is just really nicekamocat is just really nicekamocat is just really nicekamocat is just really nicekamocat is just really nice
Send a message via AIM to kamocat Send a message via MSN to kamocat
Re: AUTONOMOUS CODE! HELP!

Every disable will still function.
The only difference is that the motors won't timeout from not being updated every 100ms.
In my attached code, I reenabled it at the end of autonomous.
__________________
-- Marshal Horn
Reply With Quote
  #8   Spotlight this post!  
Unread 23-02-2011, 11:32
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: AUTONOMOUS CODE! HELP!

Quote:
Originally Posted by kamocat View Post
I don't think shift registers are neccessary here; the data in those refnums aren't changing, except perhaps the error state. However, if you would like to pass on the error every iteration, feel free.

One thing here that doesn't make sense to me is the use of the relay output. I see you have values such as -200 or even the iteration counter, wired to the relay state.
In fact, there are only four meaningful values: Off (0), On (1), Forward (2), and Reverse (3).
Anything outside that range will be coerced to the nearest meaningful value. That means -200 will be coerced to 0 (Off), and the iteration counter will go through all four states, and end on Reverse.

I also see that the only thing measured here is time. That being the case, there is a simpler way to write your code.

  • Disable the timeout on the drive base.
  • Use a "wait" function to wait the entire time something should execute.
  • Compartmentalize each action with flat sequence structures, forcing sequential execution through data dependency.
I've attached an example of this.
Thanks for the file. I hope this one will work. Now since build is done, i can concentrate on an autonomous code. In regards to the comments about enable and disable safety config, does it really matter which way i leave them?
Reply With Quote
  #9   Spotlight this post!  
Unread 23-02-2011, 19:00
Greg McKaskle Greg McKaskle is offline
Registered User
FRC #2468 (Team NI & Appreciate)
 
Join Date: Apr 2008
Rookie Year: 2008
Location: Austin, TX
Posts: 4,752
Greg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond repute
Re: AUTONOMOUS CODE! HELP!

Safety Config adds a layer of safety, especially when debugging code. If safety config is turned on, it periodically checks to see if you have updated the output value. If several hundred milliseconds have elapsed and your code hasn't given an update, that is the cue for the safety manager to set the output for you -- to 0.

Do you want this on?
If your code to update the motors or RobotDrive will be executed in a loop or otherwise run more often than the safety timeout, then the safety VIs will allow you to hit a breakpoint in your code, accidentally crash a particular thread, write an infinite loop, and make many common debugging actions without the robot continuing on its way -- at least the safety config'ed outputs will be set to 0.

If you don't know how often your code is running, don't want to write it this way, aren't debugging anyway, or have really good bumpers and alternate safety practices, you can turn off the safety config. It is optional.

Greg McKaskle
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 20:36.

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