Exploit databaseDownload repository ZIP
GH-4e68e70879a1abcbae26a45b2f55349a
4537-enterprise/drss_21_22_season_auto_update
Sources for CVE-2019-11358
1,181 sourcesPreferred order: Exploit-DB, Metasploit, then GitHub repositories by stars. Open preferred source
Repository files5
4537-enterprise/drss_21_22_season_auto_updateRevision b8c784bc8895
Files from this repository share one source choice. Supporting files may cover other vulnerabilities.
TeamCode/src/main/java/org/firstinspires/ftc/teamcode/subsystems/webcam/WebcamBlue.java
Java · 6,234 bytespackage org.firstinspires.ftc.teamcode.subsystems.webcam;
import com.acmerobotics.dashboard.FtcDashboard;
import com.qualcomm.robotcore.hardware.HardwareMap;
import org.firstinspires.ftc.robotcore.external.ClassFactory;
import org.firstinspires.ftc.robotcore.external.Telemetry;
import org.firstinspires.ftc.robotcore.external.hardware.camera.WebcamName;
import org.firstinspires.ftc.robotcore.external.navigation.VuforiaLocalizer;
import org.firstinspires.ftc.robotcore.external.tfod.Recognition;
import org.firstinspires.ftc.robotcore.external.tfod.TFObjectDetector;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
/**
* Created by Antoine on 1/18/2022
*/
public class WebcamBlue{
private HardwareMap map;
private Telemetry telemetry;
/* FreightFrenzy_DM.tflite 0: Duck, 1: Marker */
private static final String TFOD_MODEL_ASSET = "FreightFrenzy_DM.tflite";
private static final String[] LABELS = {
"Duck",
"Marker"
};
private static final String VUFORIA_KEY = "AUz/xEr/////AAABmZjEf3Mc1kGYkOsXVF3u1Gl8gO6qZozGZxty6mcO/xE35elxxgMBwh4/zzwC9Dh4EPKvDexbQAVpjQJzz+Cx+PMYbKiPfvJNsyHDoJkWCPC1skmjKJq/4ctLkD1zGtWPhVUsdGK9ib6ze346j5nHgoFwzoi4SAITZUfQZEj2ccyiWs3zvY2DzbL/QgXrk391epqrpmB6y96vnvCsTUYA6i1y8pg7TZmjUBNWC/3PMr0EHBAFzu+cgtMWVD2sjR9XYcyh9eCRKFNq1aZwikL2P2F4Px5eyujkCVBsnQ0N+dNBo/UCREIF2az5iJY/x+qnrr8aZ2Rj1Gri12gHuKLT7BWS73HKsC9XVURurHz9RmJs";
public VuforiaLocalizer vuforia;
private TFObjectDetector tfod;
public double duckXPosition = 0;
double[] positions = new double[3];
List<Recognition> updatedRecognitions;
public WebcamBlue(HardwareMap map, Telemetry telemetry) {
this.map = map;
this.telemetry = telemetry;
telemetry.addData("Initializing", "Vuforia");
telemetry.update();
positions[0] = 8.0;
positions[1] = 242.0;
positions[2] = 498.0;
initVuforia();
initTfod();
/**
* Activate TensorFlow Object Detection before we wait for the start command.
* Do it here so that the Camera Stream window will have the TensorFlow annotations visible.
**/
if (tfod != null) {
tfod.activate();
// The TensorFlow software will scale the input images from the camera to a lower resolution.
// This can result in lower detection accuracy at longer distances (> 55cm or 22").
// If your target is at distance greater than 50 cm (20") you can adjust the magnification value
// to artificially zoom in to the center of image. For best results, the "aspectRatio" argument
// should be set to the value of the images used to create the TensorFlow Object Detection model
// (typically 16/9).
tfod.setZoom(1.0, 16.0/9.0);
}
telemetry.addData("Vuforia", "Initialized");
telemetry.update();
}
private void initVuforia() {
/*
* Configure Vuforia by creating a Parameter object, and passing it to the Vuforia engine.
*/
VuforiaLocalizer.Parameters parameters = new VuforiaLocalizer.Parameters();
parameters.vuforiaLicenseKey = VUFORIA_KEY;
parameters.cameraName = map.get(WebcamName.class, "Webcam");
// Instantiate the Vuforia engine
vuforia = ClassFactory.getInstance().createVuforia(parameters);
// Start streaming to FTC Dashboard
FtcDashboard.getInstance().startCameraStream(vuforia, 0);
}
/**
* Initialize the TensorFlow Object Detection engine.
*/
private void initTfod() {
int tfodMonitorViewId = map.appContext.getResources().getIdentifier(
"tfodMonitorViewId", "id", map.appContext.getPackageName());
TFObjectDetector.Parameters tfodParameters = new TFObjectDetector.Parameters(tfodMonitorViewId);
tfodParameters.minResultConfidence = 0.8f;
tfodParameters.isModelTensorFlow2 = true;
tfodParameters.inputSize = 320;
tfod = ClassFactory.getInstance().createTFObjectDetector(tfodParameters, vuforia);
tfod.loadModelFromAsset(TFOD_MODEL_ASSET, LABELS);
}
public void getWebcamData() {
if (tfod != null) {
// getUpdatedRecognitions() will return null if no new information is available since
// the last time that call was made.
List<Recognition> updatedRecognitions = tfod.getUpdatedRecognitions();
if (updatedRecognitions != null) {
telemetry.addData("# Object Detected", updatedRecognitions.size());
// step through the list of recognitions and display boundary info.
int i = 0;
for (Recognition recognition : updatedRecognitions) {
telemetry.addData(String.format("label (%d)", i), recognition.getLabel());
telemetry.addData(String.format(" left,top (%d)", i), "%.03f , %.03f",
recognition.getLeft(), recognition.getTop());
telemetry.addData(String.format(" right,bottom (%d)", i), "%.03f , %.03f",
recognition.getRight(), recognition.getBottom());
i++;
}
}
}
}
void getDuckPosition() {
updatedRecognitions = tfod.getUpdatedRecognitions();
if (updatedRecognitions != null) {
for (Recognition tfodItem : updatedRecognitions) {
if (tfodItem.getLabel() == "Duck") {
duckXPosition = tfodItem.getLeft();
}
}
}
}
int getClosestPosition() {
double distance = Math.abs(positions[0] - duckXPosition);
int closestPosition = 0;
for (int i = 1; i < positions.length; i++) {
double iDistance = Math.abs(positions[i] - duckXPosition);
if(iDistance < distance){
closestPosition = i;
distance = iDistance;
}
}
closestPosition++;
return closestPosition;
}
public int locateDuck() {
getDuckPosition();
return getClosestPosition();
}
}