Go to Post I have some free time tonight (What?) - Brandon Martus [more]
Home
Go Back   Chief Delphi > Technical > Programming > C/C++
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #6   Spotlight this post!  
Unread 12-13-2016, 05:22 PM
phurley67 phurley67 is offline
Programming Mentor
FRC #0862 (Lightning Robotics)
Team Role: Mentor
 
Join Date: Apr 2014
Rookie Year: 2013
Location: Michigan
Posts: 63
phurley67 is an unknown quantity at this point
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 "")
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.
Reply With Quote
 


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 09:23 AM.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi