package org.usfirst.frc.team3501.robot;
import org.usfirst.frc.team3501.robot.Constants.DriveTrain;
+import org.usfirst.frc.team3501.robot.subsystems.TowerTracker2;
+
import edu.wpi.first.wpilibj.IterativeRobot;
import edu.wpi.first.wpilibj.command.Scheduler;
public class Robot extends IterativeRobot {
public static OI oi;
public static DriveTrain driveTrain;
+ public static TowerTracker2 towerTracker;
@Override
public void robotInit() {
driveTrain = new DriveTrain();
oi = new OI();
+ towerTracker = new TowerTracker2();
}
@Override
@Override
public void teleopPeriodic() {
Scheduler.getInstance().run();
-
}
}
import org.opencv.core.Rect;
import org.opencv.core.Scalar;
import org.opencv.core.Size;
-import org.opencv.imgcodecs.Imgcodecs;
import org.opencv.imgproc.Imgproc;
import org.opencv.videoio.VideoCapture;
* static method to load opencv and networkTables
*/
static {
+ System
+ .setProperty(
+ "java.library.path",
+ System.getProperty("java.library.path")
+ + ":/home/cindy/Robotics/Workspace/opencv-3.1.0/cmake/lib" //path to opencv_java310
+ + ":/home/cindy/wpilib/cpp/current/lib");
+ System.out.println(System.getProperty("java.library.path"));
System.loadLibrary(Core.NATIVE_LIBRARY_NAME);
NetworkTable.setClientMode();
- NetworkTable.setIPAddress("roborio-3019.local");
+ NetworkTable.setIPAddress("roborio-3502.local");
}
// constants for the color rbg values
public static final Scalar
BLACK = new Scalar(0, 0, 0),
YELLOW = new Scalar(0, 255, 255),
// these are the threshold values in order
- LOWER_BOUNDS = new Scalar(58, 0, 109),
- UPPER_BOUNDS = new Scalar(93, 255, 240);
+ // LOWER_BOUNDS = new Scalar(58, 0, 109),
+ // UPPER_BOUNDS = new Scalar(93, 255, 240);
+ LOWER_BOUNDS = new Scalar(6, 15, 13),
+ UPPER_BOUNDS = new Scalar(31, 115, 45);
// the size for resing the image
public static final Size resize = new Size(320, 240);
- rec.height / 2);
Point centerw = new Point(rec.br().x - rec.width / 2 - 15, rec.br().y
- rec.height / 2 - 20);
- Imgproc.putText(matOriginal, "" + (int) distance, center,
- Core.FONT_HERSHEY_PLAIN, 1, BLACK);
- Imgproc.putText(matOriginal, "" + (int) azimuth, centerw,
- Core.FONT_HERSHEY_PLAIN, 1, BLACK);
+ // Imgproc.putText(matOriginal, "" + (int) distance, center,
+ // Core.FONT_HERSHEY_PLAIN, 1, BLACK);
+ // Imgproc.putText(matOriginal, "" + (int) azimuth, centerw,
+ // Core.FONT_HERSHEY_PLAIN, 1, BLACK);
+ System.out.println(distance + "m, " + azimuth + " degrees "
+ + center.x + ", " + center.y);
}
// output an image for debugging
- Imgcodecs.imwrite("output.png", matOriginal);
+ // Imgcodecs.imwrite("output.png", matOriginal);
FrameCount++;
}
shouldRun = false;