本文整理汇总了Java中edu.wpi.first.wpilibj.CameraServer.getInstance方法的典型用法代码示例。如果您正苦于以下问题:Java CameraServer.getInstance方法的具体用法?Java CameraServer.getInstance怎么用?Java CameraServer.getInstance使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类edu.wpi.first.wpilibj.CameraServer
的用法示例。
在下文中一共展示了CameraServer.getInstance方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: robotInit
import edu.wpi.first.wpilibj.CameraServer; //导入方法依赖的package包/类
public void robotInit() {
RobotMap.init();
drivetrain = new Drivetrain();
climber = new Climber();
// fuel = new Fuel();
gear = new Gear();
oi = new OI();
// initializes camera server
server = CameraServer.getInstance();
// cameraInit();
// server.startAutomaticCapture(0);
// autonomousCommand = (Command) new AutoMiddleHook();
autonomousCommand = (Command) new AutoBaseline();
// resets all sensors
resetAllSensors();
if (RobotConstants.isTestingEnvironment) updateTestingEnvironment();
updateSensorDisplay();
}
示例2: SpatialAwarenessSubsystem
import edu.wpi.first.wpilibj.CameraServer; //导入方法依赖的package包/类
public SpatialAwarenessSubsystem() {
super("SpatialAwarenessSubsystem");
cameraServer = CameraServer.getInstance();
gearCamera = cameraServer.startAutomaticCapture(0);
gearCamera.setResolution(IMG_WIDTH, IMG_HEIGHT);
gearCamera.setFPS(30);
gearCamera.setBrightness(7);
gearCamera.setExposureManual(30);
gearVideo = cameraServer.getVideo(gearCamera);
visionProcessing = new VisionProcessing();
leftUltrasonic = new AnalogInput(RobotMap.ANALOG_ULTRASONIC_LEFT);
rightUltrasonic = new AnalogInput(RobotMap.ANALOG_ULTRASONIC_RIGHT);
leftUltrasonicKalman = new SimpleKalman(1.4d, 64d, leftUltrasonic.getAverageVoltage() * ULTRASONIC_VOLTS_TO_METERS);
rightUltrasonicKalman = new SimpleKalman(1.4d, 64d, rightUltrasonic.getAverageVoltage() * ULTRASONIC_VOLTS_TO_METERS);
navX = new AHRS(SPI.Port.kMXP);
System.out.println("SpatialAwarenessSubsystem constructor finished");
}
示例3: robotInit
import edu.wpi.first.wpilibj.CameraServer; //导入方法依赖的package包/类
/**
* This function is run when the robot is first started up and should be
* used for any initialization code.
*/
public void robotInit() {
RobotMap.init();
// BEGIN AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=CONSTRUCTORS
driveTrain = new DriveTrain();
shooter = new Shooter();
lift = new Lift();
// END AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=CONSTRUCTORS
// OI must be constructed after subsystems. If the OI creates Commands
//(which it very likely will), subsystems are not guaranteed to be
// constructed yet. Thus, their requires() statements may grab null
// pointers. Bad news. Don't move it.
oi = new OI();
// instantiate the command used for the autonomous period
// BEGIN AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=AUTONOMOUS
autonomousCommand = new AutonomousCommand();
// END AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=AUTONOMOUS
CameraServer cameraServer = CameraServer.getInstance();
System.out.println("Camera sources:" + VideoSource.enumerateSources().length);
for (VideoSource videoSource : VideoSource.enumerateSources()) {
System.out.println("Camera: " + videoSource.getName());
}
UsbCamera camera= cameraServer.startAutomaticCapture();
System.out.println("Started camera capture.");
// Hard coded camera address
cameraServer.addAxisCamera("AxisCam ye", "10.26.67.42");
// visionThread = new VisionThread(camera,new GripPipeline());
driveTrainChooser = new SendableChooser();
driveTrainChooser.addDefault("default PWM", DriveTrain.DriveMode.PWM);
for (DriveTrain.DriveMode driveMode : DriveTrain.DriveMode.values()) {
driveTrainChooser.addObject(driveMode.name(), driveMode);
}
}
示例4: robotInit
import edu.wpi.first.wpilibj.CameraServer; //导入方法依赖的package包/类
/**
* This function is run when the robot is first started up and should be
* used for any initialization code.
*/
public void robotInit() {
RobotMap.init();
// BEGIN AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=CONSTRUCTORS
driveTrain = new DriveTrain();
shooter = new Shooter();
// END AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=CONSTRUCTORS
// OI must be constructed after subsystems. If the OI creates Commands
//(which it very likely will), subsystems are not guaranteed to be
// constructed yet. Thus, their requires() statements may grab null
// pointers. Bad news. Don't move it.
oi = new OI();
// instantiate the command used for the autonomous period
// BEGIN AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=AUTONOMOUS
autonomousCommand = new AutonomousCommand();
// END AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=AUTONOMOUS
CameraServer cameraServer = CameraServer.getInstance();
System.out.println("Camera sources:" + VideoSource.enumerateSources().length);
for (VideoSource videoSource : VideoSource.enumerateSources()) {
System.out.println("Camera: " + videoSource.getName());
}
UsbCamera camera= cameraServer.startAutomaticCapture();
System.out.println("Started camera capture.");
// Hard coded camera address
cameraServer.addAxisCamera("AxisCam ye", "10.26.67.42");
// visionThread = new VisionThread(camera,new GripPipeline());
}
示例5: robotInit
import edu.wpi.first.wpilibj.CameraServer; //导入方法依赖的package包/类
/**
* This function is run when the robot is first started up and should be
* used for any initialization code.
*/
public void robotInit() {
RobotMap.init();
// BEGIN AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=CONSTRUCTORS
driveTrain = new DriveTrain();
pDP = new PDP();
intake = new Intake();
climber = new Climber();
shooter = new Shooter();
// END AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=CONSTRUCTORS
// OI must be constructed after subsystems. If the OI creates Commands
//(which it very likely will), subsystems are not guaranteed to be
// constructed yet. Thus, their requires() statements may grab null
// pointers. Bad news. Don't move it.
oi = new OI();
// initializes networktable
table = NetworkTable.getTable("HookContoursReport");
// sets up camera switcher
server = CameraServer.getInstance();
server.startAutomaticCapture(0);
// cameraInit();
// set up sendable chooser for autonomous
autoChooser = new SendableChooser();
autoChooser.addDefault("Middle Hook", new AUTOMiddleHook());
autoChooser.addObject("Left Hook", new AUTOLeftHook());
autoChooser.addObject("RightHook", new AUTORightHook());
SmartDashboard.putData("Auto Chooser", autoChooser);
// instantiate the command used for the autonomous period
// BEGIN AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=AUTONOMOUS
// END AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=AUTONOMOUS
}
示例6: robotInit
import edu.wpi.first.wpilibj.CameraServer; //导入方法依赖的package包/类
/**
* This function is run when the robot is first started up and should be
* used for any initialization code.
*/
// @Override
public void robotInit() {
System.out.println("1");
RobotMap.init();
drivetrain = new Drivetrain();
climber = new Climber();
// fuel = new Fuel();
gear = new Gear();
oi = new OI();
// initializes camera server
server = CameraServer.getInstance();
cameraInit();
// initializes auto chooser
autoChooser = new SendableChooser();
autoChooser.addDefault("Middle Hook", new AutoMiddleHook());
autoChooser.addObject("Loading Station Hook", new AutoLeftHook());
autoChooser.addObject("Boiler Side Hook", new AutoRightHook());
SmartDashboard.putData("Auto mode", autoChooser);
// auto delay
SmartDashboard.putNumber("Auto delay", 0);
// resets all sensors
resetAllSensors();
}
示例7: robotInit
import edu.wpi.first.wpilibj.CameraServer; //导入方法依赖的package包/类
public void robotInit() {
// Create subsystems
drive = new Drive();
intake = new Intake();
arm = new Arm();
shooter = new Shooter();
hanger = new Hanger();
oi = new OI();
// Create motion profiles
crossLowBar = new Profile(AutoMap.crossLowBar);
reach = new Profile(AutoMap.reach);
toShoot = new Profile(AutoMap.toShoot);
toLowGoal = new Profile(AutoMap.toLowGoal);
// Pick an auto
chooser = new SendableChooser();
chooser.addDefault("Do Nothing", new DoNothing());
chooser.addObject("Low Bar", new LowBarRawtonomous());
chooser.addObject("Low Bar (profile)", new CrossLowBar(crossLowBar));
chooser.addObject("Reach", new Reach(reach));
chooser.addObject("Forward Rawto", new ForwardRawtonomous());
chooser.addObject("Backward Rawto", new BackwardRawtonomous());
chooser.addObject("Shoot", new AutoShoot());
SmartDashboard.putData("Auto mode", chooser);
// Start camera stream
camera = new USBCamera();
server = CameraServer.getInstance();
server.setQuality(40);
server.startAutomaticCapture(camera);
// Start compressor
compressor = new Compressor();
compressor.start();
navx = new AHRS(SPI.Port.kMXP);
}
示例8: robotInit
import edu.wpi.first.wpilibj.CameraServer; //导入方法依赖的package包/类
/**
* This function is run when the robot is first started up and should be
* used for any initialization code.
*/
public void robotInit() {
server = CameraServer.getInstance();
server.setQuality(80);
//the camera name (ex "cam0") can be found through the roborio web interface
server.startAutomaticCapture("cam0");
serverThread = new Thread(new ServerLoop(this));
serverThread.start();
}
示例9: robotInit
import edu.wpi.first.wpilibj.CameraServer; //导入方法依赖的package包/类
/**
* This function is run when the robot is first started up and should be
* used for any initialization code.
*/
public void robotInit() {
NetworkTable.globalDeleteAll();
oi = new OI();
teleop = new Teleop();
uHGSD = new UpdateHighGoalShooterDashboard();
autonomousCommand = new Autonomous(2, 2);
CameraServer server = CameraServer.getInstance();
server.startAutomaticCapture("cam0");
hood.resetEncoder(hood.HOOD_START);
}
示例10: init
import edu.wpi.first.wpilibj.CameraServer; //导入方法依赖的package包/类
public static void init() {
// Drivetrain
DRIVETRAIN_ROBOT_DRIVE = new RobotDrive(0, 1);
DRIVETRAIN_ENCODER_LEFT = new Encoder(0, 1);
DRIVETRAIN_ENCODER_LEFT.setDistancePerPulse(0.0481);
DRIVETRAIN_ENCODER_RIGHT = new Encoder(2, 3, true);
DRIVETRAIN_ENCODER_RIGHT.setDistancePerPulse(0.0481);
// Floor Gear
FLOORGEAR_INTAKE = new VictorSP(2);
FLOORGEAR_LIFTER = new DoubleSolenoid(0, 1);
FLOORGEAR_BLOCKER = new DoubleSolenoid(2, 3);
// Climber
CLIMBER = new VictorSP(3);
// Passive Gear
SLOTGEAR_HOLDER = new DoubleSolenoid(4, 5);
// Vision
VISION_SERVER = CameraServer.getInstance();
VISION_CAMERA = VISION_SERVER.startAutomaticCapture("FRONT", 0);
VISION_CAMERA.getProperty("saturation").set(20);
VISION_CAMERA.getProperty("gain").set(50);
VISION_CAMERA.getProperty("exposure_auto").set(1);
VISION_CAMERA.getProperty("brightness").set(50);
VISION_CAMERA.getProperty("exposure_absolute").set(1);
VISION_CAMERA.getProperty("exposure_auto_priority").set(0);
}
示例11: Cameras
import edu.wpi.first.wpilibj.CameraServer; //导入方法依赖的package包/类
public Cameras() {
server = CameraServer.getInstance();
frame = NIVision.imaqCreateImage(NIVision.ImageType.IMAGE_RGB, 0);
sessionFront = NIVision.IMAQdxOpenCamera(RobotMap.FRONT_CAMERA,
NIVision.IMAQdxCameraControlMode.CameraControlModeController);
NIVision.IMAQdxConfigureGrab(sessionFront);
currentSession = sessionFront;
sessionSet = true;
}
示例12: initSubsystem
import edu.wpi.first.wpilibj.CameraServer; //导入方法依赖的package包/类
@Override
public void initSubsystem() {
server = CameraServer.getInstance();
server.setQuality(50);
server.startAutomaticCapture("cam0");
}
示例13: robotInit
import edu.wpi.first.wpilibj.CameraServer; //导入方法依赖的package包/类
/**
* This is the initialization for all robot code
*/
public void robotInit()
{
robotDrive = new RobotDrive(0,1);
driveStick = new Joystick(0);
liftServo = new TalonSRX(3);
liftStick = new Joystick(3);
server = CameraServer.getInstance();
server.setQuality(50);
server.startAutomaticCapture("cam0");
}
示例14: robotInit
import edu.wpi.first.wpilibj.CameraServer; //导入方法依赖的package包/类
/**
* This function is run when the robot is first started up and should be
* used for any initialization code.
*/
public void robotInit() {
RobotMap.init();
// BEGIN AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=CONSTRUCTORS
LiftControl.zeroValue = RobotMap.forkliftMotor.getPosition();
driveBase = new DriveBase();
pneumatics = new Pneumatics();
img = NIVision.imaqCreateImage(NIVision.ImageType.IMAGE_RGB, 0);
RobotMap.forkliftMotor.disableControl();
// END AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=CONSTRUCTORS
// OI must be constructed after subsystems. If the OI creates Commands
//(which it very likely will), subsystems are not guaranteed to be
// constructed yet. Thus, their requires() statements may grab null
// pointers. Bad news. Don't move it.
oi = new OI();
back = new JoystickButton(oi.joystick, 7);
start = new JoystickButton(oi.joystick, 8);
try {
cs = CameraServer.getInstance();
cs.setQuality( 10 );
/* The available size constants for cs.setSize are 0,1,2 for:
private static final int kSize640x480 = 0;
private static final int kSize320x240 = 1;
private static final int kSize160x120 = 2;
*/
// cs.setSize( 1 );
cs.startAutomaticCapture("cam0");
} catch (Exception e) {
// No camera signal, ignore
}
RobotMap.lightRing.set(true);
}
示例15: robotInit
import edu.wpi.first.wpilibj.CameraServer; //导入方法依赖的package包/类
/**
* This function is run when the robot is first started up and should be
* used for any initialization code.
*/
public void robotInit() {
RobotMap.init();
SmartDashboard.putString("Solenoid Status:", "I am E.W.T!");
//BEGIN CAMERA CODE
USBcamera = CameraServer.getInstance();
USBcamera.setQuality(50);
//the camera name (ex "cam0") can be found through the roborio web interface
USBcamera.startAutomaticCapture("cam0");
//END CAMERA CODE
// BEGIN AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=CONSTRUCTORS
driveTrain = new DriveTrain();
intake = new Intake();
pneumaticSystem = new PneumaticSystem();
sensorBase = new SensorBase();
cheeringSection = new CheeringSection();
// END AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=CONSTRUCTORS
// OI must be constructed after subsystems. If the OI creates Commands
//(which it very likely will), subsystems are not guaranteed to be
// constructed yet. Thus, their requires() statements may grab null
// pointers. Bad news. Don't move it.
oi = new OI();
// instantiate the command used for the autonomous period
// BEGIN AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=AUTONOMOUS
//** Works autonomousCommand = new AutonomousLowGoal();
// END AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=AUTONOMOUS
autoChooser = new SendableChooser();
autoChooser.addDefault("Autonomous Low Goal", new AutonomousLowGoal());
autoChooser.addObject("Autonomous Do Nothing", new AutonomousCommand());
autoChooser.addObject("Autonomous Straight 50%", new AutoDriveStraight50());
autoChooser.addObject("Autonomous Straight 75%", new AutoDriveStraight75());
autoChooser.addObject("Autonomous Straight 100%", new AutoDriveStraight100());
autoChooser.addObject("Autonomous SELF DESTRUCT", new AutonomousCommand());
// autoChooser.addObject("Autonomous Flag Wave", new AutonomousFlagWave());
// autoChooser.addObject("Autonomous Dance Party", new AutonomousDanceParty());
SmartDashboard.putData("Autonomous Mode Chooser", autoChooser);
}