View Single Post
  #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, 18 views)
__________________
-- Marshal Horn

Last edited by kamocat : 22-02-2011 at 22:49. Reason: Attached example
Reply With Quote