View Single Post
  #7   Spotlight this post!  
Unread 12-13-2016, 06:29 PM
GeeTwo's Avatar
GeeTwo GeeTwo is offline
Technical Director
AKA: Gus Michel II
FRC #3946 (Tiger Robotics)
Team Role: Mentor
 
Join Date: Jan 2014
Rookie Year: 2013
Location: Slidell, LA
Posts: 3,539
GeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond repute
Re: Need help understanding command-based Robots

Quote:
Originally Posted by GavinL View Post
Ok, thanks a lot! And if I want to execute a command, is it "MoveToPosition.execute();"? (without "")
Quote:
Originally Posted by bobbysq View Post
Nope, just run MoveToPosition(); from a CommandGroup or assign it to a button in OI and it'll go.
Quote:
Originally Posted by phurley67 View Post
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.
__________________

If you can't find time to do it right, how are you going to find time to do it over?
If you don't pass it on, it never happened.
Robots are great, but inspiration is the reason we're here.
Friends don't let friends use master links.

Last edited by GeeTwo : 12-13-2016 at 06:33 PM.
Reply With Quote