当前位置: 首页>>代码示例>>Java>>正文


Java AHRS.reset方法代码示例

本文整理汇总了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");
}
 
开发者ID:SouthEugeneRoboticsTeam,项目名称:Stronghold-2016,代码行数:8,代码来源:Sensors.java

示例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);
	
}
 
开发者ID:Team997Coders,项目名称:2017SteamBot2,代码行数:45,代码来源:DriveTrain.java


注:本文中的com.kauailabs.navx.frc.AHRS.reset方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。