本文整理匯總了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);
}