All the VEX brains use some for of arm processor, usually contained with other functionality in a SOC.
The product that was marketed as the “cortex” used an SOC with a cortex M3 processor. IQ2 uses an M4, others use M7 and A9 processors. Most of the smart sensors also use arm processors, some (GPS for example) are quite powerful.
I don’t think I ever wrote a detailed white paper or anything on the scheduler that’s used for VEXcode. It’s a cooperative scheduler (V5 being a dual core system can run alternatives, PROS uses FreeRTOS, but IQ gen 1/2 and EXP cannot) that was inspired by the scheduler used in RobotC, although the implementation is quite different. Years ago, before joining Robomatter/VEX, I did write several long posts on the RobotC scheduler, many of the same concepts still apply.
So it was always inevitable that this thread would discuss multi-tasking at some point. RobotC’s ability to run more than one task is IMHO it’s greatest strength, there has been lot’s written describing multi-tasking in it’s different forms but when dealing with RobotC I like to think of it as the ability to run more than one independent program at a time even though these programs are contained within one executable and downloaded together. For some background reading on multi-tasking, wikipe…
OK, part 2 then I need to do some real work today. This may be a little complex for some here but please don’t feel intimidated, it’s good to see a more fully developed example once in a while.
The previous post contained a very simple example demonstrating RobotC multi-tasking that would flash two LEDs at different speeds, not very exciting but actually useful in some cases. The task, flashLed_1, will keep executing no matter what other code you are running. Perhaps the robot is under drive…
I’m going to discuss multi-tasking a bit more and the task scheduler. As there is little documentation on this aspect of RobotC most of this discussion is a best guess and may be incorrect in some of the fine details.
Consider a group of students sitting around a table having a discussion with their teacher. If a student wants to speak then they have to raise their hand and wait for the teacher to give them permission. If several students have their hands raised the teacher will choose each …
In the last post we introduced AbortTimeSlice, RobotC also has the command EndTimeSlice which, with a little digging around in the system headers, turns out to do exactly the same thing as AbortTimeSlice.
For the next experiment I’m going to delete the AbortTimeSlice command completely and see what the result is, here’s the modified code.
// Flash the first LED
task flashLed_1()
{
while( true )
{
// toggle output
SensorValue LED_1 ] = 1 - SensorValue LED_1 ];
…
I’m going to conclude this short tutorial on multi tasking with a discussion of the remaining useful RobotC commands relating to tasks.
We have already used StartTask to start tasks with the default task priority or a user defined priority.
StartTask( taskName );
StartTask( taskName, priority );
We looked at how abortTimeslice ( and EndTimeSlice ) affect the way tasks run. Although I did not specifically discuss wait1Msec, it’s importance in allowing the task scheduler to switch between task…