Exploit databaseDownload repository ZIP
GH-9bcbb743cc3ba4a0e45c3bb611135c1d
22817-knotbot/ftc-rc-2024
Sources for CVE-2019-11358
1,181 sourcesPreferred order: Exploit-DB, Metasploit, then GitHub repositories by stars. Open preferred source
Repository files4
22817-knotbot/ftc-rc-2024Revision d8134a1920c0
- ↑..Parent directory
- ForwardVelocityTuner.java
- ForwardZeroPowerAccelerationTuner.java
- LateralZeroPowerAccelerationTuner.java
- StrafeVelocityTuner.java
Files from this repository share one source choice. Supporting files may cover other vulnerabilities.
TeamCode/src/main/java/pedroPathing/tuners_tests/automatic/ForwardVelocityTuner.java
Java · 7,098 bytespackage pedroPathing.tuners_tests.automatic;
import static com.pedropathing.follower.FollowerConstants.leftFrontMotorName;
import static com.pedropathing.follower.FollowerConstants.leftRearMotorName;
import static com.pedropathing.follower.FollowerConstants.rightFrontMotorName;
import static com.pedropathing.follower.FollowerConstants.rightRearMotorName;
import static com.pedropathing.follower.FollowerConstants.leftFrontMotorDirection;
import static com.pedropathing.follower.FollowerConstants.leftRearMotorDirection;
import static com.pedropathing.follower.FollowerConstants.rightFrontMotorDirection;
import static com.pedropathing.follower.FollowerConstants.rightRearMotorDirection;
import com.acmerobotics.dashboard.FtcDashboard;
import com.acmerobotics.dashboard.config.Config;
import com.acmerobotics.dashboard.telemetry.MultipleTelemetry;
import com.pedropathing.util.Constants;
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.configuration.typecontainers.MotorConfigurationType;
import org.firstinspires.ftc.robotcore.external.Telemetry;
import com.pedropathing.localization.PoseUpdater;
import com.pedropathing.pathgen.MathFunctions;
import com.pedropathing.pathgen.Vector;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import pedroPathing.constants.FConstants;
import pedroPathing.constants.LConstants;
/**
* This is the ForwardVelocityTuner autonomous follower OpMode. This runs the robot forwards at max
* power until it reaches some specified distance. It records the most recent velocities, and on
* reaching the end of the distance, it averages them and prints out the velocity obtained. It is
* recommended to run this multiple times on a full battery to get the best results. What this does
* is, when paired with StrafeVelocityTuner, allows FollowerConstants to create a Vector that
* empirically represents the direction your mecanum wheels actually prefer to go in, allowing for
* more accurate following.
* You can adjust the distance the robot will travel 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 = "Forward Velocity Tuner", group = "Automatic Tuners")
public class ForwardVelocityTuner extends OpMode {
private ArrayList<Double> velocities = new ArrayList<>();
private DcMotorEx leftFront;
private DcMotorEx leftRear;
private DcMotorEx rightFront;
private DcMotorEx rightRear;
private List<DcMotorEx> motors;
private PoseUpdater poseUpdater;
public static double DISTANCE = 48;
public static double RECORD_NUMBER = 10;
private Telemetry telemetryA;
private boolean end;
/**
* This initializes the drive motors as well as the cache of velocities and the FTC Dashboard
* telemetry.
*/
@Override
public void init() {
Constants.setConstants(FConstants.class, LConstants.class);
poseUpdater = new PoseUpdater(hardwareMap);
leftFront = hardwareMap.get(DcMotorEx.class, leftFrontMotorName);
leftRear = hardwareMap.get(DcMotorEx.class, leftRearMotorName);
rightRear = hardwareMap.get(DcMotorEx.class, rightRearMotorName);
rightFront = hardwareMap.get(DcMotorEx.class, rightFrontMotorName);
leftFront.setDirection(leftFrontMotorDirection);
leftRear.setDirection(leftRearMotorDirection);
rightFront.setDirection(rightFrontMotorDirection);
rightRear.setDirection(rightRearMotorDirection);
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);
}
for (int i = 0; i < RECORD_NUMBER; i++) {
velocities.add(0.0);
}
telemetryA = new MultipleTelemetry(this.telemetry, FtcDashboard.getInstance().getTelemetry());
telemetryA.addLine("The robot will run at 1 power until it reaches " + DISTANCE + " inches forward.");
telemetryA.addLine("Make sure you have enough room, since the robot has inertia after cutting power.");
telemetryA.addLine("After running the distance, the robot will cut power from the drivetrain and display the forward velocity.");
telemetryA.addLine("Press CROSS or A on game pad 1 to stop.");
telemetryA.addData("pose", poseUpdater.getPose());
telemetryA.update();
}
/**
* This starts the OpMode by setting the drive motors to run forward at full power.
*/
@Override
public void start() {
leftFront.setPower(1);
leftRear.setPower(1);
rightFront.setPower(1);
rightRear.setPower(1);
end = false;
}
/**
* 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. This continuously records the RECORD_NUMBER most recent
* velocities, and when the robot has run forward enough, these last velocities recorded are
* averaged and printed.
*/
@Override
public void loop() {
if (gamepad1.cross || gamepad1.a) {
for (DcMotorEx motor : motors) {
motor.setZeroPowerBehavior(DcMotor.ZeroPowerBehavior.BRAKE);
motor.setPower(0);
}
requestOpModeStop();
}
poseUpdater.update();
if (!end) {
if (Math.abs(poseUpdater.getPose().getX()) > DISTANCE) {
end = true;
for (DcMotorEx motor : motors) {
motor.setZeroPowerBehavior(DcMotor.ZeroPowerBehavior.BRAKE);
motor.setPower(0);
}
} else {
double currentVelocity = Math.abs(MathFunctions.dotProduct(poseUpdater.getVelocity(), new Vector(1, 0)));
velocities.add(currentVelocity);
velocities.remove(0);
}
} else {
leftFront.setPower(0);
leftRear.setPower(0);
rightFront.setPower(0);
rightRear.setPower(0);
for (DcMotorEx motor : motors) {
motor.setZeroPowerBehavior(DcMotor.ZeroPowerBehavior.BRAKE);
}
double average = 0;
for (Double velocity : velocities) {
average += velocity;
}
average /= (double) velocities.size();
telemetryA.addData("forward velocity:", average);
telemetryA.update();
}
}
}