當前位置: 首頁>>代碼示例>>Java>>正文


Java SendableChooser.addObject方法代碼示例

本文整理匯總了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);
}
 
開發者ID:FRC-6413,項目名稱:steamworks-java,代碼行數:25,代碼來源:Robot.java

示例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);
    
}
 
開發者ID:ArcticWarriors,項目名稱:snobot-2017,代碼行數:28,代碼來源:SnobotDriveJoystickFactory.java

示例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);
    }
 
開發者ID:CraftSpider,項目名稱:Stronghold2016-340,代碼行數:28,代碼來源:Robot.java

示例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);
	
}
 
開發者ID:FernbankLINKSRobotics,項目名稱:GRITS16,代碼行數:18,代碼來源:Robot.java

示例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);
 }
 
開發者ID:trc492,項目名稱:Frc2016FirstStronghold,代碼行數:19,代碼來源:Test.java

示例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();
  }
 
開發者ID:FRC2832,項目名稱:Robot_2015,代碼行數:22,代碼來源:DebugHardware.java

示例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");
}
 
開發者ID:BrianSelle,項目名稱:Team3310FRC2014,代碼行數:27,代碼來源:RobotMain.java

示例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());
    }
 
開發者ID:SaratogaMSET,項目名稱:649code2014,代碼行數:21,代碼來源:Robot2014.java

示例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);
}
 
開發者ID:Team2168,項目名稱:2014_Main_Robot,代碼行數:19,代碼來源:Robot.java

示例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);
}
 
開發者ID:Team-2502,項目名稱:RobotCode2013,代碼行數:23,代碼來源:OI.java

示例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();
    }
}
 
開發者ID:BadRobots1014,項目名稱:BadRobot2013,代碼行數:29,代碼來源:RobotMain.java

示例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);
    }
}
 
開發者ID:Team2667,項目名稱:SteamWorks,代碼行數:43,代碼來源:Robot.java

示例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);
    }
  }
}
 
開發者ID:ligerbots,項目名稱:Steamworks2017Robot,代碼行數:12,代碼來源:OperatorInterface.java

示例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
}
 
開發者ID:Team4914,項目名稱:2017-emmet,代碼行數:44,代碼來源:Robot.java

示例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();
}
 
開發者ID:Team4914,項目名稱:2017-emmet,代碼行數:35,代碼來源:Robot.java


注:本文中的edu.wpi.first.wpilibj.smartdashboard.SendableChooser.addObject方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。