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


Java SmartDashboard.getString方法代碼示例

本文整理匯總了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]
		
	}
}
 
開發者ID:RED-M0CKING-LINE,項目名稱:Team5183Robot2018J,代碼行數:53,代碼來源:Auton.java

示例2: getString

import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard; //導入方法依賴的package包/類
public static String getString(String name, String defaultValue) {
	return SmartDashboard.getString(name, defaultValue);
}
 
開發者ID:Team997Coders,項目名稱:2017SteamBot2,代碼行數:4,代碼來源:CustomDashboard.java


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