Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
143 commits
Select commit Hold shift + click to select a range
0e67cf2
added a point3d class
DevenBalaji Aug 3, 2025
64af267
Merge branch 'develop'
DevenBalaji Sep 7, 2025
0707cf6
obelisk tag detector added
DevenBalaji Sep 7, 2025
84ccd94
changed tag detector to give pattern and index of green
DevenBalaji Sep 7, 2025
f872e0c
updated to ftc controller v11.0 by copying every file except teamcode…
DevenBalaji Sep 9, 2025
570865f
Merge branch 'upgradeTo11.0' into obeliskTag
DevenBalaji Sep 9, 2025
2630224
basic shooter code
DevenBalaji Sep 9, 2025
0c30456
basic 6wd, no localization
DevenBalaji Sep 10, 2025
3e9d9f8
pinpoint gobilda code
DevenBalaji Sep 10, 2025
943945b
added pinpoint code
DevenBalaji Sep 10, 2025
caeaebd
created pure pursuit computer
DevenBalaji Sep 10, 2025
01649bc
basic turret code
DevenBalaji Sep 12, 2025
6434b7f
started pure pursuit computer
DevenBalaji Sep 13, 2025
09172f8
tags work
DevenBalaji Sep 13, 2025
27e93c5
line circle intersections
DevenBalaji Sep 16, 2025
9974433
added obelisk tag + localization for limelight
DevenBalaji Sep 16, 2025
18817b3
ll obelisk works
DevenBalaji Sep 19, 2025
e060e70
finding best goal point
DevenBalaji Sep 20, 2025
fdb61ac
detect pos as well for ll
DevenBalaji Sep 20, 2025
fe4dcdd
shooter
DevenBalaji Sep 21, 2025
6a7562b
shooter test
DevenBalaji Sep 25, 2025
c220187
completed pure pursuit computer
DevenBalaji Sep 27, 2025
e3fe12c
removed some imports
DevenBalaji Sep 27, 2025
250a93f
progress on 6wd class
DevenBalaji Sep 27, 2025
65aa0b5
refactoring to group all drivetrains under drivetrain package and sha…
DevenBalaji Sep 27, 2025
e4f4dd2
pid mode added to dt
DevenBalaji Sep 27, 2025
5da784d
added current detection
DevenBalaji Sep 27, 2025
0ad62f1
added 6wd to path builder
DevenBalaji Oct 1, 2025
f210c08
partially made intake class
InutilePleb Oct 1, 2025
ff86702
Completed Intake Class
InutilePleb Oct 1, 2025
ee497ab
Started transfer class
InutilePleb Oct 1, 2025
8b01a27
Added code for transfer. The transfer class has three objects of the …
InutilePleb Oct 4, 2025
c35616b
Update Transfer.java
InutilePleb Oct 4, 2025
152a4c9
turret now uses 2 servos
DevenBalaji Oct 5, 2025
32f933c
shooterTest now uses commands, made shooter implement subsystem and a…
DevenBalaji Oct 5, 2025
7be359d
made transfer and intake implement subsystem
InutilePleb Oct 5, 2025
8249e75
private vars for shooter and it uses rampDownShooter
DevenBalaji Oct 5, 2025
e9e81ca
made stuff private
DevenBalaji Oct 5, 2025
1e58daa
fixed lastFoundIndex issue
DevenBalaji Oct 5, 2025
6266c35
revisions on intake and transfer classes: made state private, made se…
InutilePleb Oct 7, 2025
31d56bd
shooter velocity pid and commands working
DevenBalaji Oct 12, 2025
a7992c5
set some values
DevenBalaji Oct 18, 2025
a7e84d3
init turret code
DevenBalaji Oct 18, 2025
aec8036
not working intake and elevator
InutilePleb Oct 18, 2025
af11609
turret pid accounts for wrapping
DevenBalaji Oct 20, 2025
7fbef5c
added f to pid controller
DevenBalaji Oct 20, 2025
607b551
added commands for elevator, transfer, and intake
InutilePleb Oct 22, 2025
0a82c5f
ok
DevenBalaji Oct 23, 2025
5cd6c2a
made a package to hold all the transfer commands
InutilePleb Oct 25, 2025
8db81d4
added math to adjust jam threshold for current voltage
InutilePleb Oct 25, 2025
3ddddd3
forgot semicolon
InutilePleb Oct 25, 2025
a6ce5e4
revamped pid
DevenBalaji Nov 1, 2025
3d03336
Merge branch 'intake' into develop
DevenBalaji Nov 1, 2025
155ff21
Merge branch 'turret' into merge
DevenBalaji Nov 1, 2025
48b15f1
Merge branch '6wd' into merge
DevenBalaji Nov 1, 2025
74e2734
Merge branch 'obeliskTag' into merge
DevenBalaji Nov 1, 2025
f759e96
added some commands and did turret lock on
DevenBalaji Nov 15, 2025
ec387b7
commands
DevenBalaji Nov 15, 2025
aac6d2a
tele done and driving works
DevenBalaji Nov 26, 2025
aa77e6a
pure pursuit opmode setup, elevator and intake work
DevenBalaji Nov 26, 2025
a096a41
tyshi
InutilePleb Nov 28, 2025
805b9f8
fixing a stash conflict
DevenBalaji Nov 28, 2025
97ee217
transfer fixes, brushland stuff, fixed cubic scaling
DevenBalaji Nov 28, 2025
1028fe8
fixed intakeTest, fixed elevator positions, shooter now has 2 motors
DevenBalaji Nov 29, 2025
fe92e41
fixed shooter for 3 hoods
DevenBalaji Nov 29, 2025
58f244b
general tele cycle without actually shooting
DevenBalaji Nov 29, 2025
f522403
hood angle changes
InutilePleb Nov 29, 2025
a8a265a
michael commit on devens computer
DevenBalaji Nov 29, 2025
2067d20
Merge branch 'develop' of https://github.com/Blu-Cru/Deocde into develop
DevenBalaji Nov 29, 2025
d305184
import roadrunner
InutilePleb Dec 3, 2025
ae9e767
add roadrunner
InutilePleb Dec 3, 2025
a4f0d19
tele and pure pursuit not working
DevenBalaji Dec 3, 2025
266b3cb
roadrunner config
InutilePleb Dec 4, 2025
528ccc6
Merge branch 'develop' into roadrunnerTest
InutilePleb Dec 4, 2025
9e3e6ed
imports change
InutilePleb Dec 4, 2025
918d30f
fixed gradle
DevenBalaji Dec 4, 2025
c85fdac
fixed some pure pursuit bugs
DevenBalaji Dec 4, 2025
e009463
some fixes with pp, but still some bugs
DevenBalaji Dec 5, 2025
023c13c
heading problems gone
DevenBalaji Dec 6, 2025
360fda4
auto opmode creation
InutilePleb Dec 6, 2025
e32823e
Merge branch 'roadrunnerTest' of https://github.com/Blu-Cru/Deocde in…
InutilePleb Dec 6, 2025
aba3797
made a test path for far auto
InutilePleb Dec 6, 2025
034a1f1
push cuz push
DevenBalaji Dec 6, 2025
cdeb801
new autos, rr tuning, auto ftclib command implementation
InutilePleb Dec 7, 2025
c9c9d79
tele and some pure pursuit stuff
DevenBalaji Dec 9, 2025
42b886e
tuning roadrunner
InutilePleb Dec 9, 2025
03a8bf0
updated tickspermm to match our odo pods, reversed heading readings f…
InutilePleb Dec 10, 2025
dacd8cd
rr tuning ; working mostly, trackwidthTicks is a made up number
InutilePleb Dec 10, 2025
3479763
made a specific opmode without subsystems
InutilePleb Dec 10, 2025
9f922e0
adjust pickup position
InutilePleb Dec 10, 2025
870bdc5
began adding vel and accel constraints to tune speed of specific part…
InutilePleb Dec 10, 2025
611a38d
outtake and shooter auto aim
DevenBalaji Dec 11, 2025
50fab2d
Untested Auto-Aim
CooperLi1 Dec 12, 2025
21ba007
everything but turret auto-aim and paralleling
CooperLi1 Dec 12, 2025
97cad5f
fixed start B issue + telemetry
CooperLi1 Dec 12, 2025
50dba04
made the intake the back of the robot according to roadrunner. auto p…
InutilePleb Dec 12, 2025
f46de53
Merge branch 'roadrunnerTest' into develop
InutilePleb Dec 12, 2025
82f9e5a
updated path for auto with subsystems implemented
InutilePleb Dec 12, 2025
986cb10
Update Turret.java
CooperLi1 Dec 12, 2025
ee15572
auto work
InutilePleb Dec 12, 2025
f1d3815
Merge branch 'coopli' into develop
DevenBalaji Dec 12, 2025
96d9f1d
auto
InutilePleb Dec 12, 2025
33eba5d
Merge branch 'develop' of https://github.com/Blu-Cru/Deocde into develop
InutilePleb Dec 12, 2025
33d5595
new tele, working on relocalization
DevenBalaji Dec 13, 2025
a72d531
autoaim fixes+tele rumble
CooperLi1 Dec 13, 2025
dd1085e
auto commands
InutilePleb Dec 13, 2025
5b7e713
Merge branch 'develop' of https://github.com/Blu-Cru/Deocde into develop
InutilePleb Dec 13, 2025
4b0732e
opmode stuck in stop currently - checkpoint
InutilePleb Dec 13, 2025
26bc7ca
autoaim fixes
CooperLi1 Dec 13, 2025
7e7ceb1
does not work opmode stuck in stop
InutilePleb Dec 13, 2025
964d73b
Merge branch 'develop' of https://github.com/Blu-Cru/Deocde into develop
InutilePleb Dec 13, 2025
9bd3a6d
debugging auto
CooperLi1 Dec 13, 2025
a570e13
WORKING WORKING WORKING
InutilePleb Dec 13, 2025
f438aeb
Merge branch 'develop' of https://github.com/Blu-Cru/Deocde into develop
InutilePleb Dec 13, 2025
03b7135
autoaim fixed
CooperLi1 Dec 14, 2025
23ce2d0
Merge branch 'develop' of https://github.com/Blu-Cru/Deocde into develop
CooperLi1 Dec 14, 2025
effc687
rumble time
CooperLi1 Dec 14, 2025
213209b
12 ball so auraful coming with 15 soon everyone be scared
DevenBalaji Dec 14, 2025
b1a4dfb
Merge branch 'develop' of https://github.com/Blu-Cru/Deocde into develop
DevenBalaji Dec 14, 2025
c5f0e7e
alliances
CooperLi1 Dec 14, 2025
2e15d67
far shooting
CooperLi1 Dec 14, 2025
418840d
tele motif
CooperLi1 Dec 14, 2025
e5685cb
blue side is not working, red side is inconsistent
DevenBalaji Dec 14, 2025
ea8b24e
Merge branch 'develop' of https://github.com/Blu-Cru/Deocde into develop
DevenBalaji Dec 14, 2025
1c6d1d1
qual ready!
CooperLi1 Dec 14, 2025
d5dceb3
Correct Pinpoint setting decimal place
dongjason Dec 15, 2025
bf35d02
fixed constants in pinpointLocalizer for auto
DevenBalaji Dec 15, 2025
cbfa5f1
auto heading seems to consistently be off, might need a retune
DevenBalaji Dec 16, 2025
4838f7f
interpreter for auto
DevenBalaji Dec 19, 2025
5dddfb4
middle elevator, some limelight code, and some auto work
DevenBalaji Dec 19, 2025
7c6a90e
interpreter changes
DevenBalaji Dec 20, 2025
6a06543
some interpreter changes
DevenBalaji Dec 20, 2025
6850d18
Merge branch 'develop' into interpreter
DevenBalaji Dec 20, 2025
eb30996
reverse flywheel implementation for human player loading, added a sta…
InutilePleb Dec 20, 2025
8ec0e45
set hoods all the way down when intaking from hp
InutilePleb Dec 20, 2025
82b8586
commented out a bunch of teles, fixed some interpreter bugs, some tur…
DevenBalaji Dec 23, 2025
0ac5f1b
Merge branch 'interpreter' into develop
DevenBalaji Dec 23, 2025
5ed98a4
turret lock on goal
DevenBalaji Dec 26, 2025
7e28ac7
removed imports and fixed some tele stuff
DevenBalaji Dec 28, 2025
0e353d6
pid tune success
chase-m-liu Dec 29, 2025
c52036c
found some bugs
DevenBalaji Dec 30, 2025
ceb687c
fix bug
chase-m-liu Dec 30, 2025
ba74352
think i fixed auto aim problems
DevenBalaji Dec 30, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions FtcRobotController/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:versionCode="59"
android:versionName="10.3">
android:versionCode="60"
android:versionName="11.0">

