This repository has been archived by the owner on Nov 10, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
91fb712
commit 9921f06
Showing
2 changed files
with
37 additions
and
17 deletions.
There are no files selected for viewing
17 changes: 0 additions & 17 deletions
17
TeamCode/src/main/java/org/firstinspires/ftc/teamcode/Tools/Modules/RobeLift.java
This file was deleted.
Oops, something went wrong.
37 changes: 37 additions & 0 deletions
37
TeamCode/src/main/java/org/firstinspires/ftc/teamcode/Tools/Modules/RopeLift.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package org.firstinspires.ftc.teamcode.Tools.Modules; | ||
|
||
import com.qualcomm.robotcore.hardware.DcMotor; | ||
|
||
public class RopeLift { | ||
private DcMotor LiftMotor; | ||
private int steps_min; | ||
private int steps_max; | ||
private int steps_sum; | ||
|
||
public RopeLift() { | ||
} | ||
|
||
public void setPower(double power,boolean W) { | ||
if (W) | ||
LiftMotor.setPower(power); | ||
else { | ||
if (Math.max(LiftMotor.getCurrentPosition(), steps_min) == Math.min(LiftMotor.getCurrentPosition(), steps_max)) | ||
LiftMotor.setPower(power); | ||
else | ||
setTargetPosition(((LiftMotor.getCurrentPosition() > steps_max) ? steps_max : steps_min), power); | ||
if (LiftMotor.getMode() != DcMotor.RunMode.RUN_USING_ENCODER) | ||
LiftMotor.setMode(DcMotor.RunMode.RUN_USING_ENCODER); | ||
} | ||
} | ||
public void setTargetPosition(int steps, double v) { | ||
steps_sum = (Math.min(steps_min + steps, steps_max)); | ||
LiftMotor.setTargetPosition(steps_sum); | ||
|
||
if (LiftMotor.getMode() != DcMotor.RunMode.RUN_TO_POSITION) | ||
LiftMotor.setMode(DcMotor.RunMode.RUN_TO_POSITION); | ||
|
||
LiftMotor.setPower(v); | ||
} | ||
public void step() { | ||
} | ||
} |