Quote:
Originally Posted by Tom Line
It causes no end of problems in LabView when people use multiple set motor outputs in different locations.
My suggestion is to have your set motor outputs in Autonomous and Teleop, because you know they never operate concurrently. Have a global variable set the output. Then, set the value of that global variable in the periodic task loop.
Likewise, never set a global variable in more than one place at one time. You can set them in teleop and in auton. Or you can set them in periodic tasks. But you should not set them in teleop AND periodic, and you should never set them in auton AND periodic. You will inevitably run into race conditions if you set a global in 2 vi's that are running at the same time.
|
This fixed my issue completely. I set the the latch gate which use to go to the Set-output in Period Tasks, to go to a custom global variable using a Boolean T/F function to set the output of Enabled or Disabled to the Global Variable, in accordance to whether the Boolean was True or False.
The Global variable was read in Teleop and lead to an "Equals?" gate that when both outputs are "enabled" it outputs a true Boolean which goes to a Boolean T/F Function and to the motor output node for values of 0 when False and -1 when True.
Although, the sequence structure inside the case structure that is used for firing in Teleop would turn off the motor whenever it ran because both of them in Teleop would overpower it. So I moved it back to the Period Tasks loop and used an "and" gate and a Global Variable that is written in Teleop as Enabled to go to the And gate and only send a true when it is set as enabled. So no Solenoid Set-Outputs or Motor Set-Outputs are conflicting with the ones in Autonomous and all is working well.
The only thing I'm questioning though, is all the programming correct and efficient? I don't have the experience to tell currently, I only know that it works, but I want it to be the best it can be programmicly. If anybody would have any suggestions as to what could be done better, please say so!
(I'l change some other small things later, I'm talking about larger functions and ways of doing them)
Here is the code that works:
Self Extracting 7-Zip Archive
7-Zip Archive
Zip Archive