<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -224,14 +224,17 @@ private void telemetryAprilTag() {
for (AprilTagDetection detection : currentDetections) {
if (detection.metadata != null) {
telemetry.addLine(String.format("\n==== (ID %d) %s", detection.id, detection.metadata.name));
telemetry.addLine(String.format("XYZ %6.1f %6.1f %6.1f (inch)",
detection.robotPose.getPosition().x,
detection.robotPose.getPosition().y,
detection.robotPose.getPosition().z));
telemetry.addLine(String.format("PRY %6.1f %6.1f %6.1f (deg)",
detection.robotPose.getOrientation().getPitch(AngleUnit.DEGREES),
detection.robotPose.getOrientation().getRoll(AngleUnit.DEGREES),
detection.robotPose.getOrientation().getYaw(AngleUnit.DEGREES)));
// Only use tags that don't have Obelisk in them
if (!detection.metadata.name.contains("Obelisk")) {
telemetry.addLine(String.format("XYZ %6.1f %6.1f %6.1f (inch)",
detection.robotPose.getPosition().x,
detection.robotPose.getPosition().y,
detection.robotPose.getPosition().z));
telemetry.addLine(String.format("PRY %6.1f %6.1f %6.1f (deg)",
detection.robotPose.getOrientation().getPitch(AngleUnit.DEGREES),
detection.robotPose.getOrientation().getRoll(AngleUnit.DEGREES),
detection.robotPose.getOrientation().getYaw(AngleUnit.DEGREES)));
}
} else {
telemetry.addLine(String.format("\n==== (ID %d) Unknown", detection.id));
telemetry.addLine(String.format("Center %6.0f %6.0f (pixels)", detection.center.x, detection.center.y));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public void telemetryButtonData() {
telemetry.addData("Gamepad 1 Left Bumper Released", gamepad1.leftBumperWasReleased());
telemetry.addData("Gamepad 1 Left Bumper Status", gamepad1.left_bumper);

// Add an empty line to seperate the buttons in telemetry
// Add an empty line to separate the buttons in telemetry
telemetry.addLine();

// Add the status of the Gamepad 1 Right Bumper
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,245 @@
/*
* Copyright (c) 2024 Phil Malone
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/

package org.firstinspires.ftc.robotcontroller.external.samples;

import android.graphics.Color;
import android.util.Size;

import com.qualcomm.robotcore.eventloop.opmode.Disabled;
import com.qualcomm.robotcore.eventloop.opmode.LinearOpMode;
import com.qualcomm.robotcore.eventloop.opmode.TeleOp;

import org.firstinspires.ftc.robotcore.external.Telemetry;
import org.firstinspires.ftc.robotcore.external.hardware.camera.WebcamName;
import org.firstinspires.ftc.vision.VisionPortal;
import org.firstinspires.ftc.vision.opencv.Circle;
import org.firstinspires.ftc.vision.opencv.ColorBlobLocatorProcessor;
import org.firstinspires.ftc.vision.opencv.ColorRange;
import org.firstinspires.ftc.vision.opencv.ImageRegion;

import java.util.List;

/*
* This OpMode illustrates how to use a video source (camera) to locate specifically colored regions.
* This sample is targeted towards circular blobs. To see rectangles, look at ConceptVisionColorLocator_Rectangle
*
* Unlike a "color sensor" which determines the color of nearby object, this "color locator"
* will search the Region Of Interest (ROI) in a camera image, and find any "blobs" of color that
* match the requested color range. These blobs can be further filtered and sorted to find the one
* most likely to be the item the user is looking for.
*
* To perform this function, a VisionPortal runs a ColorBlobLocatorProcessor process.
* The ColorBlobLocatorProcessor (CBLP) process is created first, and then the VisionPortal is built.
* The (CBLP) analyses the ROI and locates pixels that match the ColorRange to form a "mask".
* The matching pixels are then collected into contiguous "blobs" of pixels.
* The outer boundaries of these blobs are called its "contour". For each blob, the process then
* creates the smallest possible circle that will fully encase the contour. The user can then call
* getBlobs() to retrieve the list of Blobs, where each contains the contour and the circle.
* Note: The default sort order for Blobs is ContourArea, in descending order, so the biggest
* contours are listed first.
*
* A colored enclosing circle is drawn on the camera preview to show the location of each Blob
* The original Blob contour can also be added to the preview.
* This is helpful when configuring the ColorBlobLocatorProcessor parameters.
*
* Tip: Connect an HDMI monitor to the Control Hub to view the Color Location process in real-time.
* Or use a screen copy utility like ScrCpy.exe to view the video remotely.
*
* Use Android Studio to Copy this Class, and Paste it into your team's code folder with a new name.
* Remove or comment out the @Disabled line to add this OpMode to the Driver Station OpMode list
*/

@Disabled
@TeleOp(name = "Concept: Vision Color-Locator (Circle)", group = "Concept")
public class ConceptVisionColorLocator_Circle extends LinearOpMode {
@Override
public void runOpMode() {
/* Build a "Color Locator" vision processor based on the ColorBlobLocatorProcessor class.
* - Specify the color range you are looking for. Use a predefined color, or create your own
*
* .setTargetColorRange(ColorRange.BLUE) // use a predefined color match
* Available colors are: RED, BLUE, YELLOW, GREEN, ARTIFACT_GREEN, ARTIFACT_PURPLE
* .setTargetColorRange(new ColorRange(ColorSpace.YCrCb, // or define your own color match
* new Scalar( 32, 176, 0),
* new Scalar(255, 255, 132)))
*
* - Focus the color locator by defining a RegionOfInterest (ROI) which you want to search.
* This can be the entire frame, or a sub-region defined using:
* 1) standard image coordinates or 2) a normalized +/- 1.0 coordinate system.
* Use one form of the ImageRegion class to define the ROI.
* ImageRegion.entireFrame()
* ImageRegion.asImageCoordinates(50, 50, 150, 150) 100x100 pixels at upper left corner
* ImageRegion.asUnityCenterCoordinates(-0.5, 0.5, 0.5, -0.5) 50% width/height in center
*
* - Define which contours are included.
* You can get ALL the contours, ignore contours that are completely inside another contour.
* .setContourMode(ColorBlobLocatorProcessor.ContourMode.ALL_FLATTENED_HIERARCHY)
* .setContourMode(ColorBlobLocatorProcessor.ContourMode.EXTERNAL_ONLY)
* EXTERNAL_ONLY helps to avoid bright reflection spots from breaking up solid colors.
*
* - Turn the displays of contours ON or OFF.
* Turning these on helps debugging but takes up valuable CPU time.
* .setDrawContours(true) Draws an outline of each contour.
* .setEnclosingCircleColor(int color) Draws a circle around each contour. 0 to disable.
* .setBoxFitColor(int color) Draws a rectangle around each contour. 0 to disable. ON by default.
*
*
* - include any pre-processing of the image or mask before looking for Blobs.
* There are some extra processing you can include to improve the formation of blobs.
* Using these features requires an understanding of how they may effect the final
* blobs. The "pixels" argument sets the NxN kernel size.
* .setBlurSize(int pixels)
* Blurring an image helps to provide a smooth color transition between objects,
* and smoother contours. The higher the number, the more blurred the image becomes.
* Note: Even "pixels" values will be incremented to satisfy the "odd number" requirement.
* Blurring too much may hide smaller features. A size of 5 is good for a 320x240 image.
*
* .setErodeSize(int pixels)
* Erosion removes floating pixels and thin lines so that only substantive objects remain.
* Erosion can grow holes inside regions, and also shrink objects.
* "pixels" in the range of 2-4 are suitable for low res images.
*
* .setDilateSize(int pixels)
* Dilation makes objects and lines more visible by filling in small holes, and making
* filled shapes appear larger. Dilation is useful for joining broken parts of an
* object, such as when removing noise from an image.
* "pixels" in the range of 2-4 are suitable for low res images.
*
* .setMorphOperationType(MorphOperationType morphOperationType)
* This defines the order in which the Erode/Dilate actions are performed.
* OPENING: Will Erode and then Dilate which will make small noise blobs go away
* CLOSING: Will Dilate and then Erode which will tend to fill in any small holes in blob edges.
*/
ColorBlobLocatorProcessor colorLocator = new ColorBlobLocatorProcessor.Builder()
.setTargetColorRange(ColorRange.ARTIFACT_PURPLE) // Use a predefined color match
.setContourMode(ColorBlobLocatorProcessor.ContourMode.EXTERNAL_ONLY)
.setRoi(ImageRegion.asUnityCenterCoordinates(-0.75, 0.75, 0.75, -0.75))
.setDrawContours(true) // Show contours on the Stream Preview
.setBoxFitColor(0) // Disable the drawing of rectangles
.setCircleFitColor(Color.rgb(255, 255, 0)) // Draw a circle
.setBlurSize(5) // Smooth the transitions between different colors in image

// the following options have been added to fill in perimeter holes.
.setDilateSize(15) // Expand blobs to fill any divots on the edges
.setErodeSize(15) // Shrink blobs back to original size
.setMorphOperationType(ColorBlobLocatorProcessor.MorphOperationType.CLOSING)

.build();
/*
* Build a vision portal to run the Color Locator process.
*
* - Add the colorLocator process created above.
* - Set the desired video resolution.
* Since a high resolution will not improve this process, choose a lower resolution
* that is supported by your camera. This will improve overall performance and reduce
* latency.
* - Choose your video source. This may be
* .setCamera(hardwareMap.get(WebcamName.class, "Webcam 1")) ..... for a webcam
* or
* .setCamera(BuiltinCameraDirection.BACK) ... for a Phone Camera
*/
VisionPortal portal = new VisionPortal.Builder()
.addProcessor(colorLocator)
.setCameraResolution(new Size(320, 240))
.setCamera(hardwareMap.get(WebcamName.class, "Webcam 1"))
.build();

telemetry.setMsTransmissionInterval(100); // Speed up telemetry updates for debugging.
telemetry.setDisplayFormat(Telemetry.DisplayFormat.MONOSPACE);

// WARNING: To view the stream preview on the Driver Station, this code runs in INIT mode.
while (opModeIsActive() || opModeInInit()) {
telemetry.addData("preview on/off", "... Camera Stream\n");

// Read the current list
List<ColorBlobLocatorProcessor.Blob> blobs = colorLocator.getBlobs();

/*
* The list of Blobs can be filtered to remove unwanted Blobs.
* Note: All contours will be still displayed on the Stream Preview, but only those
* that satisfy the filter conditions will remain in the current list of
* "blobs". Multiple filters may be used.
*
* To perform a filter
* ColorBlobLocatorProcessor.Util.filterByCriteria(criteria, minValue, maxValue, blobs);
*
* The following criteria are currently supported.
*
* ColorBlobLocatorProcessor.BlobCriteria.BY_CONTOUR_AREA
* A Blob's area is the number of pixels contained within the Contour. Filter out any
* that are too big or small. Start with a large range and then refine the range based
* on the likely size of the desired object in the viewfinder.
*
* ColorBlobLocatorProcessor.BlobCriteria.BY_DENSITY
* A blob's density is an indication of how "full" the contour is.
* If you put a rubber band around the contour you would get the "Convex Hull" of the
* contour. The density is the ratio of Contour-area to Convex Hull-area.
*
* ColorBlobLocatorProcessor.BlobCriteria.BY_ASPECT_RATIO
* A blob's Aspect ratio is the ratio of boxFit long side to short side.
* A perfect Square has an aspect ratio of 1. All others are > 1
*
* ColorBlobLocatorProcessor.BlobCriteria.BY_ARC_LENGTH
* A blob's arc length is the perimeter of the blob.
* This can be used in conjunction with an area filter to detect oddly shaped blobs.
*
* ColorBlobLocatorProcessor.BlobCriteria.BY_CIRCULARITY
* A blob's circularity is how circular it is based on the known area and arc length.
* A perfect circle has a circularity of 1. All others are < 1
*/
ColorBlobLocatorProcessor.Util.filterByCriteria(
ColorBlobLocatorProcessor.BlobCriteria.BY_CONTOUR_AREA,
50, 20000, blobs); // filter out very small blobs.

ColorBlobLocatorProcessor.Util.filterByCriteria(
ColorBlobLocatorProcessor.BlobCriteria.BY_CIRCULARITY,
0.6, 1, blobs); /* filter out non-circular blobs.
* NOTE: You may want to adjust the minimum value depending on your use case.
* Circularity values will be affected by shadows, and will therefore vary based
* on the location of the camera on your robot and venue lighting. It is strongly
* encouraged to test your vision on the competition field if your event allows
* sensor calibration time.
*/

/*
* The list of Blobs can be sorted using the same Blob attributes as listed above.
* No more than one sort call should be made. Sorting can use ascending or descending order.
* Here is an example.:
* ColorBlobLocatorProcessor.Util.sortByCriteria(
* ColorBlobLocatorProcessor.BlobCriteria.BY_CONTOUR_AREA, SortOrder.DESCENDING, blobs);
*/

telemetry.addLine("Circularity Radius Center");

// Display the Blob's circularity, and the size (radius) and center location of its circleFit.
for (ColorBlobLocatorProcessor.Blob b : blobs) {

Circle circleFit = b.getCircle();
telemetry.addLine(String.format("%5.3f %3d (%3d,%3d)",
b.getCircularity(), (int) circleFit.getRadius(), (int) circleFit.getX(), (int) circleFit.getY()));
}

telemetry.update();
sleep(100); // Match the telemetry update interval.
}
}
}
Loading