|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
||||
|
||||
|
Re: Single Motor Teleop/Autonomous being quirky.
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. |
|
#2
|
|||||
|
|||||
|
Re: Single Motor Teleop/Autonomous being quirky.
I noticed a couple of oddities in your code that probably aren't related to anything you're having problems with, but they still should be addressed.
You have some confusion in the labeling of your drive motors when you open them in Begin. Two of the motors are labeled simply "Left Motor", and the other two are labeled simply "Right Motor". But one of the left ones is connected to the Rear Right Motor input, and one of the right ones is connected to the Front Left Motor input. In Periodic Tasks, you have moved the Compressor Control Loop code from its default location and put it inside a While loop. The CCL itself is a neverending While loop. If you open it up and look at its front panel, you'll find this comment: This VI loops and doesn't return.Take it back out of the While loop and leave it where it was to begin with, outside any other loops. |
|
#3
|
|||
|
|||
|
Tom Line's solution worked well. Using two "Global Variables" fixed my issues almost entirely! Although I could only put the "Motor Set-Output" in Teleop, putting the Firing mechanism Case Structure would make the Motor turn off and then back on after it was done. So I put a global variable in Teleop that is only enabled in Teleop and then compares that to a function of "Enabled?" on an "Equals?" gate in Periodic Tasks to the boolean that controls the Case Structure of the firing mechanism. Both Autonomous and Teleop work fine and there's no major issues except that the driver station still reports that the drive system isn't running "fast enough", although it still drives. I've tried a lot to fix this, but I just can't figure out how.
There's still some small quirks, though. If Autonomous is enabled in the middle of a function of the firing function in Teleop, it sticks and shuts off everything else unless the robot is re-booted. I have no idea what could be causing this, as it's an anomoly that is most likely hidden underneath many operations colliding that I do not have the experience to detect. -If anybody would be willing to look over my programming thoroughly and suggest what can be fixed/fix it themselves, I would be greatly appreciative. All of the major functions work, but I want to learn more about these types of issues and how to prevent them/what would cause them. (Plus it would add to my "solution" response on my original post for whoever has this same issue) Here is the latest code that works: Self-Extracting 7-Zip Archive 7-Zip Archive Zip Archive Thanks to everybody who has helped! I really do appreciate it. |
|
#4
|
|||
|
|||
|
Re: Single Motor Teleop/Autonomous being quirky.
Quote:
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 |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|