本文整理汇总了Java中edu.wpi.first.wpilibj.templates.subsystems.DriveTrain类的典型用法代码示例。如果您正苦于以下问题:Java DriveTrain类的具体用法?Java DriveTrain怎么用?Java DriveTrain使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DriveTrain类属于edu.wpi.first.wpilibj.templates.subsystems包,在下文中一共展示了DriveTrain类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: init
import edu.wpi.first.wpilibj.templates.subsystems.DriveTrain; //导入依赖的package包/类
public static void init() {
// 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.
driveTrain = new DriveTrain();
shooter = new Shooter();
vision = new Vision();
pitch = new Pitch();
trigger = new Trigger();
loader1 = new Loader1();
loader2 = new Loader2();
//leave oi at the bottom and apart from the other initialized things
//if it is initialized before the subsytems, it throws some null pointer exceptions
//those are not fun
//please leave it here
oi = new OI();
// Show what command your subsystem is running on the SmartDashboard
SmartDashboard.putData(exampleSubsystem);
}
示例2: runSmartDashboard
import edu.wpi.first.wpilibj.templates.subsystems.DriveTrain; //导入依赖的package包/类
/**
* SmartDashboard is used to send diagnostic information back to the
* DriverStation here.
*/
private static void runSmartDashboard() {
SmartDashboard.putNumber("Shooter Angle: ", Angle.angleEncoder.getDistance()); //Should be very accurate.
SmartDashboard.putNumber("Shooter RPM: ", Shooter.currentRPM); //line plot :D
SmartDashboard.putBoolean("RPM Status: ", Shooter.shooterStatus()); //Big green/red square on the smartdashboard.
SmartDashboard.putNumber("Shooter PWM Value: ", Shooter.shooterPWM1.getSpeed()); //Diagnostic information. Not really important to the driver
SmartDashboard.putBoolean("Auto Limit", autonomousSwitch.get());
SmartDashboard.putBoolean("Front Limit", DriveTrain.frontLimit.get()); //Not really used.
SmartDashboard.putNumber("Timer", timer.get());
SmartDashboard.putNumber("Target Angle", Vision.calculateAngle());
if (initEmergencyConstantValue){
SmartDashboard.putNumber("EMERGENCY CORRECTION VALUE", Vision.emergencyCorrectionValue);
initEmergencyConstantValue=false;
}
}
示例3: initialize
import edu.wpi.first.wpilibj.templates.subsystems.DriveTrain; //导入依赖的package包/类
protected void initialize() {
gyro.reset();
DriveTrain.polarMode = !(DriveTrain.polarMode);
if(DriveTrain.polarMode == true){
SmartDashboard.putString("polarMode", "Polar Mode");
}else{
SmartDashboard.putString("polarMode", "Field Oriented");
}
}
示例4: StandardDrive
import edu.wpi.first.wpilibj.templates.subsystems.DriveTrain; //导入依赖的package包/类
/**
*
* @param d
* @param j
*/
public StandardDrive(RobotDrive d, Joystick j){
super("StandardDrive");
DriveTrain = ScraperBike.getDriveTrain();
//gyro1 = DriveTrain.getGyro1();
requires(DriveTrain);
Joystick = j;
drive = d;
}
示例5: execute
import edu.wpi.first.wpilibj.templates.subsystems.DriveTrain; //导入依赖的package包/类
protected void execute() {
// DriveTrain.getCommandLog().setInputs("" + gyro1.getAngle());
// DriveTrain.setMetaCommandOutputs();
//drive.arcadeDrive(Joystick1);
//TODO: if pause works, uncomment.
// if (RobotMap.isJoystickEnabled()) {
DriveTrain.powerDriveTrain();
DriveTrain.arcadeDrive(Joystick);
// }
}
示例6: autonomousPeriodic
import edu.wpi.first.wpilibj.templates.subsystems.DriveTrain; //导入依赖的package包/类
/**
* Code here loops every 20 milliseconds during the autonomous period. While
* loops should not be used.
*/
public void autonomousPeriodic() {
Shooter.calculateRPM(); //Constantly calculates the rpm
Shooter.runShooter(); //Adjusts the shooter PWM value accordly depending on the RPM
if (timer.get() < 8) { //Fire Frisbees for the first 8 seconds
DriveTrain.tankDrive(0, 0);
//Gets current robot location from switch on robot
if (autonomousSwitch.get() == false) {
Angle.setAngle(centerShotAngle);
} else {
Angle.setAngle(sideShotAngle);
}
//When the angle is set, fire the Frisbees
if (AutoCenter.isAutoAimDone() == true) {
readyToFire = true;
} else {
readyToFire = false;
}
Shooter.fireShooter(readyToFire);
} else if (timer.get() < 8.5) { //Back up the robot after 8 seconds for 0.5 seconds
DriveTrain.tankDrive(0.7, 0.7);
} else if (timer.get() < 10.5) { //Rotate the robot after 8.5 seconds for 2 seconds
DriveTrain.rotateDrive(0.5);
} else { //Stop the robot after 10.5 seconds
DriveTrain.tankDrive(0, 0);
LCD.println(DriverStationLCD.Line.kUser6, 1, ",");
}
//For testing purposes
if (timer.get() > 15) { //Resets the timer every 15 seconds
timer.reset();
}
runSmartDashboard(); //Constantly sends diagnostic information from the robot to the DriverStation
LCD.updateLCD(); //Updates LCD so that we have feedback on what is happening. Only one is needed per periodic loop.
}