Thread: Tasks in C++
View Single Post
  #9   Spotlight this post!  
Unread 02-28-2013, 12:10 AM
makahn64 makahn64 is offline
Registered User
FRC #0256
 
Join Date: Nov 2011
Location: United States
Posts: 27
makahn64 is infamous around these partsmakahn64 is infamous around these partsmakahn64 is infamous around these partsmakahn64 is infamous around these partsmakahn64 is infamous around these partsmakahn64 is infamous around these parts
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).
Reply With Quote