wiki:Command Based Robot Notes

Version 6 (modified by awollack, 10 years ago) (diff)

--

Command Based Robots

Structure Documentation:

Subsystem

  • Default Commands
    • Continuously executing until Interrupt

setDefaultCommand(new ExampleGroup());

  • Relation To Robot
    • Subsystems can be compared to mechanisms that use the same overall resources
    • Realize that two actions cannot occur at the same time, that require the same subsystem
  • Dependencies
    • Dependencies are created by
    • These prevent two different commands from utilizing the same resources on the robot

requires(Robot.exampleSubsystem);

Commands

  • Interrupts
    • Called to stop a command from running
    • Specifically when robot is disabled or a dependency overlaps
  • Connection With Buttons
    • Commands can be easily mapped to buttons through the OI class

Input Class

  • Input Devices
    • Input devices are mapped through joystick and button objects

Joystick js0 = new Joystick(0);

Button btn00 = new JoystickButton(js0, 0);

  • Button Actions
    • Commands can be mapped to buttons or triggers in the OI class

btn00.whileHeld(new Command());

Robot Map

  • Ports
    • This class centralizes port numbers and connection numbers for robot-wide use

public static int defaultMotor = 2;

Command Groups

  • About
    • Command Groups are used for command sequencing and parallelizazation
    • Basically running things in a specific order or at the same time
    • Think about automated actions
    • Commands will add in order of methods to add them
  • Sequential
    • TODO(testing)

addSequential(new Command1());

  • Parallel
    • TODO(testing)

addParallel(new Command1());