Changes between Version 15 and Version 16 of Command Based Robot Notes
- Timestamp:
- Jan 27, 2015, 3:23:23 PM (10 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Command Based Robot Notes
v15 v16 5 5 * Continuously executing until Interrupt 6 6 7 {{{setDefaultCommand(new ExampleGroup());}}} 7 {{{#!java 8 setDefaultCommand(new ExampleGroup()); 9 }}} 8 10 9 11 - ''Relation To Robot'' … … 16 18 * Dependencies are created by 17 19 18 {{{requires(Robot.exampleSubsystem);}}} 20 {{{#!java 21 requires(Robot.exampleSubsystem); 22 }}} 19 23 20 24 '''Commands''' … … 38 42 * This may be very important when programming the autonomous robot 39 43 40 {{{ExampleCommand cmd = new ExampleCommand()}}} 41 42 {{{cmd.start();}}} 44 {{{#!java 45 ExampleCommand cmd = new ExampleCommand() 46 ... 47 cmd.start(); 48 }}} 43 49 '''Input Class''' 44 50 - ''Input Devices'' 45 51 * Input devices are mapped through joystick and button objects 46 52 47 {{{Joystick js0 = new Joystick(0);}}} 48 49 {{{Button btn00 = new JoystickButton(js0, 0);}}} 53 {{{#!java 54 Joystick js0 = new Joystick(0); 55 Button btn00 = new JoystickButton(js0, 0); 56 }}} 50 57 - ''Button Actions'' 51 58 * Commands can be mapped to buttons or triggers in the OI class 52 59 53 {{{btn00.whileHeld(new Command());}}} 60 {{{#!java 61 btn00.whileHeld(new Command()); 62 }}} 54 63 55 64 '''Robot Map''' … … 57 66 * This class centralizes port numbers and connection numbers for robot-wide use 58 67 59 {{{public final static int DEFAULT_MOTOR = 2;}}} 68 {{{ 69 #!java 70 public final static int DEFAULT_MOTOR = 2; 71 }}} 60 72 61 73 '''Command Groups''' … … 69 81 * Runs one command in the command group after the other without the need for an end command. 70 82 71 {{{addParallel(new Command1());}}} 83 {{{#!java 84 addParallel(new Command1()); 85 }}} 72 86 - ''Ending Parallel'' 73 * When an end() method is run in a parallel command group, the ended command is removed from the 87 * When an end() method is run in a parallel command group, the ended command is removed from the group until the next instance of the command is run. 74 88 75 89 - ''Sequential'' 76 90 * Runs one command in the command group after the other with the need for an end() command before moving to the next command. 77 91 78 {{{addSequential(new Command1());}}} 92 {{{#!java 93 addSequential(new Command1()); 94 }}} 79 95 '''Scheduling Commands "How To" ''' 80 96 Scheduling commands is a important process of running the robot that can easily get out of hand. There are three main types of commands that should be run at any time and some of them may require their own subsystem. These types of commands include Continuously Run Commands, Human Run Commands, and perhaps most importantly Program Run Commands. Continuously Run Commands like reading sensors, determining the state of a subsystem or running hardware constantly (ex. pneumatic compressors) should be run using the default command method.Human Run Commands are scheduled from the OI Class through the use of buttons and triggers, however command logic should not be placed in the OI class. Command logic should be either be placed in the command or through subsystem states.