Exploit databaseDownload repository ZIP
GH-2fcd430444309a7454c351e0400245b4
ackertech/fix-its_2020-21
Sources for CVE-2019-11358
1,181 sourcesPreferred order: Exploit-DB, Metasploit, then GitHub repositories by stars. Open preferred source
Repository files4
ackertech/fix-its_2020-21Revision 4e395232c6d5
Files from this repository share one source choice. Supporting files may cover other vulnerabilities.
TeamCode/src/main/java/org/firstinspires/ftc/teamcode/Base/Controls/TeleOp/ThreadedTeleOp.java
Java · 8,682 bytespackage org.firstinspires.ftc.teamcode.Base.Controls.TeleOp;
import com.qualcomm.robotcore.eventloop.opmode.OpMode;
import com.qualcomm.robotcore.eventloop.opmode.TeleOp;
import com.qualcomm.robotcore.hardware.DcMotorSimple;
import com.qualcomm.robotcore.util.ElapsedTime;
import com.qualcomm.robotcore.util.Range;
import org.firstinspires.ftc.teamcode.Base.Robot.AckerBot;
import org.firstinspires.ftc.teamcode.Base.Robot.LedThread;
//@Disabled
//@TeleOp(name = "TeleOp - AckerBot - Threading")
public class ThreadedTeleOp extends OpMode {
// Variables & Constants specific to TeleLabBot
double leftStickYVal;
double leftStickXVal;
double rightStickXVal;
double frontLeftSpeed;
double frontRightSpeed;
double rearLeftSpeed;
double rearRightSpeed;
double powerThreshold = 0;
double speedMultiply = 1;
boolean reverseModeToggle = true;
// Object Construction
public ElapsedTime TeleOpTime = new ElapsedTime();
public AckerBot Bot = new AckerBot();
public LedThread myLedThread = new LedThread();
// Runs ONCE when driver presses INIT
@Override
public void init() {
//Hardware Initialization from Robot Class
Bot.initRobot(hardwareMap);
}
// Runs Repeatedly when driver presses INIT but before pressing PLAY
@Override
public void init_loop() {
}
// Runs ONCE when driver presses PLAY
@Override
public void start() {
//myLedThread.start();
}
// RUNS Repeatedly after driver presses PLAY
@Override
public void loop() {
drive();
driveMode();
//controlLED();
controlThread();
telemetryOutput();
}
// Code to run ONCE after the driver presses STOP
@Override
public void stop() {
//myLedThread.interrupt();
}
public void telemetryOutput() {
telemetry.addData("LED", "TeleOp Time: " + Bot.currentTime);
telemetry.addData("LED", "LED Timer: " + Bot.ledTimer);
telemetry.addData("LED", "LED Counter: " + Bot.ledCounter);
telemetry.addData("LED", "LED Pattern: " + Bot.ledPattern);
telemetry.addData("LED", "LED Pattern: " + Bot.ledLights);
telemetry.addData("pwr", "FL mtr: " + frontLeftSpeed);
telemetry.addData("pwr", "FR mtr: " + frontRightSpeed);
telemetry.addData("pwr", "RL mtr: " + rearLeftSpeed);
telemetry.addData("pwr", "RR mtr: " + rearRightSpeed);
telemetry.addData("Left joystick Y (gp2): ", gamepad2.left_stick_y);
telemetry.addData("Right joystick Y (gp2): ", gamepad2.right_stick_y);
telemetry.update();
}
public void drive () {
if (reverseModeToggle) {
leftStickYVal = -gamepad1.left_stick_y;
leftStickYVal = Range.clip(leftStickYVal, -1, 1);
leftStickXVal = gamepad1.left_stick_x;
leftStickXVal = Range.clip(leftStickXVal, -1, 1);
rightStickXVal = -gamepad1.right_stick_x;
rightStickXVal = Range.clip(rightStickXVal, -1, 1);
Bot.frontLeftMotor.setDirection(DcMotorSimple.Direction.FORWARD);
Bot.rearLeftMotor.setDirection(DcMotorSimple.Direction.FORWARD);
Bot.frontRightMotor.setDirection(DcMotorSimple.Direction.REVERSE);
Bot.rearRightMotor.setDirection(DcMotorSimple.Direction.REVERSE);
frontLeftSpeed = leftStickYVal + leftStickXVal + rightStickXVal;
frontLeftSpeed = Range.clip(frontLeftSpeed, -1, 1);
frontRightSpeed = leftStickYVal - leftStickXVal - rightStickXVal;
frontRightSpeed = Range.clip(frontRightSpeed, -1, 1);
rearLeftSpeed = leftStickYVal - leftStickXVal + rightStickXVal;
rearLeftSpeed = Range.clip(rearLeftSpeed, -1, 1);
rearRightSpeed = leftStickYVal + leftStickXVal - rightStickXVal;
rearRightSpeed = Range.clip(rearRightSpeed, -1, 1);
if (frontLeftSpeed <= powerThreshold && frontLeftSpeed >= -powerThreshold) {
frontLeftSpeed = 0;
Bot.frontLeftMotor.setPower(frontLeftSpeed);
} else {
Bot.frontLeftMotor.setPower(frontLeftSpeed * speedMultiply);
}
if (frontRightSpeed <= powerThreshold && frontRightSpeed >= -powerThreshold){
frontRightSpeed = 0;
Bot.frontRightMotor.setPower(frontRightSpeed);
} else {
Bot.frontRightMotor.setPower(frontRightSpeed * speedMultiply);
}
if (rearLeftSpeed <= powerThreshold && rearLeftSpeed >= -powerThreshold) {
rearLeftSpeed = 0;
Bot.rearLeftMotor.setPower(rearLeftSpeed);
} else {
Bot.rearLeftMotor.setPower(rearLeftSpeed * speedMultiply);
}
if (rearRightSpeed <= powerThreshold && rearRightSpeed >= -powerThreshold){
rearRightSpeed = 0;
Bot.rearRightMotor.setPower(rearRightSpeed);
} else {
Bot.rearRightMotor.setPower(rearRightSpeed * speedMultiply);
}
}
else {
leftStickYVal = -gamepad1.left_stick_y;
leftStickYVal = Range.clip(leftStickYVal, -1, 1);
leftStickXVal = gamepad1.left_stick_x;
leftStickXVal = Range.clip(leftStickXVal, -1, 1);
rightStickXVal = gamepad1.right_stick_x;
rightStickXVal = Range.clip(rightStickXVal, -1, 1);
Bot.frontLeftMotor.setDirection(DcMotorSimple.Direction.REVERSE);
Bot.rearLeftMotor.setDirection(DcMotorSimple.Direction.REVERSE);
Bot.frontRightMotor.setDirection(DcMotorSimple.Direction.FORWARD);
Bot.rearRightMotor.setDirection(DcMotorSimple.Direction.FORWARD);
frontLeftSpeed = leftStickYVal + leftStickXVal + rightStickXVal;
frontLeftSpeed = Range.clip(frontLeftSpeed, -1, 1);
frontRightSpeed = leftStickYVal - leftStickXVal - rightStickXVal;
frontRightSpeed = Range.clip(frontRightSpeed, -1, 1);
rearLeftSpeed = leftStickYVal - leftStickXVal + rightStickXVal;
rearLeftSpeed = Range.clip(rearLeftSpeed, -1, 1);
rearRightSpeed = leftStickYVal + leftStickXVal - rightStickXVal;
rearRightSpeed = Range.clip(rearRightSpeed, -1, 1);
if (frontLeftSpeed <= powerThreshold && frontLeftSpeed >= -powerThreshold) {
frontLeftSpeed = 0;
Bot.frontLeftMotor.setPower(frontLeftSpeed);
} else {
Bot.frontLeftMotor.setPower(frontLeftSpeed * speedMultiply);
}
if (frontRightSpeed <= powerThreshold && frontRightSpeed >= -powerThreshold){
frontRightSpeed = 0;
Bot.frontRightMotor.setPower(frontRightSpeed);
} else {
Bot.frontRightMotor.setPower(frontRightSpeed * speedMultiply);
}
if (rearLeftSpeed <= powerThreshold && rearLeftSpeed >= -powerThreshold) {
rearLeftSpeed = 0;
Bot.rearLeftMotor.setPower(rearLeftSpeed);
} else {
Bot.rearLeftMotor.setPower(rearLeftSpeed * speedMultiply);
}
if (rearRightSpeed <= powerThreshold && rearRightSpeed >= -powerThreshold){
rearRightSpeed = 0;
Bot.rearRightMotor.setPower(rearRightSpeed);
} else {
Bot.rearRightMotor.setPower(rearRightSpeed * speedMultiply);
}
}
}
public void driveMode () {
if (gamepad1.dpad_up) {
speedMultiply = 1.0;
}
if (gamepad1.dpad_down) {
speedMultiply = 0.5;
}
if (gamepad1.dpad_right) {
reverseModeToggle = true;
}
if (gamepad1.dpad_left) {
reverseModeToggle = false;
}
}
public void controlLED () {
if (gamepad1.left_trigger > 0.1)
Bot.ledLights.setPattern(Bot.patternArray[0]);
else if (gamepad1.right_trigger > 0.1)
Bot.ledLights.setPattern(Bot.patternArray[1]);
else if (gamepad1.left_bumper)
Bot.ledLights.setPattern(Bot.patternArray[3]);
else if (gamepad1.right_bumper)
Bot.ledLights.setPattern(Bot.patternArray[4]);
else {
Bot.ledLights.setPattern(Bot.patternArray[7]);
}
}
public void controlThread() {
if(gamepad1.a) {
myLedThread.start();
}
if(gamepad1.b) {
myLedThread.interrupt();
}
}
}