View unanswered posts | View active topics It is currently Sat Jan 21, 2017 6:49 am

Reply to topic  [ 4 posts ] 
Task Control in RobotC 
Author Message

Joined: Sun Apr 05, 2009 3:57 am
Posts: 2
Location: Honolulu, HI
Post 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.

Sun Apr 05, 2009 4:11 am

Joined: Sat Aug 30, 2008 2:25 am
Posts: 25
Post 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).

Mon Apr 06, 2009 11:40 pm

Joined: Sun Apr 05, 2009 3:57 am
Posts: 2
Location: Honolulu, HI
Post 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.......

Sat Aug 01, 2009 6:09 am

Joined: Tue Mar 18, 2008 7:11 pm
Posts: 22
Location: San Antonio, TX
Post 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.


Sat Aug 01, 2009 10:57 am
Display posts from previous:  Sort by  
Reply to topic   [ 4 posts ] 

Who is online

Users browsing this forum: Dan and 2 guests

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  

Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.