

This means that the wheels can continue to drive on with the next instructions, while the arm begins to lift, without having to wait. This makes tasks more ideal for multitasking purposes.įor example, it is quite common to use functions to control a drive train, but a task to control an arm. Tasks are started or stopped, and work in the background, rather than sequentially like functions. Tasks are similar in concept to functions in the sense that you can replace huge chunks of repetitive code with them.

If you’ve gotten this far in reading, the following assumes that you understand what functions are (George’s guide also has a section on functions, for those who would like to read more). I turn now to the very helpful George Gillard and his Beginner’s Guide to RobotC, Volume 2.

(Even if you copy something from a nice person’s post online that’s all cool and fancy, you still need to make sure that it works for your robot the way you think it does.) Give yourself time to test and adjust and debug well in advance of your next competition. * For these last 2 items in the list above, I have a recommendation for those brand-new to using RobotC tasks: start small and simple, with something that you can easily troubleshoot.

The principal represents a high-priority task that has precedence over the others. The task scheduler (the teacher in my example) determines which task (student) can run. This analogy describes quite well how the RobotC task scheduler works. At one point the school principal joins the debate, He also has to raise his hand to be able to speak but, as he is considered more important, the teacher always gives him priority. The teacher is also watching a clock, if a student speaks for too long then the teacher will interrupt them and give someone else a turn. Some students may want to speak often and keep raising their hands, others may be sleepy and not participate much at all. If several students have their hands raised, the teacher will choose each one in turn so everyone can be heard. If a student wants to speak then they have to raise their hand and wait for the teacher to give them permission. RobotC’s faux-multitasking is handled by the “task scheduler” he offers a wonderful analogy of how this works.Ĭonsider a group of students sitting around a table having a discussion with their teacher. I include here text from the aweseome jpearman about how RobotC’s tasks work, because I couldn’t possibly say it better myself. Technically, RobotC can’t either, but it has the ability to make it seem like it’s multitasking using things called … wait for it … tasks. In eas圜, the best you can do with this limitation is some very well-crafted and efficient functions-called one after the other, each doing its thing and returning to the main loop-but you just cannot make it do 2 things at once. The VEX cortex (as it stands now, in the 2017-and-before universe) cannot multitask it has no capacity for doing so. For those who are considering switching from eas圜 to RobotC (or if you’re like us, and you have switched but are still in the learning phase), I thought I’d write about an item in RobotC that does not exist in eas圜: tasks.
