Advertisement
Guest User

Untitled

a guest
Dec 13th, 2019
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.54 KB | None | 0 0
  1. /* Copyright (c) 2017 FIRST. All rights reserved.
  2. *
  3. * Redistribution and use in source and binary forms, with or without modification,
  4. * are permitted (subject to the limitations in the disclaimer below) provided that
  5. * the following conditions are met:
  6. *
  7. * Redistributions of source code must retain the above copyright notice, this list
  8. * of conditions and the following disclaimer.
  9. *
  10. * Redistributions in binary form must reproduce the above copyright notice, this
  11. * list of conditions and the following disclaimer in the documentation and/or
  12. * other materials provided with the distribution.
  13. *
  14. * Neither the name of FIRST nor the names of its contributors may be used to endorse or
  15. * promote products derived from this software without specific prior written permission.
  16. *
  17. * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY THIS
  18. * LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  19. * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
  20. * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  21. * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
  22. * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  23. * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
  24. * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
  25. * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  26. * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  27. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  28. */
  29.  
  30. package org.firstinspires.ftc.teamcode;
  31.  
  32. import com.qualcomm.robotcore.hardware.DcMotor;
  33. import com.qualcomm.robotcore.hardware.HardwareMap;
  34. import com.qualcomm.robotcore.hardware.Servo;
  35. import com.qualcomm.robotcore.util.ElapsedTime;
  36.  
  37. import android.app.Activity;
  38. import android.graphics.Color;
  39. import android.view.View;
  40.  
  41. import com.qualcomm.robotcore.eventloop.opmode.Disabled;
  42. import com.qualcomm.robotcore.eventloop.opmode.LinearOpMode;
  43. import com.qualcomm.robotcore.eventloop.opmode.TeleOp;
  44. import com.qualcomm.robotcore.hardware.ColorSensor;
  45. import com.qualcomm.robotcore.hardware.DistanceSensor;
  46.  
  47. import org.firstinspires.ftc.robotcore.external.navigation.DistanceUnit;
  48.  
  49. import java.util.Locale;
  50.  
  51. /**
  52. * This is NOT an opmode.
  53. *
  54. * This class can be used to define all the specific hardware for a single robot.
  55. * In this case that robot is Gregory.
  56. *
  57. * Motor channel: Left drive motor: "leftFront"
  58. * Motor channel: Right drive motor: "rightFront"
  59. * Motor channel: Left drive motor: "leftBack"
  60. * Motor channel: Right drive motor: "rightBack"
  61. */
  62. public class RobotHardware
  63. {
  64. // public opMode members
  65. public DcMotor leftFront, rightFront, leftBack, rightBack;
  66.  
  67. // local opMode members
  68. HardwareMap hwMap = null;
  69. private ElapsedTime period = new ElapsedTime();
  70.  
  71. // empty class constructor
  72. public RobotHardware() {
  73.  
  74. }
  75.  
  76. // initialize standard hardware interfaces
  77. public void initi(HardwareMap ahwMap) {
  78. // save reference to Hardware map
  79. hwMap = ahwMap;
  80.  
  81. // define and initialize motors for drivetrain
  82. leftFront = hwMap.get(DcMotor.class, "leftFront");
  83. rightFront = hwMap.get(DcMotor.class, "rightFront");
  84. leftBack = hwMap.get(DcMotor.class, "leftBack");
  85. rightBack = hwMap.get(DcMotor.class, "rightBack");
  86. }
  87. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement