Task Control in RobotC
Page 1 of 1

Author:  kyungjin [ Sun Apr 05, 2009 4:11 am ]
Post subject:  Task Control in RobotC

I have a VEX robot that I'm trying to program and want to try out some things using tasks. I've looked on the help file included with RobotC and it says that it can handle four concurrent tasks to run at the same time.

Now, using the included competition code... We have the main task (located in the "competition includes" header file) that first runs and calls the autonomous task (which is subsequently where all the rest of the code goes). Does this mean that in competition code, two tasks are already running at the same time, meaning that I can only program two user controlled tasks to run concurrently in autonomous mode? If so, this seems really restrictive and to some extent very weak. This feature would have a lot more potential if more user-defined tasks were able to run concurrently on the VEX hardware.

Also, I wanted to know how taxing these tasks were on the VEX microprocessor. I have a pretty advanced program I wrote for my teleoperated robot control and it seems to be pushing the limits to what it can handle because there is considerable lag time if I add more code to our user controlled portion of my code.

I just wanted to get some feedback and information from the RobotC community on these two topics.

Author:  fryfrog [ Mon Apr 06, 2009 11:40 pm ]
Post subject:  Re: Task Control in RobotC

I think that you can have as many tasks as you want, but only 4 running. So during autonomous mode, maybe you'd only have 3 more available? Or maybe 2, not sure if "main" counts as 1 or not.

As for lagging when you have more tasks, try adding more sleeps. This lets the CPU run tasks a little slower, which helps a lot (and if the sleeps are short enough, you won't even notice).

Author:  kyungjin [ Sat Aug 01, 2009 6:09 am ]
Post subject:  Re: Task Control in ROBOTC

I'm pretty sure that's the case. The VEX competition template initiates the first task for starting up and then the second task becomes the default main task that is the standard starting point of user written code leaving you with... as you guessed 2 tasks. This was the reason I didn't utilize the task feature in my code back when I did VEX last year. If they did improve the functionality though I'm pretty sure it would prove useful. Alas, with the cruddy hardware VEX is giving us with their current generation of underpowered microcontrollers, it's easy to reach full potential (before you start noticing some lag time) when writing more advanced pieces of code which is probably why we're limited to 4 (er... 2) simultaneous processes at the same time. I wonder why they don't write that in the documentation though.......

Author:  kellyds [ Sat Aug 01, 2009 10:57 am ]
Post subject:  Re: Task Control in ROBOTC

From the RobotC Help File concerning tasks.....

Up to four tasks can execute concurrently within a VEX or FRC user program. The ‘main’ task is automatically started when a user program is run. Execution of other tasks can be started and stopped with the ‘StartTask’ and ‘StopTask’ functions. ROBOTC will share CPU execution time among various tasks by giving each task a “time slice” where it will execute a group of instructions.


Page 1 of 1 All times are UTC - 5 hours [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group