本文整理匯總了Java中edu.wpi.first.wpilibj.smartdashboard.SendableChooser類的典型用法代碼示例。如果您正苦於以下問題:Java SendableChooser類的具體用法?Java SendableChooser怎麽用?Java SendableChooser使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
SendableChooser類屬於edu.wpi.first.wpilibj.smartdashboard包,在下文中一共展示了SendableChooser類的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() {
chooser = new SendableChooser<Command>();
chassis = new Chassis();
intake = new Intake();
winch = new Winch();
// shooter = new Shooter();
oi = new OI();
imu = new ADIS16448_IMU(ADIS16448_IMU.Axis.kX);
pdp = new PowerDistributionPanel();
chooser.addDefault("Drive Straight", new DriveStraight(73, 0.5));
//chooser.addObject("Left Gear Curve", new LeftGearCurve());
chooser.addObject("Left Gear Turn", new LeftGearTurn());
//chooser.addObject("Right Gear Curve", new RightGearCurve());
chooser.addObject("Right Gear Turn", new RightGearTurn());
chooser.addObject("Middle Gear", new StraightGear());
chooser.addObject("Turn in place", new TurnDegrees(60, .2));
SmartDashboard.putData("Autonomous Chooser", chooser);
}
示例2: 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);
}
示例3: AutonomousFactory
import edu.wpi.first.wpilibj.smartdashboard.SendableChooser; //導入依賴的package包/類
public AutonomousFactory(Snobot2017 aSnobot, IDriverJoystick aDriverJoystick)
{
mPositionChooser = new SendableChooser<StartingPositions>();
mCommandParser = new CommandParser(aSnobot, mPositionChooser);
mAutoModeTable = NetworkTable.getTable(SmartDashBoardNames.sAUTON_TABLE_NAME);
mPositioner = aSnobot.getPositioner();
mAutonModeChooser = new SnobotAutonCrawler(Properties2017.sAUTON_FILE_FILTER.getValue())
.loadAutonFiles(Properties2017.sAUTON_DIRECTORY.getValue() + "/", Properties2017.sAUTON_DEFAULT_FILE.getValue());
SmartDashboard.putData(SmartDashBoardNames.sAUTON_CHOOSER, mAutonModeChooser);
for (StartingPositions pos : StartingPositions.values())
{
mPositionChooser.addObject(pos.toString(), pos);
}
SmartDashboard.putData(SmartDashBoardNames.sPOSITION_CHOOSER, mPositionChooser);
addListeners();
}
示例4: 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);
}
示例5: 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);
}
示例6: 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);
}
示例7: 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);
}
示例8: AutoChooser
import edu.wpi.first.wpilibj.smartdashboard.SendableChooser; //導入依賴的package包/類
public AutoChooser() {
chooser = new SendableChooser();
chooser.addDefault("DO_NOTHING", DO_NOTHING);
chooser.addObject("DRIVE_FORWARD", DRIVE_FORWARD);
chooser.addObject("DEPOSIT_GEAR_LEFT", DEPOSIT_GEAR_LEFT);
chooser.addObject("DEPOSIT_GEAR_CENTER", DEPOSIT_GEAR_CENTER);
chooser.addObject("DEPOSIT_GEAR_RIGHT", DEPOSIT_GEAR_RIGHT);
chooser.addObject("DRIVE_AND_SHOOT_BLUE_LEFT", DRIVE_AND_SHOOT_BLUE_LEFT);
chooser.addObject("DRIVE_AND_SHOOT_BLUE_CENTER", DRIVE_AND_SHOOT_BLUE_CENTER);
chooser.addObject("DRIVE_AND_SHOOT_BLUE_RIGHT", DRIVE_AND_SHOOT_BLUE_RIGHT);
chooser.addObject("DRIVE_AND_SHOOT_RED_LEFT", DRIVE_AND_SHOOT_RED_LEFT);
chooser.addObject("DRIVE_AND_SHOOT_RED_CENTER", DRIVE_AND_SHOOT_RED_CENTER);
chooser.addObject("DRIVE_AND_SHOOT_RED_RIGHT", DRIVE_AND_SHOOT_RED_RIGHT);
SmartDashboard.putData("Auto_Mode_Chooser", chooser);
}
示例9: 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() {
cc = new CameraController(50);
dt = Drivetrain.getInstance();
sh = Shooter.getInstance();
tr = Turret.getInstance();
lt = LeftTomahawk.getInstance();
rt = RightTomahawk.getInstance();
pn = Pneumatics.getInstance();
//lt = Lifter.getInstance();
//bb = Beaglebone.getInstance();
//comp = new Compressor();
//comp.start();
//comp.setClosedLoopControl(true);
oi = new OI();
mode = SmartDashboard.getBoolean("Two Drivers?", false);
chooser = new SendableChooser();
chooser.addDefault("Default Auto", new Drive());
// chooser.addObject("My Auto", new MyAutoCommand());
SmartDashboard.putData("Auto mode", chooser);
}
示例10: FrcChoiceMenu
import edu.wpi.first.wpilibj.smartdashboard.SendableChooser; //導入依賴的package包/類
/**
* Constructor: Creates an instance of the object.
*
* @param menuTitle specifies the title of the menu.
*/
public FrcChoiceMenu(final String menuTitle)
{
if (debugEnabled)
{
dbgTrace = new TrcDbgTrace(moduleName + "." + menuTitle, tracingEnabled, traceLevel, msgLevel);
}
if (menuTitle == null)
{
throw new NullPointerException("menuTitle cannot be null.");
}
this.menuTitle = menuTitle;
chooser = new SendableChooser<>();
hashMap = new HashMap<>();
}
示例11: 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();
}
示例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();
autoChooser = new SendableChooser();
autoChooser.addDefault("Simple Autonomous", new SimpleAutonomous());
//autoChooser.addObject("name", );
//autoChooser.addObject("name", );
SmartDashboard.putData("Autonomous Chooser", autoChooser);
shooterFan = new ShooterFan();
eightBallGrabber = new EightBallGrabber();
prefs = Preferences.getInstance();
// BEGIN AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=CONSTRUCTORS
// END AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=CONSTRUCTORS
// This MUST be here. If the OI creates Commands (which it very likely
// will), constructing it during the construction of CommandBase (from
// which commands extend), subsystems are not guaranteed to be
// yet. Thus, their requires() statements may grab null pointers. Bad
// news. Don't move it.
oi = new OI();
// END AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=AUTONOMOUS
// Setup compass to stream data
}
示例13: 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");
}
示例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() {
// 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());
}
示例15: 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);
}