Changes between Version 13 and Version 14 of ControlSystems/SoftwareTeam/Training/GettingStarted/IntroRobotJava


Ignore:
Timestamp:
Oct 15, 2019, 7:51:33 PM (6 years ago)
Author:
David Albert
Comment:

--

Legend:

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

    v13 v14  
    131131    m_rearLeft = new WPI_TalonSRX(4); // CAN Talon ID 4
    132132  }}}
    133 * in teleopPeriodic() read the xbox controller and adjust the servo motor accordingly
     133* in teleopPeriodic() read the xbox controller and adjust the DC motor accordingly
    134134  {{{
    135     // Read xbox controller left joystick x axis
    136     // value returned is between -1.0 and 1.0
    137     double x = xbox.getX(Hand.kLeft);
    138     // Servo motors are controlled on a scale of 0.0 to 1.0
    139     // so re-scale the X value to that range (-1.0->0, 0->0.5, 1.0->1.0)
    140     x = (x + 1.0) / 2;
    141     // Set motor speed based on joystick
    142     m_rearLeft.set(x);
     135     // Read xbox controller left joystick x axis
     136     // value returned is between -1.0 and 1.0
     137     double x = xbox.getX(Hand.kLeft);
     138     // DC Motor controllers apply between -1.0 (full reverse)
     139     // 0=stop and +1.0 (full forward) power
     140     // Set motor speed based on joystick
     141     m_rearLeft.set(x);
    143142  }}}
    144143
    145 You'll need to press the Enable button on the driver station to put the robot in Teleop mode so that teleopPeriodic() is called repeatedly.
     144Note: you'll need to press the Enable button on the driver station to put the robot in Teleop mode so that teleopPeriodic() is called repeatedly.
    146145
    147146