|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
| Thread Tools | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
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 |
|
#2
|
|||
|
|||
|
Re: AUTONOMOUS CODE! HELP!
Here's the code
|
|
#3
|
|||
|
|||
|
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.
|
|
#4
|
||||
|
||||
|
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.
Last edited by kamocat : 22-02-2011 at 22:49. Reason: Attached example |
|
#5
|
||||
|
||||
|
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. |
|
#6
|
||||
|
||||
|
Re: AUTONOMOUS CODE! HELP!
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 |
|
#7
|
||||
|
||||
|
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. |
|
#8
|
|||
|
|||
|
Re: AUTONOMOUS CODE! HELP!
Quote:
|
|
#9
|
|||
|
|||
|
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 |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|