View Single Post
  #13   Spotlight this post!  
Unread 15-02-2010, 20:22
Luke Pike's Avatar
Luke Pike Luke Pike is offline
Programmer
FRC #1501 (THRUST)
Team Role: Mentor
 
Join Date: Jan 2008
Rookie Year: 2008
Location: Huntington
Posts: 114
Luke Pike is a name known to allLuke Pike is a name known to allLuke Pike is a name known to allLuke Pike is a name known to allLuke Pike is a name known to allLuke Pike is a name known to all
Re: sample code to move robot autonomously

johncap100,

You are almost there, just some things that were a little off that I didn't explain. I changed your code so you can see.

First, all the booleans wired into the stop box are all true. This means that as soon as the code runs, it stops the loop. Make all of them false except the one in the last case. This makes sure that we stop the loop only when we are done. In fact, you could just wire a false all the time. Just delete all those booleans and create one false boolean outside the case structure and wire that into the stop box. This will keep the code running until someone stops autonomous mode. This is probably better anyway, since you will probably be doing stuff right until the end

Second, in the "stop" case, you never wire a new state into the shift register, you just pass the old one back through. In order to go to the next state, you have to wire a constant set to the state you want to move to. Every state should have a way to move to another, except possibly the last one, where you don't want to ever go to another state.

Other than that, you pretty much nailed it. Should work, I had to disconnect the typedef since I didn't have that file, you can replace the constants with your typedef by dragging the file into the block diagram as many times as you need.
Attached Files
File Type: vi Autonomous Independent.vi (30.9 KB, 59 views)
__________________
Twitter Profile
Reply With Quote