Quote:
Originally Posted by GavinL
Ok, thanks a lot! And if I want to execute a command, is it "MoveToPosition.execute();"? (without "")
|
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.
The code ends up looking something like (but again, let robot builder do the lifting until you get the hang of it):
Code:
// where the coPilot and cmdMove2Pos variables are generally
// defined in your OI.h file like
std::shared_ptr<Joystick> coPilot;
std::shared_ptr<JoystickButton> cmdMove2Pos;
// in you OI.cpp file in the constructor
coPilot.reset(new Joystick(1));
coPilot.cmdMove2Pos.reset(new JoystickButton(coPilot.get(), 2));
cmdMove2Pos->WhenPressed(new MoveToPosition());
You can also setup a command (or different commands based on a dashboard option) to run as your auton. The commands can run in sequence, so you can build complicated autonomous behavior from simpler command options.