Rev Color Sensor v3

Hello guys. A Rev Color Sensor v3 was included with the Rev Expansion Hub that we recently bought, and I’m having issues programming it. In the last meeting, we used Hue to identify whether it was a skystone or not, but the robot needed to be on a range between 0.7" to 1.5". Otherwise, it wouldn’t work. (If Hue > 100 then Skystone Detected). I tried to use RGB values to identify the skystone, but somehow it dropped me inconsistent values from zero to thousands. And that’s not reliable. I’ll attach my code and a video if you want to look at it. Thank you so much!

package org.firstinspires.ftc.teamcode;

import android.app.Activity;
import android.graphics.Color;
import android.view.View;

import com.qualcomm.robotcore.eventloop.opmode.Disabled;
import com.qualcomm.robotcore.eventloop.opmode.LinearOpMode;
import com.qualcomm.robotcore.eventloop.opmode.TeleOp;
import com.qualcomm.robotcore.hardware.ColorSensor;
import com.qualcomm.robotcore.hardware.DistanceSensor;

import org.firstinspires.ftc.robotcore.external.navigation.DistanceUnit;

import java.util.Locale;

@TeleOp(name = “Prueba COLOR”, group = “Sensor”)

public class PruebaSensor extends LinearOpMode {
ColorSensor sensorColor;
DistanceSensor sensorDistance;

@Override
public void runOpMode() {

    sensorColor = hardwareMap.get(ColorSensor.class, "sen");
    sensorDistance = hardwareMap.get(DistanceSensor.class, "sen");

    waitForStart();

    while (opModeIsActive()) {
        telemetry.addData("RED", sensorColor.red());
        telemetry.addData("BLUE", sensorColor.blue());
        telemetry.addData("GREEN", sensorColor.green());
        telemetry.update();
    }

}

}

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.