|
Re: Tasks in C++
You might want to just switch to using the Command based model which takes care of scheduling commands for you. We had been writing our own scheduled objects with update loops we kicked each pass through the loop. We switched to Command this year and it is so much easier.
So in your case of moving the arm, you'd created a "MoveArm" command which subclasses command. There's a method called when the Command is initted, one that's called every 20ms while it is alive, another called to ind out if the command is done, another clean up when it is done. Quite tidy.
Having said that, it doesn't work great if you need better than 20ms resolution on any given feedback measurement (i.e. a fast spinning acutuator).
|