本文整理汇总了Java中edu.wpi.first.wpilibj.smartdashboard.SmartDashboard.getString方法的典型用法代码示例。如果您正苦于以下问题:Java SmartDashboard.getString方法的具体用法?Java SmartDashboard.getString怎么用?Java SmartDashboard.getString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类edu.wpi.first.wpilibj.smartdashboard.SmartDashboard
的用法示例。
在下文中一共展示了SmartDashboard.getString方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: autonInit
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard; //导入方法依赖的package包/类
public void autonInit() {
// these are what we will type in for the according auton
final String defaultAuton = "default";
final String AutonLeft = "Left";
final String AutonCenter = "Center";
final String AutonRight = "Right";
SendableChooser<String> chooser = new SendableChooser<>();
// autoSelected = chooser.getSelected();
String autonSelected = SmartDashboard.getString("Auto Selector", defaultAuton);
System.out.println("Auto selected: " + autonSelected);
String gameData = DriverStation.getInstance().getGameSpecificMessage();
if(autonSelected == AutonLeft) {
//left side start auton
if(gameData.charAt(0) == 'R') {
// drive forwards to a position for defense or make way to left side
}else if(gameData.charAt(0) == 'L') {
// goes to left side switch and attempts to place block
}else {
// Default Auton based off starting position
}
}else if(autonSelected == AutonCenter) {
// center start auton
if(gameData.charAt(1) == 'R') {
// goes to right side switch and attempts to place block
}else if(gameData.charAt(1) == 'L') {
// goes to left side switch and attempts to place block
}else {
// Default Auton based off starting position
}
}else if(autonSelected == AutonRight) {
// right side start auton
if(gameData.charAt(0) == 'R') {
// goes to right side switch and attempts to place block
}else if(gameData.charAt(0) == 'L') {
// drives forwards to a position for defense or make way to left side
}else {
// Default Auton based off starting position
}
}else {
// Default [Drive 12FT straight]
}
}
示例2: getString
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard; //导入方法依赖的package包/类
public static String getString(String name, String defaultValue) {
return SmartDashboard.getString(name, defaultValue);
}