|
Re: Tasks?
You have to be careful when using tasks. Tasks are run concurrently. In a preemptive multi-tasking environment, you need to use semaphores to protect against resources being accessed by concurrent tasks (take a look at the notifier as an example). If you are not familiar with this concept, I would advise against using them. You can easily implement the effect of tasks by using cooperative multi-tasking. IterativeRobot class is such an example. In cooperative multi-tasking, tasks can only be switched away if the task chooses to do so. For example, in IterativeRobot, consider AutonomousPeriodic is a task. It got run in every StartCompetition loop, just like a task got run periodically. But the difference is that you are guaranteed that nobody changes the robot state while you are executing your AutonomousPeriodic code.
__________________
|