Skip to content

Commit

Permalink
Merge pull request #46 from DeepBlueRobotics/camera-skt
Browse files Browse the repository at this point in the history
Camera skt
  • Loading branch information
FriedLongJohns authored Apr 26, 2024
2 parents 4323f74 + 9e936eb commit 4accbf8
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 6 deletions.
3 changes: 2 additions & 1 deletion src/main/java/org/carlmontrobotics/Constants.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
import edu.wpi.first.wpilibj.util.Color;
import edu.wpi.first.wpilibj.util.Color8Bit;
import edu.wpi.first.wpilibj2.command.button.POVButton;
import edu.wpi.first.wpilibj.util.Color;
import org.carlmontrobotics.subsystems.Led;

/**
* The Constants class provides a convenient place for teams to hold robot-wide
Expand All @@ -33,7 +35,6 @@
*/
public final class Constants {
public static final double g = 9.81; // meters per second squared

public static final class Led {

public static final Color8Bit DEFAULT_COLOR_BLUE = new Color8Bit(0, 0, 200);
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/carlmontrobotics/Robot.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public void robotInit() {
robot = this;
m_robotContainer = new RobotContainer();
// SignalLogger.start();

// creates usb camera
// Record both DS control and joystick data
DataLogManager.start();
DriverStation.startDataLog(DataLogManager.getLog());
Expand Down
1 change: 1 addition & 0 deletions src/main/java/org/carlmontrobotics/RobotContainer.java
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ public class RobotContainer {

public RobotContainer() {
{
// SensorFactory.configureCamera();
SmartDashboard.setDefaultBoolean("babymode", babyMode);
SmartDashboard.setPersistent("babymode");
//safe auto setup... stuff in setupAutos() is not safe to run here - will break robot
Expand Down
2 changes: 0 additions & 2 deletions src/main/java/org/carlmontrobotics/commands/Intake.java
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
package org.carlmontrobotics.commands;

import static org.carlmontrobotics.Constants.Effectorc.*;

import org.carlmontrobotics.subsystems.IntakeShooter;

import edu.wpi.first.wpilibj.Timer;
import edu.wpi.first.wpilibj2.command.Command;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package org.carlmontrobotics.commands;

import org.carlmontrobotics.subsystems.IntakeShooter;

import edu.wpi.first.wpilibj2.command.Command;

public class PassToIntake extends Command{
Expand Down
1 change: 0 additions & 1 deletion src/main/java/org/carlmontrobotics/commands/RampToRPM.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package org.carlmontrobotics.commands;

import org.carlmontrobotics.subsystems.IntakeShooter;

import edu.wpi.first.wpilibj.Timer;
import edu.wpi.first.wpilibj2.command.Command;

Expand Down
29 changes: 29 additions & 0 deletions src/main/java/org/carlmontrobotics/subsystems/Camera.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package org.carlmontrobotics.subsystems;
import edu.wpi.first.cscore.CvSink;
import edu.wpi.first.cscore.CvSource;
import edu.wpi.first.cscore.MjpegServer;
import edu.wpi.first.cscore.UsbCamera;
import edu.wpi.first.cscore.UsbCameraInfo;
import edu.wpi.first.util.PixelFormat;
public class Camera {
public Camera(){
UsbCamera usbCamera = new UsbCamera("USB Camera 0", 0);
MjpegServer mjpegServer1 = new MjpegServer("serve_USB Camera 0", 1
);
mjpegServer1.setSource(usbCamera);

// Creates the CvSink and connects it to the UsbCamera
CvSink cvSink = new CvSink("opencv_USB Camera 0");
cvSink.setSource(usbCamera);

// Creates the CvSource and MjpegServer [2] and connects them
CvSource outputStream = new CvSource("Blur", PixelFormat.kMJPEG, 640, 480, 30);
MjpegServer mjpegServer2 = new MjpegServer("serve_Blur", 2);
mjpegServer2.setSource(outputStream);


//OR

}

}

0 comments on commit 4accbf8

Please sign in to comment.