Changes between Version 15 and Version 16 of Command Based Robot Notes


Ignore:
Timestamp:
Jan 27, 2015, 3:23:23 PM (10 years ago)
Author:
Timothy Lin
Comment:

code formatting

Legend:

Unmodified
Added
Removed
Modified
  • Command Based Robot Notes

    v15 v16  
    55    * Continuously executing until Interrupt
    66
    7   {{{setDefaultCommand(new ExampleGroup());}}}
     7       {{{#!java
     8       setDefaultCommand(new ExampleGroup());
     9       }}}
    810
    911 - ''Relation To Robot''
     
    1618    * Dependencies are created by
    1719
    18   {{{requires(Robot.exampleSubsystem);}}}
     20  {{{#!java
     21  requires(Robot.exampleSubsystem);
     22  }}}
    1923
    2024'''Commands'''
     
    3842    * This may be very important when programming the autonomous robot
    3943 
    40   {{{ExampleCommand cmd = new ExampleCommand()}}}
    41 
    42   {{{cmd.start();}}}
     44  {{{#!java
     45  ExampleCommand cmd = new ExampleCommand()
     46  ...
     47  cmd.start();
     48  }}}
    4349'''Input Class'''
    4450 - ''Input Devices''
    4551    * Input devices are mapped through joystick and button objects
    4652
    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  }}}
    5057 - ''Button Actions''
    5158    * Commands can be mapped to buttons or triggers in the OI class
    5259     
    53   {{{btn00.whileHeld(new Command());}}}
     60  {{{#!java
     61  btn00.whileHeld(new Command());
     62  }}}
    5463
    5564'''Robot Map'''
     
    5766    * This class centralizes port numbers and connection numbers for robot-wide use
    5867
    59   {{{public final static int DEFAULT_MOTOR = 2;}}}
     68  {{{
     69  #!java
     70  public final static int DEFAULT_MOTOR = 2;
     71  }}}
    6072
    6173'''Command Groups'''
     
    6981    * Runs one command in the command group after the other without the need for an end command.
    7082 
    71     {{{addParallel(new Command1());}}}
     83  {{{#!java
     84  addParallel(new Command1());
     85  }}}
    7286 - ''Ending Parallel''
    73     * 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.
     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.
    7488 
    7589 - ''Sequential''
    7690    * Runs one command in the command group after the other with the need for an end() command before moving to the next command.
    7791
    78   {{{addSequential(new Command1());}}}
     92  {{{#!java
     93  addSequential(new Command1());
     94  }}}
    7995'''Scheduling Commands "How To" '''
    8096     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.