Skip to content

Commit

Permalink
Lift Motor changed to DcMotorEx.
Browse files Browse the repository at this point in the history
Added telementry.
  • Loading branch information
rhsftc committed Oct 23, 2024
1 parent e486aee commit c8d34ce
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import com.arcrobotics.ftclib.gamepad.GamepadKeys;
import com.qualcomm.robotcore.eventloop.opmode.LinearOpMode;
import com.qualcomm.robotcore.eventloop.opmode.TeleOp;
import com.qualcomm.robotcore.hardware.DcMotorEx;
import com.qualcomm.robotcore.util.ElapsedTime;

import org.firstinspires.ftc.teamcode.subsystems.Lift;
Expand Down Expand Up @@ -84,6 +85,12 @@ public void runOpMode() {
lift.update();
// Show the elapsed game time.
telemetry.addData("Status", "Run Time: " + runtime);
telemetry.addData("Target", "%d", robot.liftMotor.getTargetPosition());
telemetry.addData("Position", "%d", robot.liftMotor.getCurrentPosition());
telemetry.addData("Power", "%6.2f", robot.liftMotor.getPower());
telemetry.addData("Busy", robot.liftMotor.isBusy());
telemetry.addData("Mode", robot.liftMotor.getMode());
telemetry.addData("PIDF Run To Position", robot.liftMotor.getPIDFCoefficients(DcMotorEx.RunMode.RUN_TO_POSITION));
telemetry.update();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.qualcomm.robotcore.eventloop.opmode.LinearOpMode;
import com.qualcomm.robotcore.hardware.DcMotor;
import com.qualcomm.robotcore.hardware.DcMotorEx;
import com.qualcomm.robotcore.hardware.DcMotorSimple;

public class RobotHardware {
Expand All @@ -12,7 +13,7 @@ public class RobotHardware {
public DcMotor rightFrontDrive = null;
public DcMotor rightBackDrive = null;

public DcMotor liftMotor = null;
public DcMotorEx liftMotor = null;

// Define a constructor that allows the OpMode to pass a reference to itself.
public RobotHardware(LinearOpMode opMode) {
Expand All @@ -27,7 +28,7 @@ public void init() {
rightFrontDrive = myOpMode.hardwareMap.get(DcMotor.class, "rightFrontDrive");
rightBackDrive = myOpMode.hardwareMap.get(DcMotor.class, "rightBackDrive");

liftMotor = myOpMode.hardwareMap.get(DcMotor.class, "liftMotor");
liftMotor = myOpMode.hardwareMap.get(DcMotorEx.class, "liftMotor");
liftMotor.setDirection(DcMotor.Direction.REVERSE);
liftMotor.setMode(DcMotor.RunMode.STOP_AND_RESET_ENCODER);

Expand Down

0 comments on commit c8d34ce

Please sign in to comment.