Quote:
Originally Posted by agartner01
1. The main reason I want to use a task is so that I can tell one system to do something while continuing to do something else.
|
You can achieve this without using tasks. We use something call Cooperative multi-tasking. It is not using real tasks, instead we have a periodic function for each subsystem. In our main robot loop, we call the periodic functions of each subsystem. So all subsystems get a chance to run. However, since it is "cooperative", there are rules to follow when writing such "tasks". You must not have any loop in these functions and you cannot use any Wait statements. If you need to wait, you use a state machine to remember the state and exit the function. You will continue your processing on the next loop when you will be called again. It works really well for us and you don't have to worry about all the gotcha's of real multi-tasking programming.
Quote:
Originally Posted by agartner01
2. No, I'm not really comfortable with multi-tasked programming. But what I'm trying to do won't be subject to multiple tasks trying to access the same systems. The task that I create will be the only one accessing the systems.
|
You will be surprise. It may not be obvious that you are accessing shared resources. Sometimes, you may be accessing it indirectly through calling another function or even the WPI library. That's why when there is a problem, it's very hard to debug.