-
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.
Merge pull request #14 from Team-4536/drive-improvements
Drive improvements
- Loading branch information
Showing
8 changed files
with
132 additions
and
33 deletions.
There are no files selected for viewing
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
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
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
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
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
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
53 changes: 53 additions & 0 deletions
53
TeamCode/src/main/java/org/firstinspires/ftc/teamcode/opModes/demos/PIDArmDemo.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,53 @@ | ||
package org.firstinspires.ftc.teamcode.opModes.demos; | ||
|
||
import androidx.annotation.NonNull; | ||
|
||
import com.qualcomm.robotcore.eventloop.opmode.Disabled; | ||
import com.qualcomm.robotcore.eventloop.opmode.LinearOpMode; | ||
import com.qualcomm.robotcore.hardware.DcMotor; | ||
|
||
import org.firstinspires.ftc.teamcode.functions.NavFunctions; | ||
import org.firstinspires.ftc.teamcode.functions.PIDFunctions; | ||
import org.firstinspires.ftc.teamcode.functions.TelemetryFunctions; | ||
import org.firstinspires.ftc.teamcode.util.Constants; | ||
import org.firstinspires.ftc.teamcode.util.Data.ArmData; | ||
import org.firstinspires.ftc.teamcode.util.Data.DriveData; | ||
import org.firstinspires.ftc.teamcode.util.Data.NavData; | ||
import org.firstinspires.ftc.teamcode.util.Data.PIDData; | ||
import org.firstinspires.ftc.teamcode.util.Data.TelemetryData; | ||
|
||
|
||
|
||
@com.qualcomm.robotcore.eventloop.opmode.TeleOp(name="Arm PID Demo", group="TeleOps") | ||
@Disabled | ||
public class PIDArmDemo extends LinearOpMode { | ||
|
||
@Override | ||
public void runOpMode() { | ||
|
||
TelemetryData telemetry = new TelemetryData("State"); | ||
NavData nav = new NavData(this.hardwareMap); | ||
PIDData armPID = new PIDData(0.01f, 0.0f, 0.0f); | ||
@NonNull DcMotor liftMotor = this.hardwareMap.get(DcMotor.class, "lift_motor"); | ||
|
||
|
||
// Constants.initArm(arm, c); | ||
TelemetryFunctions.sendTelemetry(this.telemetry, telemetry); | ||
|
||
|
||
waitForStart(); | ||
while (opModeIsActive()) { | ||
|
||
NavFunctions.updateDt(nav); | ||
armPID.target += this.gamepad1.left_stick_y * 10 * nav.dt; | ||
|
||
float pidOut = PIDFunctions.updatePID(armPID, liftMotor.getCurrentPosition(), (float)nav.dt); | ||
liftMotor.setPower(pidOut); | ||
telemetry.addChild("Arm encoder", liftMotor.getCurrentPosition()); | ||
telemetry.addChild("Target pos", armPID.target); | ||
telemetry.addChild("pidOut", pidOut); | ||
|
||
} | ||
} | ||
|
||
} |
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