本文整理汇总了Java中edu.wpi.first.wpilibj.DriverStationLCD类的典型用法代码示例。如果您正苦于以下问题:Java DriverStationLCD类的具体用法?Java DriverStationLCD怎么用?Java DriverStationLCD使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
DriverStationLCD类属于edu.wpi.first.wpilibj包,在下文中一共展示了DriverStationLCD类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: robotInit
import edu.wpi.first.wpilibj.DriverStationLCD; //导入依赖的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 AutonomousGroup();
// Initialize all subsystems
CommandBase.init();
// Ouput program info to system log.
System.out.println("+---------------------------------------------+");
System.out.println("| Team "+teamNo+" - Software Version: "+versionNo+" |");
System.out.println("+---------------------------------------------+");
// Output program info to driver station.
DriverStationLCD.getInstance().println(DriverStationLCD.Line.kUser1, 1, "Team: "+teamNo+" - Software Version: "+versionNo);
DriverStationLCD.getInstance().println(DriverStationLCD.Line.kUser2, 2, "Robot initialized.");
DriverStationLCD.getInstance().updateLCD();
}
示例2: DriveTrain
import edu.wpi.first.wpilibj.DriverStationLCD; //导入依赖的package包/类
/**
*
*/
public DriveTrain() {
super("DriveTrain");
FLeftMotor = new Victor(RobotMap.FLeftMotorPWM);
FRightMotor = new Victor(RobotMap.FRightMotorPWM);
BLeftMotor = new Victor(RobotMap.BLeftMotorPWM);
BRightMotor = new Victor(RobotMap.BRightMotorPWM);
//MLeftMotor = new Victor(RobotMap.MLeftMotorPWM);
//MRightMotor = new Victor(RobotMap.MRightMotorPWM);
drive = new RobotDrive(FLeftMotor, BLeftMotor, FRightMotor, BRightMotor);
//drive.setInvertedMotor(RobotDrive.MotorType.kFrontRight, true);
//drive.setInvertedMotor(RobotDrive.MotorType.kRearLeft, true);
GShiftSolDown = new Solenoid(RobotMap.DriveTrainLowGearSolenoid);
GShiftSolUp = new Solenoid(RobotMap.DriveTrainHighGearSolenoid);
display = DriverStationLCD.getInstance();
}
示例3: robotInit
import edu.wpi.first.wpilibj.DriverStationLCD; //导入依赖的package包/类
/**
* This method is run when the robot is first powered on.
*/
public void robotInit() {
//initialize compressor
compressor = new Compressor(RobotMap.pressureSwitch.getInt(), RobotMap.compressorRelay.getInt());
// Initialize all subsystems
CommandBase.init();
//Initialize auto mode chooser
autoSelectInit();
//create thread to write dashboard variables
printer = new ConsolePrinter(200);
printer.startThread();
//init message box on driverstation
lcd = DriverStationLCD.getInstance();
//Console Message so we know robot finished loading
System.out.println("****Robot Done Loading****");
}
示例4: disabledPeriodic
import edu.wpi.first.wpilibj.DriverStationLCD; //导入依赖的package包/类
/**
* This method is run repeatedly while the robot is disabled.
*/
public void disabledPeriodic() {
//get auto selection from dashboard and write it to lcd
autonomousCommand = (AutoCommandGroup) autoChooser.getSelected();
lcd.println(DriverStationLCD.Line.kUser2, 1, autonomousCommand.getName());
lcd.updateLCD();
//Kill all active commands
Scheduler.getInstance().removeAll();
Scheduler.getInstance().disable();
//Check to see if the gyro is drifting, if it is re-initialize it.
gyroReinit();
//set arduino lights
setArduinoAutonomousStatuses();
}
示例5: printToDash
import edu.wpi.first.wpilibj.DriverStationLCD; //导入依赖的package包/类
public static void printToDash(int line, String str) {
DriverStationLCD dsLCD = DriverStationLCD.getInstance();
dsLCD.clear();
switch (line) {
case 1:
dsLCD.println(DriverStationLCD.Line.kUser1, 1, str);
break;
case 2:
dsLCD.println(DriverStationLCD.Line.kUser2, 1, str);
break;
case 3:
dsLCD.println(DriverStationLCD.Line.kUser3, 1, str);
break;
case 4:
dsLCD.println(DriverStationLCD.Line.kUser4, 1, str);
break;
case 5:
dsLCD.println(DriverStationLCD.Line.kUser5, 1, str);
break;
case 6:
dsLCD.println(DriverStationLCD.Line.kUser6, 1, str);
break;
}
dsLCD.updateLCD();
}
示例6: printToDash
import edu.wpi.first.wpilibj.DriverStationLCD; //导入依赖的package包/类
private void printToDash(int line, String str) {
DriverStationLCD dsLCD = DriverStationLCD.getInstance();
switch (line) {
case 1:
dsLCD.println(DriverStationLCD.Line.kUser1, 1, str);
break;
case 2:
dsLCD.println(DriverStationLCD.Line.kUser2, 1, str);
break;
case 3:
dsLCD.println(DriverStationLCD.Line.kUser3, 1, str);
break;
case 4:
dsLCD.println(DriverStationLCD.Line.kUser4, 1, str);
break;
case 5:
dsLCD.println(DriverStationLCD.Line.kUser5, 1, str);
break;
case 6:
dsLCD.println(DriverStationLCD.Line.kUser6, 1, str);
break;
}
dsLCD.updateLCD();
}
示例7: dsPrintln
import edu.wpi.first.wpilibj.DriverStationLCD; //导入依赖的package包/类
private static void dsPrintln(String data) {
dsBuffer.addElement(data);
dsBuffer.removeElementAt(0);
dash.println(DriverStationLCD.Line.kUser1, 1,
(String) dsBuffer.elementAt(5));
dash.println(DriverStationLCD.Line.kUser6, 1,
(String) dsBuffer.elementAt(4));
dash.println(DriverStationLCD.Line.kUser5, 1,
(String) dsBuffer.elementAt(3));
dash.println(DriverStationLCD.Line.kUser4, 1,
(String) dsBuffer.elementAt(2));
dash.println(DriverStationLCD.Line.kUser3, 1,
(String) dsBuffer.elementAt(1));
dash.println(DriverStationLCD.Line.kUser2, 1,
(String) dsBuffer.elementAt(0));
dash.updateLCD();
}
示例8: getControlMode
import edu.wpi.first.wpilibj.DriverStationLCD; //导入依赖的package包/类
public ControlMode getControlMode()
{
if (controlMode.value == ControlMode.arcadeDrive.value)
{
DriverStationComm.printMessage(DriverStationLCD.Line.kUser1, 1, "Control mode: Arcade 2 Joystick");
}
else if (controlMode.value == ControlMode.tankDrive.value)
{
DriverStationComm.printMessage(DriverStationLCD.Line.kUser1, 1, "Control mode: Tank");
}
else
{
DriverStationComm.printMessage(DriverStationLCD.Line.kUser1, 1, "Control mode: Arcade 1 Joystick");
}
return controlMode;
}
示例9: controlAutoAim
import edu.wpi.first.wpilibj.DriverStationLCD; //导入依赖的package包/类
/**
* Very messy method. Shouldn't be that hard to figure out though. Read
* through it carefully. :P
*/
public static void controlAutoAim() {
if (toggleFeed == false) {
if (autoAimButton.get() == true) {
Angle.setAngle(Vision.calculateAngle());
AutoCenter.lineUpTarget();
} else if (autoAngleButton.get() == true) {
Angle.setAngle(2.00);
} //Angle Control code below is for testing, calibrating, and manual shooting if problems arise.
else if (raiseAngleButton.get() == true) {
Angle.angleUp();
} else if (lowerAngleButton.get() == true) {
Angle.angleDown();
LCD.println(DriverStationLCD.Line.kUser4, 1, "lowering angleeee");
} else {
Angle.angleStop();
}
} else { //If toggleFeed is now true and climbButton is not pressed, go to feeder angle
Angle.setAngle(feederAngle); //Feeder Angle (Approximately)
}
}
示例10: lineUpTarget
import edu.wpi.first.wpilibj.DriverStationLCD; //导入依赖的package包/类
/**
* This code might require a bit of operator control. If the robot is moving
* too fast, it will over shoot and start oscillating. Operator must know
* when to let go of the button. Following should be self-explanatory. Join
* the build team if you do not understand.
*/
public static void lineUpTarget() {
if (Vision.centerOfGravity() < largeMaxLeftBound) {
DriveTrain.rotateDrive(largeTurningRightSpeed);
LCD.println(DriverStationLCD.Line.kUser1, 1, "...Turning Left...");
} else if (Vision.centerOfGravity() > largeMaxRightBound) {
DriveTrain.rotateDrive(largeTurningLeftSpeed);
LCD.println(DriverStationLCD.Line.kUser1, 1, "...Turning Right...");
} else {
if (Vision.centerOfGravity() < smallMaxLeftBound) { //Space between the last dot is to check that the loop is working correctly.
DriveTrain.rotateDrive(smallTurningRightSpeed);
LCD.println(DriverStationLCD.Line.kUser1, 1, "...Turning Left.. .");
} else if (Vision.centerOfGravity() > smallMaxRightBound) {
DriveTrain.rotateDrive(smallTurningLeftSpeed);
LCD.println(DriverStationLCD.Line.kUser1, 1, "...Turning Right.. .");
} else {
DriveTrain.tankDrive(0, 0);
LCD.println(DriverStationLCD.Line.kUser1, 1, "<Centered on Target>");
}
}
}
示例11: sayNOCLEAR
import edu.wpi.first.wpilibj.DriverStationLCD; //导入依赖的package包/类
/**
* Display a line of text without scrolling. Max 21 characters / line.
* <p/>
* @param ln Which line to print in
* @param msg What message to display
*/
public void sayNOCLEAR(int ln, String msg) {
if (msg == null) {
msg = "null message passed";
}
// DriverStationLCD.kLineLength=21
// Add 21 spaces to clear the rest of the line
msg += " ";
// If the given message is too long, truncate it
if (msg.length() > 21) {
msg = msg.substring(0, 21);
}
switch (ln) {
case (1):
output.println(DriverStationLCD.Line.kUser1, 1, msg);
break;
case (2):
output.println(DriverStationLCD.Line.kUser2, 1, msg);
break;
case (3):
output.println(DriverStationLCD.Line.kUser3, 1, msg);
break;
case (4):
output.println(DriverStationLCD.Line.kUser4, 1, msg);
break;
case (5):
output.println(DriverStationLCD.Line.kUser5, 1, msg);
break;
case (6):
output.println(DriverStationLCD.Line.kUser6, 1, msg);
break;
}
// Show the message
output.updateLCD();
}
示例12: autonomousInit
import edu.wpi.first.wpilibj.DriverStationLCD; //导入依赖的package包/类
public void autonomousInit() {
// schedule the autonomous command (example)
//autonomousCommand.start();
// Ouput status info to driver station.
DriverStationLCD.getInstance().println(DriverStationLCD.Line.kUser3, 2, "Started Autonomous.");
}
示例13: teleopInit
import edu.wpi.first.wpilibj.DriverStationLCD; //导入依赖的package包/类
public void teleopInit() {
// This makes sure that the autonomous stops running when
// teleop starts running. If you want the autonomous to
// continue until interrupted by another command, remove
// this line or comment it out.
autonomousCommand.cancel();
// Output status info to driver station.
DriverStationLCD.getInstance().println(DriverStationLCD.Line.kUser3, 2, "Started Tele-op.");
}
示例14: testPeriodic
import edu.wpi.first.wpilibj.DriverStationLCD; //导入依赖的package包/类
/**
* This function is called periodically during test mode
*/
public void testPeriodic() {
LiveWindow.run();
// Output status info to driver station.
DriverStationLCD.getInstance().println(DriverStationLCD.Line.kUser3, 2, "Started Test Mode.");
}
示例15: log
import edu.wpi.first.wpilibj.DriverStationLCD; //导入依赖的package包/类
/**
* Log to Driver Station LCD.
*
* @param ln The line number from 1 to 6.
* @param col The column - either 1 or 2.
* @param text The line to send.
*/
public static void log(int ln, int col, String text) {
Line line = lines[ln - 1];
int pos = col == 1 ? 1 : (DriverStationLCD.kLineLength / 2);
text = text.trim();//.substring(0, (DriverStationLCD.kLineLength / 2) - 1); // Constrain
clearLine(ln);
ds.println(line, pos, text);
update();
}