Quote:
Originally Posted by GavinL
Ok, thanks a lot! And if I want to execute a command, is it "MoveToPosition.execute();"? (without "")
|
Quote:
Originally Posted by bobbysq
Nope, just run MoveToPosition(); from a CommandGroup or assign it to a button in OI and it'll go.
|
Quote:
Originally Posted by phurley67
You would generally associate the MoveToPosition command with operator interface (OI). Using robot builder you can assign it to when a button on a joystick (or gamepad) is pressed, held, or released.
|
To clarify (as this does NOT make much sense until you wrap your head around it, especially if you're coming from a sampleRobot mindset): You just create the commands with
new MoveToPosition() and pass them to the buttons, joysticks, or other control objects. The internals of those control objects call your
initialize(),
execute(),
isFinished(), and
end() methods at the appropriate times. You should only put "one pass" of your execute loop in the execute command; it will be called repeatedly. Any information you need to carry from one call to
execute() to another should be declared as part of the object and instantiated/initialized in
initialize(). Each of your functions (especially
execute() and
isFinished()) should be written to return as quickly as possible - do not put any waits or loops of more than a very few passes in them.