I'm having a problem starting and stopping tasks with NXC that I was hoping somebody might be able to help me with, please?
I've written a task that tracks the heading of an autonomous vehicle and adjusts the steering based on the output of a compass sensor to keep the vehicle tracking in a straight line. My main() task starts a navigation() task using the Precedes() function, but I only want to start the tracking task when the vehicle is actually in motion, so I'm trying to do it like this:
Code: Select all
task truckNav()
{
cntrSteer();
taskBeep();
StartTask(truckTracking);
while(distF > 30) //have to allow for the coasting here - about 10cm on the flat!
{
truckFwd(75); //start moving forward at 75% motor power
}
StopTask(truckTracking);
truckStp();
endBeep();
StopAllTasks();
}
I assume I'm just starting/stopping the tasks incorrectly, but all the documentation seems to suggest that this is the way to do it - can anybody lend any help, please?
Thanks,
Paul