Changes between Version 2 and Version 3 of ControlSystems/SoftwareTeam/Training/GettingStarted/ServoMotor


Ignore:
Timestamp:
Nov 3, 2019, 7:52:29 PM (6 years ago)
Author:
David Albert
Comment:

--

Legend:

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

    v2 v3  
    11== Servo Motor Control
    22
    3 Robots can interact with their environment.  Many types of actuators are used in FRC robotics to manipulate the environment; one of them is the [https://wpilib.screenstepslive.com/s/currentCS/m/java/l/599703-repeatable-low-power-movement-controlling-servos-with-wpilib Servo Motor].  [[Image(ServoMotor.jpg,right,250px,margin=10)]] A servo motor is a special type of motor that can rotate to a precise position, usually between 0 and 180 degrees.  They come in a variety of sizes and strengths.  You can connect a servo motor to any of the [http://www.ni.com/pdf/manuals/375274a.pdf#_OPENTOPIC_TOC_PROCESSING_d443e2165 PWM ports] on the !RoboRIO.  Examine the PWM ports and identify which row of pins are ground ([[Image(GroundSymbol.png,25px)]], +6V, and Signal (S).  Make sure you connect them to the proper pins on the Servo motor: black or brown goes to Ground, red or orange goes to +6V, yellow/white/blue goes to Signal.  You can read more about servo motors [https://learn.sparkfun.com/tutorials/servo-trigger-hookup-guide/all here]
     3Robots can interact with their environment.  Many types of actuators are used in FRC robotics to manipulate the environment; one of them is the [https://wpilib.screenstepslive.com/s/currentCS/m/java/l/599703-repeatable-low-power-movement-controlling-servos-with-wpilib Servo Motor].  [[Image(ServoMotor.jpg,right,250px,margin=10)]] A servo motor is a special type of motor that can rotate to a precise position, usually between 0 and 180 degrees.  They come in a variety of sizes and strengths.  You can connect a servo motor to any of the [http://www.ni.com/pdf/manuals/375274a.pdf#_OPENTOPIC_TOC_PROCESSING_d443e2165 PWM ports] on the !RoboRIO.  Examine the PWM ports and identify which row of pins are ground ([[Image(GroundSymbol.png,25px)]], +6V, and Signal (S).  The example below assumes that the servo motor is connected to PWM port 2.  Make sure you connect them to the proper pins on the Servo motor: black or brown goes to Ground, red or orange goes to +6V, yellow/white/blue goes to Signal.  You can read more about servo motors [https://learn.sparkfun.com/tutorials/servo-trigger-hookup-guide/all here]
    44
    55Create another program using the !TimedRobot java template and name it !ServoTest. Modify the generated code as follows:
    6 * Add the following imports:
     6* Import the [https://first.wpi.edu/FRC/roborio/release/docs/java/edu/wpi/first/wpilibj/Servo.html Servo] and [https://first.wpi.edu/FRC/roborio/beta/docs/java/edu/wpi/first/wpilibj/XboxController.html XboxController] classes:
    77{{{
    88import edu.wpi.first.wpilibj.XboxController;