Exploit databaseDownload repository ZIP
GH-503ab6340b482fa46ed075c28f0af021
a2williams/22459_ftccontroller2024
Sources for CVE-2019-11358
1,181 sourcesPreferred order: Exploit-DB, Metasploit, then GitHub repositories by stars. Open preferred source
Repository files2
a2williams/22459_ftccontroller2024Revision 791ee40e421a
Files from this repository share one source choice. Supporting files may cover other vulnerabilities.
TeamCode/src/main/java/TeleOps/Drivetrain.java
Suggested starting fileJava · 4,059 bytespackage TeleOps;
import com.qualcomm.robotcore.eventloop.opmode.TeleOp;
import com.qualcomm.robotcore.hardware.DcMotor;
import com.qualcomm.robotcore.hardware.HardwareMap;
import com.qualcomm.robotcore.hardware.Servo;
public class Drivetrain {
public DcMotor topLeftDriveMotor;
public DcMotor bottomLeftDriveMotor;
public DcMotor topRightDriveMotor;
public DcMotor bottomRightDriveMotor;
public Servo clawServo;
HardwareMap hwMap;
public void init(HardwareMap ahwMap) {
/**
* Assigns the parent hardware map to local ArtemisHardwareMap class variable
* **/
hwMap = ahwMap;
/**
* Hardware initialized and String Names are in the Configuration File for Hardware Map
* **/
// Control HUb
topLeftDriveMotor = hwMap.get(DcMotor.class, "front left");
bottomLeftDriveMotor = hwMap.get(DcMotor.class, "back left");
topRightDriveMotor = hwMap.get(DcMotor.class, "front right");
bottomRightDriveMotor = hwMap.get(DcMotor.class, "back right");
clawServo = hwMap.get(Servo.class, "clawServo");
/**
* Allow the 4 wheel motors to be run without encoders since we are doing a time based autonomous
* **/
topLeftDriveMotor.setMode(DcMotor.RunMode.RUN_WITHOUT_ENCODER);
bottomLeftDriveMotor.setMode(DcMotor.RunMode.RUN_WITHOUT_ENCODER);
topRightDriveMotor.setMode(DcMotor.RunMode.RUN_WITHOUT_ENCODER);
bottomRightDriveMotor.setMode(DcMotor.RunMode.RUN_WITHOUT_ENCODER);
/**
*Since we are putting the motors on different sides we need to reverse direction so that one wheel doesn't pull us backwards
* **/
//THIS IS THE CORRECT ORIENTATION
topLeftDriveMotor.setDirection(DcMotor.Direction.REVERSE);
bottomLeftDriveMotor.setDirection(DcMotor.Direction.REVERSE);
topRightDriveMotor.setDirection(DcMotor.Direction.FORWARD);
bottomRightDriveMotor.setDirection(DcMotor.Direction.FORWARD);
/**
* Reverses shooter motor to shoot the correct way and same with the conveyor motor
* **/
/**
* We are setting the motor 0 mode power to be brake as it actively stops the robot and doesn't rely on the surface to slow down once the robot power is set to 0
* **/
topLeftDriveMotor.setZeroPowerBehavior(DcMotor.ZeroPowerBehavior.BRAKE);
bottomLeftDriveMotor.setZeroPowerBehavior(DcMotor.ZeroPowerBehavior.BRAKE);
topRightDriveMotor.setZeroPowerBehavior(DcMotor.ZeroPowerBehavior.BRAKE);
bottomRightDriveMotor.setZeroPowerBehavior(DcMotor.ZeroPowerBehavior.BRAKE);
/**
*The 4 mecanum wheel motors, intake, conveyor, and shooter motor/servo are set to 0 power to keep it from moving when the user presses the INIT button
* **/
topLeftDriveMotor.setPower(0);
bottomLeftDriveMotor.setPower(0);
topRightDriveMotor.setPower(0);
bottomRightDriveMotor.setPower(0);
}
public void power(double output){
topLeftDriveMotor.setPower(-output);
bottomLeftDriveMotor.setPower(-output);
topRightDriveMotor.setPower(output);
bottomRightDriveMotor.setPower(output);
}
public void moveRobot(double leftStickY, double leftStickX, double rightStickX){
/**
* Wheel powers calculated using gamepad 1's inputs leftStickY, leftStickX, and rightStickX
* **/
double topLeftPower = leftStickY + leftStickX + rightStickX;
double bottomLeftPower = leftStickY - leftStickX + rightStickX;
double topRightPower = leftStickY - leftStickX - rightStickX;
double bottomRightPower = leftStickY + leftStickX - rightStickX;
/**
* Sets the wheel's power
* **/
topLeftDriveMotor.setPower(topLeftPower);
topRightDriveMotor.setPower(topRightPower);
bottomLeftDriveMotor.setPower(bottomLeftPower);
bottomRightDriveMotor.setPower(bottomRightPower);
}
}