本文整理汇总了Java中org.firstinspires.ftc.robotcore.external.navigation.Acceleration类的典型用法代码示例。如果您正苦于以下问题:Java Acceleration类的具体用法?Java Acceleration怎么用?Java Acceleration使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Acceleration类属于org.firstinspires.ftc.robotcore.external.navigation包,在下文中一共展示了Acceleration类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: doTelemetry
import org.firstinspires.ftc.robotcore.external.navigation.Acceleration; //导入依赖的package包/类
protected void doTelemetry() {
if (compass.isCalibrating()) {
telemetry.addData("compass", "calibrating %s", Math.round(timer.seconds())%2==0 ? "|.." : "..|");
} else {
// getDirection() returns a traditional compass heading in the range [0,360),
// with values increasing in a CW direction
telemetry.addData("heading", "%.1f", compass.getDirection());
// getAcceleration() returns the current 3D acceleration experienced by
// the sensor. This is used internally to the sensor to compute its tilt and thence
// to correct the magnetometer reading to produce tilt-corrected values in getDirection()
Acceleration accel = compass.getAcceleration();
double accelMagnitude = Math.sqrt(accel.xAccel*accel.xAccel + accel.yAccel*accel.yAccel + accel.zAccel*accel.zAccel);
telemetry.addData("accel", accel);
telemetry.addData("accel magnitude", "%.3f", accelMagnitude);
// getMagneticFlux returns the 3D magnetic field flux experienced by the sensor
telemetry.addData("mag flux", compass.getMagneticFlux());
}
// the command register provides status data
telemetry.addData("command", "%s", compass.readCommand());
telemetry.update();
}
开发者ID:ykarim,项目名称:FTC2016,代码行数:30,代码来源:SensorMRCompass.java
示例2: loop
import org.firstinspires.ftc.robotcore.external.navigation.Acceleration; //导入依赖的package包/类
@Override
public void loop(RobotContext ctx) {
Acceleration currentAcceleration = sensor.getAcceleration();
double gForceInXAxis = currentAcceleration.xAccel;
double gForceInYAxis = currentAcceleration.yAccel;
double gForceInZAxis = currentAcceleration.zAccel;
telemetry.addData("ACCL:", "Current acceleration: X - " + gForceInXAxis + " Y - " +
gForceInYAxis + " z - " + gForceInZAxis);
}
开发者ID:MHS-FIRSTrobotics,项目名称:RadicalRobotics2017,代码行数:12,代码来源:AccelerationSensorExample.java
注:本文中的org.firstinspires.ftc.robotcore.external.navigation.Acceleration类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论