Exploit database

GH-a985794e39b5aa1743bb809e695ee65a

1toldyou/yetanotherpowerplay

GitHubNot listedPoC
Download repository ZIP

Sources for CVE-2019-11358

1,181 sources

Preferred order: Exploit-DB, Metasploit, then GitHub repositories by stars. Open preferred source

Repository files2

Files from this repository share one source choice. Supporting files may cover other vulnerabilities.

Imposteen750/src/main/java/org/firstinspires/ftc/imposteen750/opmode/auto/LeftAutoHalf.java

Java · 9,369 bytes
package org.firstinspires.ftc.imposteen750.opmode.auto;

import static org.firstinspires.ftc.imposteen750.common.commandbase.subsystem.IntakeSubsystem.CYCLE_GRAB_POSITIONS;

import com.acmerobotics.dashboard.config.Config;
import com.arcrobotics.ftclib.command.CommandScheduler;
import com.arcrobotics.ftclib.command.InstantCommand;
import com.arcrobotics.ftclib.command.ParallelCommandGroup;
import com.arcrobotics.ftclib.command.SequentialCommandGroup;
import com.arcrobotics.ftclib.command.WaitCommand;
import com.outoftheboxrobotics.photoncore.PhotonCore;
import com.qualcomm.hardware.lynx.LynxModule;
import com.qualcomm.robotcore.eventloop.opmode.Autonomous;
import com.qualcomm.robotcore.eventloop.opmode.LinearOpMode;

import org.firstinspires.ftc.robotcore.external.hardware.camera.WebcamName;
import org.firstinspires.ftc.imposteen750.common.commandbase.auto.AutoCycleCommand;
import org.firstinspires.ftc.imposteen750.common.commandbase.auto.PositionCommand;
import org.firstinspires.ftc.imposteen750.common.commandbase.auto.SwerveXCommand;
import org.firstinspires.ftc.imposteen750.common.commandbase.commands.LiftPositionCommand;
import org.firstinspires.ftc.imposteen750.common.commandbase.subsystem.IntakeSubsystem;
import org.firstinspires.ftc.imposteen750.common.commandbase.subsystem.LiftSubsystem;
import org.firstinspires.ftc.imposteen750.common.drive.drive.Drivetrain;
import org.firstinspires.ftc.imposteen750.common.drive.drive.swerve.SwerveModule;
import org.firstinspires.ftc.imposteen750.common.drive.geometry.Pose;
import org.firstinspires.ftc.imposteen750.common.drive.localizer.Localizer;
import org.firstinspires.ftc.imposteen750.common.drive.localizer.TwoWheelLocalizer;
import org.firstinspires.ftc.imposteen750.common.hardware.Robot;
import org.firstinspires.ftc.imposteen750.common.powerplay.SleeveDetection;
import org.opencv.core.Point;
import org.openftc.easyopencv.OpenCvCamera;
import org.openftc.easyopencv.OpenCvCameraFactory;
import org.openftc.easyopencv.OpenCvCameraRotation;

@Autonomous(name = "⬅️ LeftAuto 1+5 ⬅️")
@Config
public class LeftAutoHalf extends LinearOpMode {

    SleeveDetection sleeveDetection = new SleeveDetection();
    OpenCvCamera camera;
    private double loopTime;

