Changes between Version 20 and Version 21 of ControlSystems/SoftwareTeam/Training/GettingStarted/IntroRobotJava


Ignore:
Timestamp:
Oct 28, 2019, 10:58:21 PM (6 years ago)
Author:
David Albert
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • ControlSystems/SoftwareTeam/Training/GettingStarted/IntroRobotJava

    v20 v21  
    3434* In the Robot class definition where variables are defined, add {{{   XboxController xbox; }}}
    3535* In the function robotInit() add: {{{ xbox = new XboxController(0); }}}
    36 * In the function robotPeriodic() addd: {{{ SmartDashboard.putNumber("Left Joystick X", xbox.getX(Hand.kLeft)); }}}
     36* In the function robotPeriodic() add: {{{ SmartDashboard.putNumber("Left Joystick X", xbox.getX(Hand.kLeft)); }}}
    3737
    3838Your program should look like [wiki://ControlSystems/SoftwareTeam/Training/IntroRobotJava/XboxExample this]
     
    173173* •     In robotInit() instantiate the Encoder object and reset it
    174174  {{{
     175    // Quadrature encoder has A and B channels connected to DIO0, DIO1
    175176    leftEncoder = new Encoder(0, 1);
     177    // Peanut wheels are 7.5" in diameter
     178    // Encoders provide 1 count per degree of rotation
     179    leftEncoder.setDistancePerPulse((3.141592*7.5)/360);
     180    // reset encoder counts to 0
    176181    leftEncoder.reset();
    177182  }}}
     
    179184  {{{
    180185    int encoderValue = leftEncoder.getRaw();
     186    double distance = leftEncoder.getDistance();
    181187    SmartDashboard.putNumber("Encoder Value", encoderValue);
     188    SmartDashboard.putNumber("Encoder Distance", distance);
    182189  }}}
    183190