Exploit databaseDownload repository ZIP
GH-17c1e7899cfff2194dc77a67b4010017
201-991-broncobotics/ftc-201-intothedeep
Sources for CVE-2019-11358
1,181 sourcesPreferred order: Exploit-DB, Metasploit, then GitHub repositories by stars. Open preferred source
Repository files8
201-991-broncobotics/ftc-201-intothedeepRevision cafd246740d0
- ↑..Parent directory
- Circle.java
- CurvedBackAndForth.java
- FollowerConstants.java
- ForwardVelocityTuner.java
- ForwardZeroPowerAccelerationTuner.java
- LateralZeroPowerAccelerationTuner.java
- StrafeVelocityTuner.java
- StraightBackAndForth.java
Files from this repository share one source choice. Supporting files may cover other vulnerabilities.
TeamCode/src/main/java/org/firstinspires/ftc/teamcode/pedroPathing/tuning/LateralZeroPowerAccelerationTuner.java
Java · 8,077 bytespackage org.firstinspires.ftc.teamcode.pedroPathing.tuning;
import static org.firstinspires.ftc.teamcode.pedroPathing.tuning.FollowerConstants.leftFrontMotorName;
import static org.firstinspires.ftc.teamcode.pedroPathing.tuning.FollowerConstants.leftRearMotorName;
import static org.firstinspires.ftc.teamcode.pedroPathing.tuning.FollowerConstants.rightFrontMotorName;
import static org.firstinspires.ftc.teamcode.pedroPathing.tuning.FollowerConstants.rightRearMotorName;
import static org.firstinspires.ftc.teamcode.subsystems.subsubsystems.functions.tileCoords;
import com.acmerobotics.dashboard.FtcDashboard;
import com.acmerobotics.dashboard.config.Config;
import com.acmerobotics.dashboard.telemetry.MultipleTelemetry;
import com.acmerobotics.roadrunner.Pose2d;
import com.acmerobotics.roadrunner.PoseVelocity2d;
import com.acmerobotics.roadrunner.Vector2d;
import com.qualcomm.robotcore.eventloop.opmode.Autonomous;
import com.qualcomm.robotcore.eventloop.opmode.OpMode;
import com.qualcomm.robotcore.hardware.DcMotor;
import com.qualcomm.robotcore.hardware.DcMotorEx;
import com.qualcomm.robotcore.hardware.DcMotorSimple;
import com.qualcomm.robotcore.hardware.configuration.typecontainers.MotorConfigurationType;
import org.firstinspires.ftc.robotcore.external.Telemetry;
import org.firstinspires.ftc.teamcode.Roadrunner.DifferentialSwerveDrive;
import org.firstinspires.ftc.teamcode.pedroPathing.localization.PoseUpdater;
import org.firstinspires.ftc.teamcode.pedroPathing.pathGeneration.MathFunctions;
import org.firstinspires.ftc.teamcode.pedroPathing.pathGeneration.Vector;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
/**
* This is the LateralZeroPowerAccelerationTuner autonomous tuning OpMode. This runs the robot
* to the right until a specified velocity is achieved. Then, the robot cuts power to the motors, setting
* them to zero power. The deceleration, or negative acceleration, is then measured until the robot
* stops. The accelerations across the entire time the robot is slowing down is then averaged and
* that number is then printed. This is used to determine how the robot will decelerate in the
* forward direction when power is cut, making the estimations used in the calculations for the
* drive Vector more accurate and giving better braking at the end of Paths.
* You can adjust the max velocity the robot will hit on FTC Dashboard: 192/168/43/1:8080/dash
*
* @author Anyi Lin - 10158 Scott's Bots
* @author Aaron Yang - 10158 Scott's Bots
* @author Harrison Womack - 10158 Scott's Bots
* @version 1.0, 3/13/2024
*/
@Config
@Autonomous(name = "Lateral Zero Power Acceleration Tuner", group = "Autonomous Pathing Tuning")
public class LateralZeroPowerAccelerationTuner extends OpMode {
private ArrayList<Double> accelerations = new ArrayList<>();
private DifferentialSwerveDrive swerveDrive;
/*
private DcMotorEx leftFront;
private DcMotorEx leftRear;
private DcMotorEx rightFront;
private DcMotorEx rightRear;
private List<DcMotorEx> motors;
*/
private PoseUpdater poseUpdater;
public static double VELOCITY = 30;
private double previousVelocity;
private long previousTimeNano;
private Telemetry telemetryA;
private boolean stopping;
private boolean end;
/**
* This initializes the drive motors as well as the FTC Dashboard telemetry.
*/
@Override
public void init() {
Pose2d startPose = new Pose2d(tileCoords(0, 0), Math.toRadians(90));
swerveDrive = new DifferentialSwerveDrive(hardwareMap, startPose, telemetry);
poseUpdater = new PoseUpdater(hardwareMap, swerveDrive);
swerveDrive.setDifferentialSwerveZeroBehavior(DcMotor.ZeroPowerBehavior.FLOAT);
/*
leftFront = hardwareMap.get(DcMotorEx.class, leftFrontMotorName);
leftRear = hardwareMap.get(DcMotorEx.class, leftRearMotorName);
rightRear = hardwareMap.get(DcMotorEx.class, rightRearMotorName);
rightFront = hardwareMap.get(DcMotorEx.class, rightFrontMotorName);
// TODO: Make sure that this is the direction your motors need to be reversed in.
leftFront.setDirection(DcMotorSimple.Direction.REVERSE);
leftRear.setDirection(DcMotorSimple.Direction.REVERSE);
motors = Arrays.asList(leftFront, leftRear, rightFront, rightRear);
for (DcMotorEx motor : motors) {
MotorConfigurationType motorConfigurationType = motor.getMotorType().clone();
motorConfigurationType.setAchieveableMaxRPMFraction(1.0);
motor.setMotorType(motorConfigurationType);
}
for (DcMotorEx motor : motors) {
motor.setZeroPowerBehavior(DcMotor.ZeroPowerBehavior.FLOAT);
}
*/
telemetryA = new MultipleTelemetry(this.telemetry, FtcDashboard.getInstance().getTelemetry());
telemetryA.addLine("The robot will run to the right until it reaches " + VELOCITY + " inches per second.");
telemetryA.addLine("Then, it will cut power from the drivetrain and roll to a stop.");
telemetryA.addLine("Make sure you have enough room.");
telemetryA.addLine("After stopping, the lateral zero power acceleration (natural deceleration) will be displayed.");
telemetryA.addLine("Press CROSS or A on game pad 1 to stop.");
telemetryA.update();
}
/**
* This starts the OpMode by setting the drive motors to run forward at full power.
*/
@Override
public void start() {
swerveDrive.setDifferentialSwerve(0, 1, 0);
}
/**
* This runs the OpMode. At any point during the running of the OpMode, pressing CROSS or A on
* game pad 1 will stop the OpMode. When the robot hits the specified velocity, the robot will
* record its deceleration / negative acceleration until it stops. Then, it will average all the
* recorded deceleration / negative acceleration and print that value.
*/
@Override
public void loop() {
if (gamepad1.cross || gamepad1.a) {
/*
for (DcMotorEx motor : motors) {
motor.setZeroPowerBehavior(DcMotor.ZeroPowerBehavior.BRAKE);
motor.setPower(0);
}
*/
swerveDrive.setDifferentialSwerveZeroBehavior(DcMotor.ZeroPowerBehavior.BRAKE);
swerveDrive.stopDifferentialSwerve();
requestOpModeStop();
}
swerveDrive.updateDifferentialSwerve();
poseUpdater.update();
Vector heading = new Vector(1.0, poseUpdater.getPose().getHeading() - Math.PI / 2);
if (!end) {
if (!stopping) {
if (MathFunctions.dotProduct(poseUpdater.getVelocity(), heading) > VELOCITY) {
previousVelocity = MathFunctions.dotProduct(poseUpdater.getVelocity(), heading);
previousTimeNano = System.nanoTime();
stopping = true;
/*
for (DcMotorEx motor : motors) {
motor.setPower(0);
}
*/
swerveDrive.stopDifferentialSwerve();
}
} else {
double currentVelocity = MathFunctions.dotProduct(poseUpdater.getVelocity(), heading);
accelerations.add((currentVelocity - previousVelocity) / ((System.nanoTime() - previousTimeNano) / Math.pow(10.0, 9)));
previousVelocity = currentVelocity;
previousTimeNano = System.nanoTime();
if (currentVelocity < FollowerConstants.pathEndVelocityConstraint) {
end = true;
}
}
} else {
double average = 0;
for (Double acceleration : accelerations) {
average += acceleration;
}
average /= (double) accelerations.size();
telemetryA.addData("lateral zero power acceleration (deceleration):", average);
telemetryA.update();
}
}
}