    @Override
    public void runOpMode() throws InterruptedException {
        CommandScheduler.getInstance().reset();
        Robot robot = new Robot(hardwareMap, true);
        Drivetrain drivetrain = robot.drivetrain;

        Localizer localizer = new TwoWheelLocalizer(
                () -> robot.horizontalEncoder.getPosition(),
                () -> robot.lateralEncoder.getPosition(),
                robot::getAngle
        );

        robot.localizer = localizer;
//        robot.intake.update(IntakeSubsystem.FourbarState.TRANSITION);
//        robot.intake.update(IntakeSubsystem.ClawState.CLOSED);
//        robot.lift.update(LiftSubsystem.LatchState.LATCHED);
//        robot.intake.update(IntakeSubsystem.ClawState.OPEN);
//        robot.intake.update(IntakeSubsystem.PivotState.FLAT);
//        robot.intake.update(IntakeSubsystem.TurretState.INTAKE);

        PhotonCore.CONTROL_HUB.setBulkCachingMode(LynxModule.BulkCachingMode.MANUAL);
        PhotonCore.EXPANSION_HUB.setBulkCachingMode(LynxModule.BulkCachingMode.MANUAL);
        PhotonCore.experimental.setMaximumParallelCommands(8);
        PhotonCore.enable();

        int cameraMonitorViewId = hardwareMap.appContext.getResources().getIdentifier("cameraMonitorViewId", "id", hardwareMap.appContext.getPackageName());
        camera = OpenCvCameraFactory.getInstance().createWebcam(hardwareMap.get(WebcamName.class, "Webcam 1"), cameraMonitorViewId);
        sleeveDetection = new SleeveDetection(new Point(90, 80));
        camera.setPipeline(sleeveDetection);

        camera.openCameraDeviceAsync(new OpenCvCamera.AsyncCameraOpenListener() {
            @Override
            public void onOpened() {
                camera.startStreaming(320, 240, OpenCvCameraRotation.UPRIGHT);
            }

            @Override
            public void onError(int errorCode) {

            }
        });

        while (!isStarted()) {
            robot.read();
            for (SwerveModule module : robot.drivetrain.modules) {
                module.setTargetRotation(0);
            }
            robot.drivetrain.updateModules();

            telemetry.addLine("RUNNING LEFT 5 CYCLE");
            telemetry.addLine(sleeveDetection.getPosition().toString());

            telemetry.update();

            PhotonCore.CONTROL_HUB.clearBulkCache();
            PhotonCore.EXPANSION_HUB.clearBulkCache();
            robot.write();
        }

        SleeveDetection.ParkingPosition position = sleeveDetection.getPosition();

        waitForStart();
        camera.stopStreaming();
        robot.startIMUThread(this);

        CommandScheduler.getInstance().schedule(
                new SequentialCommandGroup(
                        new ParallelCommandGroup(
                                new SequentialCommandGroup(
                                        new PositionCommand(drivetrain, localizer, new Pose(-3.5, 56.5, 4.49), 500, 3000, hardwareMap.voltageSensor.iterator().next().getVoltage()),
                                        new SwerveXCommand(robot.drivetrain)

                                ),

                                new WaitCommand(1700).andThen(new SequentialCommandGroup(
                                        new AutoCycleCommand(robot, CYCLE_GRAB_POSITIONS[0]),
                                        new AutoCycleCommand(robot, CYCLE_GRAB_POSITIONS[1]),
                                        new AutoCycleCommand(robot, CYCLE_GRAB_POSITIONS[2]),
                                        new AutoCycleCommand(robot, CYCLE_GRAB_POSITIONS[3]),
                                        new AutoCycleCommand(robot, CYCLE_GRAB_POSITIONS[4])
//                                        new InstantCommand(() -> robot.intake.update(IntakeSubsystem.FourbarState.TRANSITION)),
//                                        new InstantCommand(() -> robot.intake.update(IntakeSubsystem.ClawState.OPEN)),
//                                        new InstantCommand(() -> robot.intake.update(IntakeSubsystem.PivotState.FLAT)),
//                                        new InstantCommand(() -> robot.lift.update(LiftSubsystem.LatchState.LATCHED)),
//                                        new LiftPositionCommand(robot.lift, 585, 6000, 7500, 30, 1000, LiftSubsystem.STATE.FAILED_EXTEND),
//                                        new WaitCommand(500),
//                                        new LiftPositionCommand(robot.lift, -5, 6000, 7500, 10, 1000, LiftSubsystem.STATE.FAILED_RETRACT)
//                                                .alongWith(new WaitCommand(50).andThen(new InstantCommand(() -> robot.lift.update(LiftSubsystem.LatchState.UNLATCHED))))
                                ))
                        ),

                        new PositionCommand(drivetrain, localizer,
                                position == SleeveDetection.ParkingPosition.CENTER ? new Pose(-3, 49, 0) :
                                        position == SleeveDetection.ParkingPosition.RIGHT ? new Pose(23, 51, 0) :
                                                new Pose(-25, 49, 0), 2000, 2000, hardwareMap.voltageSensor.iterator().next().getVoltage()
                        ),

                        new InstantCommand(this::requestOpModeStop)
                )
        );

        robot.reset();

        while (opModeIsActive()) {
            robot.read();

//            if (robot.intake.state == IntakeSubsystem.STATE.FAILED_RETRACT || robot.lift.state == LiftSubsystem.STATE.FAILED_RETRACT) {
//                CommandScheduler.getInstance().reset();
//                CommandScheduler.getInstance().schedule(
//                        new SequentialCommandGroup(
//                                new PositionCommand(drivetrain, localizer,
//                                        position == SleeveDetection.ParkingPosition.CENTER ? new Pose(-3, 49, 0) :
//                                                position == SleeveDetection.ParkingPosition.RIGHT ? new Pose(23, 51, 0) :
//                                                        new Pose(-25, 49, 0), 2000, 2000, hardwareMap.voltageSensor.iterator().next().getVoltage()
//                                ),
//                                new InstantCommand(this::requestOpModeStop)
//                        )
//                );
//            }

            CommandScheduler.getInstance().run();
//            robot.intake.loop();
//            robot.lift.loop();
            robot.drivetrain.updateModules();
            localizer.periodic();

//            telemetry.addData("STATE: ", robot.intake.state);
//            telemetry.addData("STATE: ", robot.lift.state);
//            telemetry.addData("targetPos", robot.intake.targetPosition);
//            telemetry.addData("intakePos", robot.intake.getPos());
            telemetry.addData("current pose", localizer.getPos());

            double loop = System.nanoTime();
            telemetry.addData("hz ", 1000000000 / (loop - loopTime));
            loopTime = loop;
            telemetry.update();
            robot.write();
            PhotonCore.CONTROL_HUB.clearBulkCache();
        }
    }
}