[VCS] How to program different task that run simultaneously

Hey guys.

We are trying to make our program more efficient. Right now it will only do one command at a time, so if it is driving and I tell it to lift the lift, the drive will stop (or continue going even if I want it to stop). I was wondering how can I make it so that it can do different tasks that run simultaneously. For example, the drive will be controlled by the joysticks no matter what is happening in the rest of the program.

Someone said to do something like this, but how do I make different tasks?

While (true)
{
    StartTask(DriverControl);
    StartTask(Lift);
    StartTask(CapFlipper);
}

Thanks for your help,
Ryan - 323V GEARS

Are you using VCS? I haven’t using it much (still v4), but the theory is pretty universal.
Put different things in different tasks if you want them to run independently, in parallel.

in robotC to make a new task,

task taskName {
//task code
}

Then in your disabled, auto, or usercon tasks, start the tasks you want using the same syntax you have above:
StartTask(taskName);

In the past I’ve had up to 9 tasks, for various drive functions between 2 remotes, PID loops that needed to constantly run, etc. I’d say that’s a good max number lol.
For what it sounds like you want, put your joystick drive in usercontrol task, and lift in a new task. (Make sure to start the newtask outside the while loop in the usercon task)

Good luck :+1: --Jade

Thank you for your input, Jade! I appreciate you taking your time to leave an answer. We are using VCS, which is why we’re struggling to find an answer. Many people know how to do it in Robot C, but not VCS. I can’t find how to do the task command in VCS. Hoping to find the answer soon.

Thanks again,
Ryan

Here’s an example

1 Like

Thanks a lot @jpearman
This was a huge help!
I tried it and it works!