本文整理汇总了Java中com.kauailabs.navx.frc.AHRS.reset方法的典型用法代码示例。如果您正苦于以下问题:Java AHRS.reset方法的具体用法?Java AHRS.reset怎么用?Java AHRS.reset使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.kauailabs.navx.frc.AHRS
的用法示例。
在下文中一共展示了AHRS.reset方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: Sensors
import com.kauailabs.navx.frc.AHRS; //导入方法依赖的package包/类
public Sensors() {
ahrs = new AHRS(SPI.Port.kMXP);
ahrs.reset();
intakeLidar = new AnalogInput(RobotMap.INTAKE_LIDAR_PORT);
longLidar = new AnalogInput(RobotMap.LONG_LIDAR_PORT);
table = NetworkTable.getTable("SmartDashboard");
}
示例2: DriveTrain
import com.kauailabs.navx.frc.AHRS; //导入方法依赖的package包/类
public DriveTrain() {
Robot.logList.add(this);
ahrs = new AHRS(RobotMap.Ports.AHRS);
left = new VictorSP(RobotMap.Ports.leftDriveMotor);
right = new VictorSP(RobotMap.Ports.rightDriveMotor);
right.setInverted(true);
final double gearRatio = 4/3;
final double ticksPerRev = 2048;
final double radius = 1.5;
final double magic = 1/.737;
final double calculated = (radius * 2 * Math.PI) * gearRatio * magic / ticksPerRev;
ahrs.reset();
leftEncoder = new Encoder(RobotMap.Ports.leftEncoderOne, RobotMap.Ports.leftEncoderTwo, true, EncodingType.k4X);
leftEncoder.setDistancePerPulse(calculated);
leftEncoder.setPIDSourceType(PIDSourceType.kRate);
rightEncoder = new Encoder(RobotMap.Ports.rightEncoderOne, RobotMap.Ports.rightEncoderTwo, false, EncodingType.k4X);
rightEncoder.setDistancePerPulse(calculated);
rightEncoder.setPIDSourceType(PIDSourceType.kRate);
leftPID = new PIDController(
RobotMap.Values.driveTrainP, RobotMap.Values.driveTrainI,
RobotMap.Values.driveTrainD, RobotMap.Values.driveTrainF,
new RateEncoder(leftEncoder), left);
leftPID.setInputRange(-300, 300);
leftPID.setOutputRange(-1, 1);
rightPID = new PIDController(
RobotMap.Values.driveTrainP, RobotMap.Values.driveTrainI,
RobotMap.Values.driveTrainD, RobotMap.Values.driveTrainF,
new RateEncoder(rightEncoder), right);
rightPID.setInputRange(-300, 300);
rightPID.setOutputRange(-1, 1);
// Let's show everything on the LiveWindow
LiveWindow.addActuator("Drive Train", "Left Motor", (VictorSP) left);
LiveWindow.addActuator("Drive Train", "Right Motor", (VictorSP) right);
LiveWindow.addSensor("Drive Train", "Left Encoder", leftEncoder);
LiveWindow.addSensor("Drive Train", "Right Encoder", rightEncoder);
LiveWindow.addSensor("Drive Train", "Gyro", ahrs);
LiveWindow.addActuator("Drive Train", "PID", leftPID);
}