V4版本,怎么判断触发了避障导致悬停,会导致自动飞行结束吗?visionDetectionState.getSyst...

Completed

Comments

44 comments

  • DJI Developer Support
    V4版本,怎么判断触发了避障导致悬停,会导致自动飞行结束吗?-->如果触发了避障,setVisionControlStateUpdatedcallback可以监听到状态。触发避障之后会中断航线。理论上,避障导致航线中断,finish回调中应该会给出错误描述。 visionDetectionState.getSystemWarning() == VisionSystemWarning.DANGEROUS为true但是自动飞行未结束 -- 有确定开启了避障吗?使用的是什么飞机呢?
    0
    Comment actions Permalink
  • 起风了

    精灵4 rtk msdk4.16.1   开启了避障,并且触发了避障,但是不会中断航线,会停止在空中,只能在航线轨迹中后退,不能前进和上升下降。

    0
    Comment actions Permalink
  • 起风了

    我们想监听到飞机自动飞行中触发了避障并且悬停的这个状态时机,然后提示用户前方有障碍物导致的悬停。

    0
    Comment actions Permalink
  • DJI Developer Support
    1.但是不会中断航线,会停止在空中,只能在航线轨迹中后退,不能前进和上升下降 -->我确认了一下,这个表现也是符合逻辑的。一般来说,遇到障碍物会暂停航线,但是有时会出现航线中断,并调用finish,这时回调中会给出错误提示。 2.我们想监听到飞机自动飞行中触发了避障并且悬停的这个状态时机,然后提示用户前方有障碍物导致的悬停。 -->如果要实现这个需求,需要监听感知障碍物信息。因为没有接口可以直接监听到你说的状态,但是触发避障的距离一般是在2m左右,你可以通过setVisionDetectionStateUpdatedCallback获取到避障数据,然后对距离进行判断,从而实现这个功能。
    0
    Comment actions Permalink
  • 起风了

    实测了多次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);
    }
    }
    });
    0
    Comment actions Permalink
  • 起风了

    dji pilot是可以实现的,能否给出和dji pilot一样的方法,问下你们开发人员吧

    0
    Comment actions Permalink
  • 起风了

    我们是使用TimelineElement实现的自动飞行,我们想实现自动飞行中触发了避障并且悬停时提示用户,能否提供解决方法啊

    1
    Comment actions Permalink
  • DJI Developer Support
    监听任务状态,这个时候是pause。然后再判断你是不是手动触发的
    0
    Comment actions Permalink
  • 起风了

    你说的时MissionControl.getInstance().addListener吗?我记录了日志没打印出自动飞行中遇到障碍物悬停回调

    public void onEvent(@Nullable TimelineElement element, TimelineEvent event, DJIError error)
    也没有并没有返回PAUSE或PAUSE_ERROR

    0
    Comment actions Permalink
  • DJI Developer Support
    如果自主飞行任务的话,我们更加推荐使用航点任务开发,也就是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。
    0
    Comment actions Permalink
  • 起风了

    我想得到的是:自动飞行中触发了避障导致悬停时的回调!以上你提供的api均不能够判断出这种场景

    0
    Comment actions Permalink
  • 翅膀少了'羽毛'

    我觉得有必要问下pilot开发人员是怎么判断的,因为这个我们不好模拟,这种情况下不提示用户,用户肯定会说我们系统有问题!!!

    0
    Comment actions Permalink
  • DJI Developer Support
    我这边尝试去与pilot开发人员沟通一下这部分是如何实现的,但是pilot与MSDK在底层代码上并不相同,所以只能在MSDK上尽量靠近pilot的实现方案。麻烦等待一段时间。
    0
    Comment actions Permalink
  • DJI Developer Support
    我们和pilot同事沟通了一下,pilot的实现并没有涉及到直接获取无人机触发避障的这一个状态。如果pilot可以实现,能不能截图给我们。这样方便pilot同事查找代码。
    1
    Comment actions Permalink
  • 翅膀少了'羽毛'

    0
    Comment actions Permalink
  • 起风了

    经测试御2进阶版自动飞行触发避障会悬停但不会toast提示,而精灵4rtk会悬停且会提示。以下是精灵4rtk的截图

    0
    Comment actions Permalink
  • 翅膀少了'羽毛'

    直接看我发的图片吧,右上角有提示,机型为M300RTK

    0
    Comment actions Permalink
  • 翅膀少了'羽毛'

    说错了左上角

    0
    Comment actions Permalink
  • DJI Developer Support
    pilot这边查询到了这个提示的来源:DJIWaypointV2Error MISSION_WAYPOINT_INTERRUPT_REASON_AVOID = new DJIWaypointV2Error("Waypoint mission was interrupted due to obstacle avoidance.", -13); 这个错误码也就是航线因为避障中断的错误码,MSDK可以通过waypointV2MissionExecutionEvent.getError()(或者waypointMissionExecutionEvent.getError())获取到这个错误。
    0
    Comment actions Permalink
  • 起风了

    以下方法使用waypointMissionExecutionEvent.getError()并没有触发啊

    MissionControl.getInstance().getWaypointMissionOperator().addListener(new WaypointMissionOperatorListener()
    {
    @Override
    public void onDownloadUpdate(@NonNull WaypointMissionDownloadEvent waypointMissionDownloadEvent)
    {

    }

    @Override
    public void onUploadUpdate(@NonNull WaypointMissionUploadEvent waypointMissionUploadEvent)
    {

    }

    @Override
    public void onExecutionUpdate(@NonNull WaypointMissionExecutionEvent waypointMissionExecutionEvent)
    {
    DJIError error = waypointMissionExecutionEvent.getError();
    if (error != null)
    {
    LogUtils.w("航点任务执行事件-错误code:" + error.getErrorCode() + "错误详情:" + error.getDescription());
    if (error.getErrorCode() == OBSTACLE_AVOIDANCE_INTERRUPTED_CODE && mRootView != null)
    {
    mRootView.showHintMessage("避障悬停");
    }
    }

    }

    @Override
    public void onExecutionStart()
    {

    }

    @Override
    public void onExecutionFinish(@Nullable DJIError djiError)
    {

    }
    });

    0
    Comment actions Permalink
  • DJI Developer Support
    你执行的是timeline任务吗?有尝试过替换成waypoint的效果吗?你之前提到御2进阶版不会提示,而精灵4rtk会,这里没有触发错误是哪一个机型呢?
    0
    Comment actions Permalink
  • 起风了

    是的,用的是timeline,御2进阶版和精灵4rtk都没有触发

    0
    Comment actions Permalink
  • 起风了

    还未替换成waypoint

    0
    Comment actions Permalink
  • DJI Developer Support
    如果您的timeline任务可以使用waypoint代替,建议使用waypoint来实现。pilot实现航点飞行是基于waypoint实现的,因此我之前的回复给出的是waypoint相关的内容。 如果你想要继续使用timeline,添加监听的时候可以参照下面这个形式,djierror中或许可以获取到相关内容: MissionControl.getInstance().addListener(new MissionControl.Listener() { @Override public void onEvent(@Nullable TimelineElement timelineElement, TimelineEvent timelineEvent, @Nullable DJIError djiError) { }});
    0
    Comment actions Permalink
  • 起风了

    这个方法我们早就试过了,不会得到避障悬停的错误回调

    0
    Comment actions Permalink
  • DJI Developer Support
    那么建议您替换成waypoint来实现自主飞行,触发避障之后可以通过waypointMissionExecutionEvent和getCurrentState==pause来判断是触发了避障,导致航点任务暂停。
    0
    Comment actions Permalink
  • 起风了

    测试发现使用waypoint来实现自主飞行,遇到避障也会悬停并且不能操控,御2进阶版在onExecutionUpdate方法中判断if (waypointMissionExecutionEvent
    .getCurrentState() == WaypointMissionState.EXECUTION_PAUSED)
    {
    //避障悬停时此处未触发,当按暂停键的时候这里会触发
    }

    还得给一个明确的方案吧,这个问题这么久还没解决

    1
    Comment actions Permalink
  • DJI Developer Support
    我想了解一下pilot在触发避障之后,航线会提示已经暂停吗?如果pilot会提示暂停,但是MSDK没有,那么我们可以提单转交给工程师去修复这个问题。这样就需要麻烦您上传一个视频展示一下pilot和MSDK之间的不同,我们转交给工程师处理。 链接:https://pan-sec.djicorp.com/s/y4HkDRk6yGDgKxc 密码:dji123 其实您之前也提到了御2进阶版使用pilot自动飞行触发避障会悬停但不会toast提示,但是精灵4RTK会存在toast提示。我想在这一方面,不同机型上存在差异。
    0
    Comment actions Permalink
  • 起风了

    使用精灵4rtk录制,已上传,请查看3分44秒提示的toast,我们需要得到这个悬停状态回调,然后弹出触发避障提示用户

    0
    Comment actions Permalink
  • 翅膀少了'羽毛'

    我不是还发了m300的避障任务暂停截图吗?难道看不到我的信息?

    1
    Comment actions Permalink

Please sign in to leave a comment.