本文整理汇总了Java中com.o3dr.services.android.lib.drone.property.Speed类的典型用法代码示例。如果您正苦于以下问题:Java Speed类的具体用法?Java Speed怎么用?Java Speed使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Speed类属于com.o3dr.services.android.lib.drone.property包,在下文中一共展示了Speed类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: changedConnectionStateTest
import com.o3dr.services.android.lib.drone.property.Speed; //导入依赖的package包/类
@Test
public void changedConnectionStateTest() throws Exception {
Altitude altitude = new Altitude();
altitude.setAltitude(100);
altitude.setTargetAltitude(150);
Speed speed = new Speed();
speed.setGroundSpeed(5);
speed.setVerticalSpeed(1);
Type type = new Type();
type.setFirmware(Type.Firmware.ARDU_COPTER);
when(drone.getAttribute(AttributeType.ALTITUDE)).thenReturn(altitude);
when(drone.getAttribute(AttributeType.SPEED)).thenReturn(speed);
when(drone.getAttribute(AttributeType.TYPE)).thenReturn(type);
service.addConnectionListener(droneConnectionListener);
service.onDroneEvent(AttributeEvent.STATE_CONNECTED, new Bundle());
DroneState droneState = new DroneStateMapper().getDroneState(drone);
droneState.setIsConnected(true);
verify(droneConnectionListener).onDroneStateChange(droneState);
}
开发者ID:Project-Helin,项目名称:drone-onboard-app,代码行数:27,代码来源:DroneConnectionServiceTest.java
示例2: checkForGroundCollision
import com.o3dr.services.android.lib.drone.property.Speed; //导入依赖的package包/类
private void checkForGroundCollision() {
Speed speed = getSpeed();
Altitude altitude = getAltitude();
if (speed == null || altitude == null)
return;
double verticalSpeed = speed.getVerticalSpeed();
double altitudeValue = altitude.getAltitude();
boolean isCollisionImminent = altitudeValue
+ (verticalSpeed * COLLISION_SECONDS_BEFORE_COLLISION) < 0
&& verticalSpeed < COLLISION_DANGEROUS_SPEED_METERS_PER_SECOND
&& altitudeValue > COLLISION_SAFE_ALTITUDE_METERS;
Bundle extrasBundle = new Bundle(1);
extrasBundle.putBoolean(EXTRA_IS_GROUND_COLLISION_IMMINENT, isCollisionImminent);
notifyAttributeUpdated(ACTION_GROUND_COLLISION_IMMINENT, extrasBundle);
}
开发者ID:jiaminghan,项目名称:droidplanner-master,代码行数:19,代码来源:Drone.java
示例3: onReceive
import com.o3dr.services.android.lib.drone.property.Speed; //导入依赖的package包/类
@Override
public void onReceive(Context context, Intent intent) {
final String action = intent.getAction();
final Drone drone = getDrone();
switch (action) {
case AttributeEvent.ATTITUDE_UPDATED:
final Attitude attitude = drone.getAttribute(AttributeType.ATTITUDE);
onOrientationUpdate(attitude);
break;
case AttributeEvent.SPEED_UPDATED:
final Speed droneSpeed = drone.getAttribute(AttributeType.SPEED);
onSpeedUpdate(droneSpeed);
final Altitude droneAltitude = drone.getAttribute(AttributeType.ALTITUDE);
onAltitudeUpdate(droneAltitude);
break;
case AttributeEvent.STATE_UPDATED:
updateFlightTimer();
break;
}
}
开发者ID:sommishra,项目名称:DroidPlanner-Tower,代码行数:25,代码来源:TelemetryFragment.java
示例4: speakPeriodic
import com.o3dr.services.android.lib.drone.property.Speed; //导入依赖的package包/类
private void speakPeriodic(Drone drone) {
// Drop the message if the previous one is not done yet.
if (mIsPeriodicStatusStarted.compareAndSet(false, true)) {
final Map<String, Boolean> speechPrefs = mAppPrefs.getPeriodicSpeechPrefs();
mMessageBuilder.setLength(0);
if (speechPrefs.get(DroidPlannerPrefs.PREF_TTS_PERIODIC_BAT_VOLT)) {
final Battery droneBattery = drone.getAttribute(AttributeType.BATTERY);
mMessageBuilder.append(context.getString(R.string.periodic_status_bat_volt,
droneBattery.getBatteryVoltage()));
}
if (speechPrefs.get(DroidPlannerPrefs.PREF_TTS_PERIODIC_ALT)) {
final Altitude altitude = drone.getAttribute(AttributeType.ALTITUDE);
mMessageBuilder.append(context.getString(R.string.periodic_status_altitude, (int) (altitude.getAltitude())));
}
if (speechPrefs.get(DroidPlannerPrefs.PREF_TTS_PERIODIC_AIRSPEED)) {
final Speed droneSpeed = drone.getAttribute(AttributeType.SPEED);
mMessageBuilder.append(context.getString(R.string.periodic_status_airspeed, (int) (droneSpeed.getAirSpeed())));
}
if (speechPrefs.get(DroidPlannerPrefs.PREF_TTS_PERIODIC_RSSI)) {
final Signal signal = drone.getAttribute(AttributeType.SIGNAL);
mMessageBuilder.append(context.getString(R.string.periodic_status_rssi, (int) signal.getRssi()));
}
speak(mMessageBuilder.toString(), true, PERIODIC_STATUS_UTTERANCE_ID);
}
}
开发者ID:mxiao6,项目名称:Tower-develop,代码行数:31,代码来源:TTSNotificationProvider.java
示例5: onSpeedAltitudeAndClimbRateUpdate
import com.o3dr.services.android.lib.drone.property.Speed; //导入依赖的package包/类
public void onSpeedAltitudeAndClimbRateUpdate(Speed speed, Altitude altitude) {
if(speed != null) {
airSpeed.setText(String.format("%3.1f", speed.getAirSpeed()));
groundSpeed.setText(String.format("%3.1f", speed.getGroundSpeed()));
climbRate.setText(String.format("%3.1f", speed.getVerticalSpeed()));
}
if(altitude != null) {
double alt = altitude.getAltitude();
double targetAlt = altitude.getTargetAltitude();
this.altitude.setText(String.format("%3.1f", alt));
targetAltitude.setText(String.format("%3.1f", targetAlt));
}
}
开发者ID:jiaminghan,项目名称:droidplanner-master,代码行数:16,代码来源:TelemetryFragment.java
示例6: speakPeriodic
import com.o3dr.services.android.lib.drone.property.Speed; //导入依赖的package包/类
private void speakPeriodic(Drone drone) {
// Drop the message if the previous one is not done yet.
if (mIsPeriodicStatusStarted.compareAndSet(false, true)) {
final SparseBooleanArray speechPrefs = mAppPrefs.getPeriodicSpeechPrefs();
mMessageBuilder.setLength(0);
if (speechPrefs.get(R.string.pref_tts_periodic_bat_volt_key)) {
final Battery droneBattery = drone.getAttribute(AttributeType.BATTERY);
mMessageBuilder.append(String.format("battery %2.1f volts. ", droneBattery.getBatteryVoltage()));
}
if (speechPrefs.get(R.string.pref_tts_periodic_alt_key)) {
final Altitude altitude = drone.getAttribute(AttributeType.ALTITUDE);
mMessageBuilder.append("altitude, ").append((int) (altitude.getAltitude())).append(" meters. ");
}
if (speechPrefs.get(R.string.pref_tts_periodic_airspeed_key)) {
final Speed droneSpeed = drone.getAttribute(AttributeType.SPEED);
mMessageBuilder.append("airspeed, ").append((int) (droneSpeed.getAirSpeed()))
.append(" meters per second. ");
}
if (speechPrefs.get(R.string.pref_tts_periodic_rssi_key)) {
final Signal signal = drone.getAttribute(AttributeType.SIGNAL);
mMessageBuilder.append("r s s i, ").append((int) signal.getRssi()).append(" decibels");
}
speak(mMessageBuilder.toString(), true, PERIODIC_STATUS_UTTERANCE_ID);
}
}
开发者ID:sommishra,项目名称:DroidPlanner-Tower,代码行数:31,代码来源:TTSNotificationProvider.java
示例7: onSpeedUpdate
import com.o3dr.services.android.lib.drone.property.Speed; //导入依赖的package包/类
private void onSpeedUpdate(Speed speed) {
if (speed != null) {
final SpeedUnitProvider speedUnitProvider = getSpeedUnitProvider();
airSpeed.setText(speedUnitProvider.boxBaseValueToTarget(speed.getAirSpeed()).toString());
groundSpeed.setText(speedUnitProvider.boxBaseValueToTarget(speed.getGroundSpeed()).toString());
climbRate.setText(speedUnitProvider.boxBaseValueToTarget(speed.getVerticalSpeed()).toString());
}
}
开发者ID:sommishra,项目名称:DroidPlanner-Tower,代码行数:10,代码来源:TelemetryFragment.java
示例8: getSpeed
import com.o3dr.services.android.lib.drone.property.Speed; //导入依赖的package包/类
private Speed getSpeed() {
org.droidplanner.core.drone.variables.Speed droneSpeed = this.droneMgr.getDrone().getSpeed();
return new Speed(droneSpeed.getVerticalSpeed().valueInMetersPerSecond(),
droneSpeed.getGroundSpeed().valueInMetersPerSecond(),
droneSpeed.getAirSpeed().valueInMetersPerSecond());
}
开发者ID:jiaminghan,项目名称:droidplanner-master,代码行数:7,代码来源:DroneApi.java
示例9: getSpeed
import com.o3dr.services.android.lib.drone.property.Speed; //导入依赖的package包/类
public Speed getSpeed() {
Speed speed = getAttribute(AttributeType.SPEED, Speed.class.getClassLoader());
return speed == null ? new Speed() : speed;
}
开发者ID:jiaminghan,项目名称:droidplanner-master,代码行数:5,代码来源:Drone.java
示例10: updateSpeed
import com.o3dr.services.android.lib.drone.property.Speed; //导入依赖的package包/类
protected void updateSpeed() {
TextView speedTextView = (TextView) findViewById(R.id.speedValueTextView);
Speed droneSpeed = this.drone.getAttribute(AttributeType.SPEED);
speedTextView.setText(String.format("%3.1f", droneSpeed.getGroundSpeed()) + "m/s");
}
开发者ID:3drobotics,项目名称:DroneKit-Android-Starter,代码行数:6,代码来源:MainActivity.java
注:本文中的com.o3dr.services.android.lib.drone.property.Speed类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论