V4版本,怎么判断触发了避障导致悬停,会导致自动飞行结束吗?visionDetectionState.getSyst...
V4版本,怎么判断触发了避障导致悬停,会导致自动飞行结束吗?visionDetectionState.getSystemWarning() == VisionSystemWarning.DANGEROUS为true但是自动飞行未结束
-
1.但是不会中断航线,会停止在空中,只能在航线轨迹中后退,不能前进和上升下降 -->我确认了一下,这个表现也是符合逻辑的。一般来说,遇到障碍物会暂停航线,但是有时会出现航线中断,并调用finish,这时回调中会给出错误提示。 2.我们想监听到飞机自动飞行中触发了避障并且悬停的这个状态时机,然后提示用户前方有障碍物导致的悬停。 -->如果要实现这个需求,需要监听感知障碍物信息。因为没有接口可以直接监听到你说的状态,但是触发避障的距离一般是在2m左右,你可以通过setVisionDetectionStateUpdatedCallback获取到避障数据,然后对距离进行判断,从而实现这个功能。 -
实测了多次setVisionDetectionStateUpdatedCallback只能判断旁边有障碍物;
避障悬停时setVisionControlStateUpdatedcallback()的回调isAdvancedPilotAssistanceSystemActive和isAscentLimitedByObstacle都返回false;
以下api我都试过了均不能进入判断
KeyManager.getInstance().addListener(RadarKey.create(RadarKey.RADAR_OBSTACLE_AVOIDANCE_STATE), new KeyListener()
{
@Override
public void onValueChange(@Nullable Object o, @Nullable Object newValue)
{
if (newValue != null && newValue instanceof PerceptionInformation)
{
PerceptionInformation newValue1 = (PerceptionInformation) newValue;
ToastUtil.showShort(
"雷达检测距离--" + "getUpwardObstacleDistance---" + newValue1.getUpwardObstacleDistance()
+ "---getDownwardObstacleDistance" + newValue1.getDownwardObstacleDistance());
}
}
});
FlightControllerKey waypointMissionInterruption = FlightControllerKey
.createFlightAssistantKey(FlightControllerKey.WAYPOINT_MISSION_INTERRUPTION);
FlightControllerKey isAircraftHovering = FlightControllerKey
.createFlightAssistantKey(FlightControllerKey.IS_AIRCRAFT_HOVERING);
KeyManager.getInstance().addListener(waypointMissionInterruption, new KeyListener()
{
@Override
public void onValueChange(@Nullable Object oldValue, @Nullable Object newValue)
{
if (newValue != null && newValue instanceof WaypointMissionInterruption)
{
WaypointMissionInterruption waypoint = (WaypointMissionInterruption) newValue;
ToastUtil.showShort("航点任务中断了" + waypoint.getMissionID());
}
}
});
KeyManager.getInstance().addListener(isAircraftHovering, new KeyListener()
{
@Override
public void onValueChange(@Nullable Object oldValue, @Nullable Object newValue)
{
if (newValue != null && newValue instanceof Boolean)
{
Boolean isHovering = (Boolean) newValue;
ToastUtil.showShort("飞机悬停了" + isHovering);
}
}
}); -
如果自主飞行任务的话,我们更加推荐使用航点任务开发,也就是waypointmission,功能上可以完全替代timeline。 如果是visionDetectionState.getSystemWarning() == VisionSystemWarning.DANGEROUS为true的状态,表明当前距离障碍物很近,可以作为一种可能会触发避障的提示,但不一定就触发了避障。 1.如果是想要监听避障的状态,setVisionControlStateUpdatedcallback的isBraking表达的是避障的状态。 2.如果是想要监听无人机周边存在障碍物,可能会发避障,那么就可以通过setVisionDetectionStateUpdatedCallback,它可以获取到障碍物的距离,如果无人机离障碍物很近,那么有较大概率触发避障。这里visionDetectionState.getSystemWarning() == VisionSystemWarning.DANGEROUS可以作为一种判断障碍物离无人机很近的方式。 setVisionControlStateUpdatedcallback的isBraking表达的是避障的状态,当它为true,那么无人机触发了避障。这个回调还给出了一些其他的接口,分别表示的是不同的状态,如果是监听避障那么就关注isBraking。 其他一些状态的解释:isAvoidingActiveObstacleCollision表达的是主动避障的状态,isAscentLimitedByObstacle表达的是上方障碍物是否距无人机在1m,这里要注意有些无人机可能没有上方避障,是否存在可以在技术参数中看到。isPerformingPrecisionLanding表达的是是由触发了精准降落。isAdvancedPilotAssistanceSystemActive表达的是是否触发了APAS。 -
pilot这边查询到了这个提示的来源:DJIWaypointV2Error MISSION_WAYPOINT_INTERRUPT_REASON_AVOID = new DJIWaypointV2Error("Waypoint mission was interrupted due to obstacle avoidance.", -13); 这个错误码也就是航线因为避障中断的错误码,MSDK可以通过waypointV2MissionExecutionEvent.getError()(或者waypointMissionExecutionEvent.getError())获取到这个错误。
Please sign in to leave a comment.
Comments
19 comments