本文整理汇总了Java中edu.wpi.first.wpilibj.smartdashboard.SendableChooser.addObject方法的典型用法代码示例。如果您正苦于以下问题:Java SendableChooser.addObject方法的具体用法?Java SendableChooser.addObject怎么用?Java SendableChooser.addObject使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类edu.wpi.first.wpilibj.smartdashboard.SendableChooser
的用法示例。
在下文中一共展示了SendableChooser.addObject方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: robotInit
import edu.wpi.first.wpilibj.smartdashboard.SendableChooser; //导入方法依赖的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
driveBase = new DriveBase();
arm = new Arm();
winch = new Winch();
// 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();
autonomousChooser = new SendableChooser();
autonomousChooser.addDefault("Drive Forward", new AutonomousCommand());
autonomousChooser.addObject("Center Peg", new CenterPeg());
SmartDashboard.putData("Autonomous Mode", autonomousChooser);
}
示例2: SnobotDriveJoystickFactory
import edu.wpi.first.wpilibj.smartdashboard.SendableChooser; //导入方法依赖的package包/类
/**
*
* @param aXboxJoystick
* Xbax Joystick
* @param aFlightstickJoytick
* FlightStick Joystick
* @param aHaloJoystick
* Halo Joystick
* @param aLogger
* Logger for the Factory
*/
public SnobotDriveJoystickFactory(IDriverJoystick aXboxJoystick,IDriverJoystick aFlightstickJoytick, IDriverJoystick aHaloJoystick, Logger aLogger)
{
mXboxJoystick = aXboxJoystick;
mFlightstickJoytick = aFlightstickJoytick;
mHaloJoytick = aHaloJoystick;
mLogger = aLogger;
mDriveMode = DriveMode.Xbox;
mDriveModeSelector = new SendableChooser();
mDriveModeSelector.addDefault("Xbox", DriveMode.Xbox);
mDriveModeSelector.addObject("Fligthstick", DriveMode.Flightsticks);
mDriveModeSelector.addObject("Arcade", DriveMode.Arcade);
SmartDashboard.putData(SmartDashBoardNames.sDRIVER_JOSTICK_MODE, mDriveModeSelector);
}
示例3: robotInit
import edu.wpi.first.wpilibj.smartdashboard.SendableChooser; //导入方法依赖的package包/类
/**
* This function is run when the robot is first started up and should be
* used for any initialization code.
*/
public void robotInit() {
harvester = new Harvester();
drive = new Drive();
climber = new Climber();
harvesterRollers = new HarvesterRollers();
flashlight = new Flashlight();
SmartDashboard.putData(harvester);
SmartDashboard.putData(drive);
SmartDashboard.putData(climber);
SmartDashboard.putData(harvesterRollers);
oi = new OI();
//ppim.pm.ip.mip.mi.p.miipmmip.ip.m.pimmmpim.m.ipm..ipmmpimipmipm.mmipipm.pipmi.pmipmmpimipmpi..lmmmplip.mimp.im..p.ppn.p.pp.p.ppp.p
chooser = new SendableChooser();
chooser.addDefault("Do nothing", new AutoDoNothing());
chooser.addObject("Spy Bot", new CG_SpyBot());
chooser.addObject("Spy Bot and Turn", new CG_SpyBotTurn());
chooser.addObject("Drive straight 2.5 seconds", new DriveTime(2.5, 1));
chooser.addObject("Low bar", new CG_LowBarAndShoot());
chooser.addObject("Shoot", new CG_DefenseAndShoot());
// chooser.addObject("Middle to Low Bar", new MyAutoCommand());
SmartDashboard.putData("AutoSelect", chooser);
}
示例4: robotInit
import edu.wpi.first.wpilibj.smartdashboard.SendableChooser; //导入方法依赖的package包/类
public void robotInit() {
CMap.initialize();
autoDefenseChooser = new SendableChooser();
autoDefenseChooser.addDefault("Low Bar", "Low Bar");
autoDefenseChooser.addObject("Cheval", "Cheval"); //Only Category B Defense
autoDefenseChooser.addObject("Log Roll", "Log Roll"); //Other Category B
autoDefenseChooser.addObject("Ramparts", "Ramparts"); //One of Two Category C
autoDefenseChooser.addObject("Moat", "Moat"); //One of Two Category C
autoDefenseChooser.addObject("Rock Wall", "Rock Wall"); // One of Two Category D
autoDefenseChooser.addObject("Rough Terrain", "Rough Terrain"); //One of Two Category D
autoDefenseChooser.addObject("Score from Spy Box?", "Spy Box");
SmartDashboard.putData("Which Defense?", autoDefenseChooser);
}
示例5: Test
import edu.wpi.first.wpilibj.smartdashboard.SendableChooser; //导入方法依赖的package包/类
public Test(Robot robot)
{
super(robot); // Call TeleOp constructor.
sm = new TrcStateMachine(moduleName);
event = new TrcEvent(moduleName);
timer = new TrcTimer(moduleName);
testChooser = new SendableChooser();
testChooser.addDefault("Sensors test", TestMode.SENSORS_TEST);
testChooser.addObject("Drive motors test", TestMode.DRIVEMOTORS_TEST);
testChooser.addObject("Drive for 8 sec", TestMode.TIMED_DRIVE);
testChooser.addObject("Move X 20 ft", TestMode.X_DRIVE);
testChooser.addObject("Move Y 20 ft", TestMode.Y_DRIVE);
testChooser.addObject("Turn 360", TestMode.TURN);
testChooser.addObject("Sonar drive 7 in", TestMode.SONAR_DRIVE);
HalDashboard.putData("Robot tune modes", testChooser);
}
示例6: DebugHardware
import edu.wpi.first.wpilibj.smartdashboard.SendableChooser; //导入方法依赖的package包/类
/**
*Contains a variety of debugging functions.
*Mostly affects the SmartDashboard.
*/
public DebugHardware() {
motorSelector = new SendableChooser();
motorSelector.addDefault("None", 0);
motorSelector.addObject("Left Front", 1);
motorSelector.addObject("Right Front", 2);
motorSelector.addObject("Right Rear", 3);
motorSelector.addObject("Left Rear", 4);
motorSelector.addObject("Winch", 5);
motorSelector.addObject("Left Roller", 6);
motorSelector.addObject("Right Roller", 7);
SmartDashboard.putData("Debug Motor", motorSelector);
Preferences.getInstance().putDouble("setWinch",RobotMap.forkliftMotor.getPosition());
Preferences.getInstance().putDouble("WheelSpeed", speed);
RobotMap.forkliftMotor.enableControl();
}
示例7: robotInit
import edu.wpi.first.wpilibj.smartdashboard.SendableChooser; //导入方法依赖的package包/类
/**
* This function is run when the robot is first started up and should be
* used for any initialization code.
*/
public void robotInit() {
System.out.println("Robot Init Started");
// Initialize all subsystems
CommandBase.init();
// instantiate the command used for the autonomous period
autonomousModeChooser = new SendableChooser();
autonomousModeChooser.addDefault("1 Ball Front Short", new Shoot1BallShortAutonomous());
autonomousModeChooser.addObject("1 Ball Front Short Hot", new Shoot1BallShortAutonomousHot());
autonomousModeChooser.addObject("1 Ball Front Long", new Shoot1BallAutonomous());
autonomousModeChooser.addObject("1 Ball Front Long Hot", new Shoot1BallAutonomousHot());
autonomousModeChooser.addObject("1 Ball Back Long", new Shoot1BallBackAutonomous());
autonomousModeChooser.addObject("1 Ball Back Long Hot", new Shoot1BallBackAutonomousHot());
autonomousModeChooser.addObject("2 Ball Front", new Shoot2BallAutonomous());
autonomousModeChooser.addObject("2 Ball Back", new Shoot2BallBackAutonomous());
autonomousModeChooser.addObject("Move Forward 150", new Shoot0BallAutonomous(0, 150));
SmartDashboard.putData("Autonomous Mode", autonomousModeChooser);
updateStatus();
System.out.println("Robot Init Completed");
}
示例8: robotInit
import edu.wpi.first.wpilibj.smartdashboard.SendableChooser; //导入方法依赖的package包/类
/**
* This function is run when the robot is first started up and should be
* used for any initialization code.
*/
public void robotInit() {
// instantiate the command used for the autonomous period
// autonomousCommand = new DriveSetDistanceCommand();
SmartDashboard.putNumber("waitTime", 1000);
// Initialize all subsystems
CommandBase.init();
autonomousModeChooser = new SendableChooser();
autonomousModeChooser.addObject("Do Nothing Autonomous", DO_NOTHING_AUTO_NAME);
autonomousModeChooser.addObject("Wait and Drive Autonomous", WAIT_AND_DRIVE_AUTO_NAME);
autonomousModeChooser.addDefault("One Ball Short Drive Autonomous", ONE_BALL_SHORT_DRIVE_AUTO_NAME);
// autonomousModeChooser.addDefault("One Ball Driving Shot Autonomous", ONE_BALL_RUNNING_SHOT_AUTO_NAME);
autonomousModeChooser.addDefault("Two Ball Short Drive Autonomous", TWO_BALL_SHORT_DRIVE_AUTO_NAME);
// autonomousModeChooser.addObject("Two Ball Running Autonomous", TWO_BALL_RUNNING_SHOT_AUTO_NAME);
SmartDashboard.putData("Autonomous", autonomousModeChooser);
SmartDashboard.putData(new HotVisionWaitCommand());
}
示例9: autoSelectInit
import edu.wpi.first.wpilibj.smartdashboard.SendableChooser; //导入方法依赖的package包/类
/**
* Creates Autonomous mode chooser.
*/
private void autoSelectInit() {
//NOTE: ONLY ADD AutoCommandGroup objects to this chooser!
autoChooser = new SendableChooser();
autoChooser.addDefault(ShootStraight_2Ball_DrvFwd.name, new ShootStraight_2Ball_DrvFwd());
autoChooser.addObject(Center_RotHotGoal_2Ball.name, new Center_RotHotGoal_2Ball());
autoChooser.addObject(Center_RotHotGoal_1Ball.name, new Center_RotHotGoal_1Ball());
autoChooser.addObject(Left_LeftHotGoal_1Ball.name, new Left_LeftHotGoal_1Ball());
autoChooser.addObject(Right_RightHotGoal_1Ball.name, new Right_RightHotGoal_1Ball());
autoChooser.addObject(Left_2ball_left2right.name, new Left_2ball_left2right());
autoChooser.addObject(NoBall_DrvFwd.name, new NoBall_DrvFwd());
autoChooser.addObject(No_Auto.name, new No_Auto());
//autoChooser.addObject("Center_RotDrvFwdHotGoal_1Ball", new Center_RotDrvFwdHotGoal_1Ball(RobotMap.VisionTimeOutSecs.getDouble()));
//autoChooser.addObject("ShootStraight_2BallDrvFwd", new ShootStraight_2Ball_DrvFwd());
SmartDashboard.putData("Autonomous Mode Chooser", autoChooser);
}
示例10: initDashboard
import edu.wpi.first.wpilibj.smartdashboard.SendableChooser; //导入方法依赖的package包/类
public static void initDashboard() {
omniForward = new SendableChooser();
omniForward.addDefault("Omni Forward", new SwitchDriveToOmniForward());
omniForward.addObject("Omni Backward", new SwitchDriveToOmniBackward());
competitionVersion = new SendableChooser();
competitionVersion.addDefault("Competition Version", new SetCompetitionVersion());
competitionVersion.addObject("Normal Version", new SetNormalVersion());
driverDevice = new SendableChooser();
driverDevice.addDefault("Joystics", new SwitchDriveToJoysticks());
driverDevice.addObject("Xbox Controller", new SwitchDriveToXbox());
autoDance = new SendableChooser();
autoDance.addDefault("Disabled", new DisableAutoDance());
autoDance.addObject("Enabled", new EnableAutoDance());
SmartDashboard.putData("Competition/Normal Version", competitionVersion);
SmartDashboard.putData("Omni Direction", omniForward);
SmartDashboard.putData("Xbox Controller", driverDevice);
SmartDashboard.putData("Autonomous Dance", autoDance);
}
示例11: robotInit
import edu.wpi.first.wpilibj.smartdashboard.SendableChooser; //导入方法依赖的package包/类
/**
* This function is run when the robot is first started up and should be
* used for any initialization code.
*/
public void robotInit() {
BadRobotMap.isPrototype = true;
// Initialize all subsystems
CommandBase.init();
autoChooser = new SendableChooser();
//autoChooser.addDefault("Drive Forward + Auto Fire", new DriveForwardAutoAimShoot());
autoChooser.addObject("Drive Straight Forward", new DriveStraightForward(5));
autoChooser.addObject("Auto Aim", new AimWithCamera());
autoChooser.addObject("Auto Aim And Shoot", new AutoAimAndShoot());
autoChooser.addDefault("Drive Forward And Shoot (variable time, 3 frisbees)", new DriveForwardAndShoot());
autoChooser.addObject("Shoot three frisbees", new SafeShoot(3));
autoChooser.addObject("Drive Forward to 109 inches, turn and Shoot", new DriveForwardToWallTurnAndShoot());
autoChooser.addObject("Shoot and Drive Backwards", new ShootAndDriveBack());
autoChooser.addObject("Shootanddoalotofotherstuff", new DriveForwardTurnShootDriveBack());
SmartDashboard.putData("Autonomous Mode Chooser", autoChooser);
if (CommandBase.lightSystem != null) {
new RunLights(ILights.kYellow).start();
}
}
示例12: robotInit
import edu.wpi.first.wpilibj.smartdashboard.SendableChooser; //导入方法依赖的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);
}
}
示例13: populateSelect
import edu.wpi.first.wpilibj.smartdashboard.SendableChooser; //导入方法依赖的package包/类
private <T extends Enum<?>> void populateSelect(SendableChooser<T> chooser, Class<T> options) {
boolean first = true;
for (T value : options.getEnumConstants()) {
if (first) {
first = false;
chooser.addDefault(value.toString(), value);
} else {
chooser.addObject(value.toString(), value);
}
}
}
示例14: robotInit
import edu.wpi.first.wpilibj.smartdashboard.SendableChooser; //导入方法依赖的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
}
示例15: robotInit
import edu.wpi.first.wpilibj.smartdashboard.SendableChooser; //导入方法依赖的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();
}