Unfortunately multitasking in ROBOTC would be too advanced and too lengthy of a discussion for a Summer of Learning web session; however, we are more than happy to answer any specific questions you may have on the subject. Some of the more common questions about multitasking (including links to various resources on the subject) can be found below.What is multitasking?
- Multitasking is when the robot performs multiple complex behaviors at the same time (simultaneously). If a robot performs behaviors step-by-step (sequentially) then it is not multitasking and should not be programmed with multiple tasks. A more thorough definition of multitasking can be found on Wikipedia's 'Computer multitasking' page.When should I use multitasking?
- There is a sticky right here on the ROBOTC forums that deals with this very topic; 'When and When Not to Multitask'
. Essentially, multitasking should be used when you have to run two separate, complex behaviors at exactly the same time; otherwise, the program can probably be created using standard while loops, if statements, etc.What are some examples of multitasking in ROBOTC?
- ROBOTC community members jpearman and magicode have created a 'ROBOTC programming tips' thread on the VEX forum which contains many, many useful programming tricks and features. Of particular note is the multitasking examples, which can be found on the ROBOTC 'Programming Tips' wiki page
. You can also find a link to original VEX forum post here.Are there any dangers to multitasking?
- Yes, there are some. For instance, there is a chance to encounter what is called a race condition
, which can result in undesirable performance from the multi-tasking program. There are also instances where one task can 'hog' the CPU and not allow other tasks to ever run, which can cause severe issues with the program.Is multitasking worth it?
- This depends on the comfort level of the programmer with multitasking, the behavior(s) that will run in their own tasks, and how exactly the program is created. Like any other tool in programming, it has uses and limits but as long as the programmer with them, it can be effectively used in certain programs.
I hope this helped answer some of the more common multitasking questions, if you have any specific questions please let me know and we'll be more than happy to answer them here!
Check out our Blog
! And our Facebook page
Need help? Take a look at our updated help documentation
and the ROBOTC Forums.