FIRST Robotics Competition Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

multitasking

Now that we have the three components of our code done (drive, shoot, and pickup) we started testing and we found a problem. We can only do one thing at a time. We have tried a few thing to fix this with no luck. Any ideas on how to fix this issue we are having?

0 Kudos
Message 1 of 5
(7,354 Views)

LabVIEW is great for multitasking. Any while loop that are in parallel will be executed in parallel. However, I doubt that's what you mean.

It's really hard to guess what you mean. You say you tried several things. What did you try? The easiest way to help you is for you to post your code and a detailed description of how you want it to act, and a detailed description of how it is currently acting.

0 Kudos
Message 2 of 5
(2,876 Views)

wel in the main loop there are 3 other case statements, one for car drive, the shotter, one for the pickup.  When the shotter or pick up gose the car pid loops stops working and you cant stop the motors.  we have tried while loops around them, just the case statements and we have fooled around wiht a few things that were small.  But i know there is an easy way to do what we are doing but i cant see it and that what i am looking for.  But attache is our basic framework robot main code with the stuff we have been working on in it.  I know the while loops inside didnt help so those are gone (but this is the best looking code i have right now) so those are gone but the rest is still there.  Any ideas?

0 Kudos
Message 3 of 5
(2,876 Views)

The sequence structures are what is causing it. The code is doing exactly what you are telling it to do, which is execute the code in the sequence structures in sequence, so it never runs the rest of the code again, until the sequence is finished. You want your code to execute very quickly (less then 20 ms) so that it can execute again when the next packet is received. If it's still locked up in a sequence structure, bad things will happen.

What you need to do is set your code up in a state machine. In the LabVIEW help, look at "sequence structures, overusing". You can also look at http://wiki.lavag.org/State_Machine

0 Kudos
Message 4 of 5
(2,876 Views)

The Sensor Fusion tutorial also contains great instructions for how to build a state machine, and it's FIRST specific!

Sensor Fusion

Best Regards,

~Nate

0 Kudos
Message 5 of 5
(2,876 Views)