Open WebCoder49 opened 1 year ago
We could use a SensorRevTOFDistance object.
import com.arcrobotics.ftclib.hardware.SensorDistanceEx; import com.arcrobotics.ftclib.hardware.SensorRevTOFDistance; import org.firstinspires.ftc.robotcore.external.navigation.DistanceUnit; import org.firstinspires.ftc.teamcode.libs.brightonCollege.modeBases.TeleOpModeBase; import org.firstinspires.ftc.teamcode.libs.brightonCollege.util.HardwareMapContainer; SensorRevTOFDistance distanceSensor = new SensorRevTOFDistance(HardwareMapContainer.getMap(), "DemoDistanceSensor");
And every tick:
if (distanceSensor.targetReached(new SensorDistanceEx.DistanceTarget(DistanceUnit.CM, 10D))) { System.out.println("Stuff detected within 10cm"); }
This probably won't work, but whatever...
NB: We can't use a distance sensor, as we don't have one of those.
We could use a SensorRevTOFDistance object.
And every tick:
This probably won't work, but whatever...