跳到内容 跳到主导航 跳到页脚

梯控导航

介绍

梯控导航指机器人的行走能力,机器人可以从A点行动至B点,行走过程中可以自动规划路线,不同楼层自动切换地图,可以有效避开障碍物。

机器人导航所使用的传感器比较多,包括底部激光雷达,RGBD,头部IR传感器(部分机型)等,所以在导航中请不要遮挡这些传感器,以免出现机器人不走,路径规划失败等问题。

机器人能执行导航动作的前提是:机器人已新建地图,并且在该地图上已经定位成功;机器人必须建立巡线;机器人必须处于巡线的点位之上;机器人的地图不能使用复制的地图,会造成点位ID,楼层冲突,无法到达;雷达处于开启状态; 仅支持梯控机器人;请一定要注意这一点!

获取多地图点位数据信息

方法名称:getMultiFloorConfigAndPose 结果回调:

        //获取多地图点位列表:
        RobotApi.getInstance().getMultiFloorConfigAndPose(Definition.DEBUG_REQ_ID, new CommandListener() {
            @Override
            public void onResult(int result, String message, String extraData) {
                Type type = new TypeToken<ArrayList<MultiFloorInfo>>() {
                }.getType();
                try {
                    Log.d(TAG, "initAllMapInfo: " + result + " msg:" + message);
                    mDatas = new Gson().fromJson(message, type);
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
        });

导航到指定位置

方法名称:startElevatorNavigation 结果回调:

        RobotApi.getInstance().startElevatorNavigation(Definition.DEBUG_REQ_ID,
                dest,
                floor,
                new ActionListener() {
                    @Override
                    public void onResult(int status, String message, String extraData) throws RemoteException {
                        Log.e("mName", "onResult: " + status + " responseString:" + message + " extraData:" + extraData);
                        handlerResult(status, message, extraData);
                    }

                    @Override
                    public void onError(int errorCode, String errorString, String extraData) throws RemoteException {
                        Log.e("mName", "onError: " + errorCode + " errorString:" + errorString + " extraData:" + extraData);
                        handlerError(errorCode, errorString, extraData);
                    }

                    @Override
                    public void onStatusUpdate(int status, String data, String extraData) throws RemoteException {
                        Log.e("mName", "onStatusUpdate: " + status + " data:" + data + " extraData:" + extraData);
                        handlerStatusUpdate(status, data, extraData);
                    }
                });

handlerResult 方法:

    private void handlerResult(int status, String message, String extraData) {
        switch (status) {
            case Definition.RESULT_OK:
                //stop(ComponentResult.RESULT_NAVIGATION_ARRIVED, message, extraData);
                break;
            case Definition.ACTION_RESPONSE_STOP_SUCCESS:
                //stop(status, message + " 停止成功", extraData);
                break;
            case Definition.RESULT_FAILURE:
                //stop(status, message + " 导航失败", extraData);
                break;
            case Definition.STATUS_NAVI_OUT_MAP:
                //stop(ComponentError.ERROR_NAVIGATION_OUT_MAP, message, extraData);
                break;
            case Definition.STATUS_NAVI_GLOBAL_PATH_FAILED:
                //stop(ComponentError.ERROR_NAVIGATION_GLOBAL_PATH_FAILED, message, extraData);
                break;
            case Definition.STATUS_NAVI_MULTI_MAP_NOT_MATCH:
            case Definition.STATUS_NAVI_MULTI_LORA_DISCONNECT:
            case Definition.STATUS_NAVI_MULTI_LORA_CONFIG_FAIL:
            case Definition.STATUS_NAVI_MULTI_VERSION_NOT_MATCH:
                //stop(ComponentError.ERROR_MULTIPLE_MODE_ERROR, message, extraData);
                break;
            case Definition.STATUS_NAVI_WHEEL_SLIP:
                //stop(ComponentError.ERROR_NAVI_WHEEL_SLIP, message, extraData);
                break;
            default:
                //stop(status, message, extraData);
                break;
        }
    }

handlerError 方法:

    private void handlerError(int errorCode, String message, String extraData) {
        switch (errorCode) {
            case Definition.ERROR_NOT_ESTIMATE:
//                stop(ComponentError.ERROR_NOT_ESTIMATE, "navigation not estimate", extraData);
                break;
            case Definition.ERROR_IN_DESTINATION:
//                stop(ComponentError.ERROR_NAVIGATION_ALREADY_IN_DESTINATION, "already in destination", extraData);
                break;
            case Definition.ERROR_DESTINATION_NOT_EXIST:
//                stop(ComponentError.ERROR_DESTINATION_NOT_EXIST, "destination not exist", extraData);
                break;
            case Definition.ERROR_DESTINATION_CAN_NOT_ARRAIVE:
//                stop(ComponentError.ERROR_DESTINATION_CAN_NOT_ARRIVE, "navigation moving time out", extraData);
                break;
            case Definition.ERROR_MULTI_ROBOT_WAITING_TIMEOUT:
//                stop(ComponentError.ERROR_MULTI_ROBOT_WAITING_TIMEOUT);
                break;
            case Definition.ERROR_NAVIGATION_AVOID_TIMEOUT:
//                stop(ComponentError.ERROR_NAVIGATION_AVOID_TIMEOUT, "navigation avoid time out", "");
            case Definition.ACTION_RESPONSE_ALREADY_RUN:
//                stop(ComponentError.ERROR_REQUEST_RES_BUSY);
                break;
            case Definition.ACTION_RESPONSE_REQUEST_RES_ERROR:
//                stop(ComponentError.ERROR_REQUEST_RES_FAILED);
                break;
            case Definition.ERROR_WHEEL_OVER_CURRENT_RUN_OUT:
//                stop(ComponentError.ERROR_WHEEL_OVER_CURRENT_RUN_OUT, "wheel over current retry count run out", extraData);
                break;
            case Definition.ACTION_RESPONSE_RES_UNAVAILBALE:
//                stop(ComponentError.ERROR_OPEN_RADAR_FAILED, "res unavailable: " + message, extraData);
                break;
            default:
//                stop(errorCode, message, extraData);
                break;
        }
    }

handlerStatusUpdate 方法:

    private void handlerStatusUpdate(int status, String data, String extraData) {
        switch (status) {
            case Definition.STATUS_GOAL_OCCLUDED:
            case Definition.STATUS_NAVI_AVOID:
//                updateStatus(ComponentStatus.STATUS_NAVIGATION_AVOID_START,"navigation avoid start", extraData);
                break;
            case Definition.STATUS_GOAL_OCCLUDED_END:
            case Definition.STATUS_NAVI_AVOID_END:
//                updateStatus(ComponentStatus.STATUS_NAVIGATION_AVOID_END,"navigation avoid end", extraData);
                break;
            case Definition.STATUS_NAVI_OBSTACLES_AVOID:
//                updateStatus(ComponentStatus.STATUS_OBSTACLES_AVOID,"pause to obstacles avoid", extraData);
                break;
            case Definition.STATUS_START_NAVIGATION:
//                updateStatus(ComponentStatus.STATUS_START_NAVIGATION,"start navigation");
                break;
            case Definition.STATUS_NAVI_MULTI_ROBOT_WAITING:
//                updateStatus(ComponentStatus.STATUS_NAVI_MULTI_ROBOT_WAITING,"navigation multi robot waiting");
                break;
            case Definition.STATUS_NAVI_MULTI_ROBOT_WAITING_END:
//                updateStatus(ComponentStatus.STATUS_NAVI_MULTI_ROBOT_WAITING_END,"navigation multi robot waiting end");
                break;
            case Definition.STATUS_NAVI_GO_STRAIGHT:
//                updateStatus(ComponentStatus.STATUS_NAVIGATION_GO_STRAIGHT, data,extraData);
                break;
            case Definition.STATUS_NAVI_TURN_LEFT:
//                updateStatus(ComponentStatus.STATUS_NAVIGATION_TURN_LEFT, data, extraData);
                break;
            case Definition.STATUS_NAVI_TURN_RIGHT:
//                updateStatus(ComponentStatus.STATUS_NAVIGATION_TURN_RIGHT, data, extraData);
                break;
            case Definition.STATUS_NAVI_SET_PRIORITY_FAILED:
//                updateStatus(ComponentStatus.STATUS_NAVIGATION_SET_PRIORITY_FAILED, data, extraData);
                break;
            default:
//                updateStatus(status, data, extraData);
                break;
        }
    }

参数:

  • definition.DEBUG_REQ_ID: int类型 ;命令id, 定义参数reqid
  • dest:string 类型; 本次导航目的地 ;目的地不为空,且是目标楼层地图上所在的点
  • floor:int类型;目的地所在楼层映射;目的地楼层的楼层映射(FloorIndex)不能为0,且需在MapTool多层管理的地图组中
  • listener:ActionListener类型;功能监听;需要的回调:onResult、onError、onStatusUpdate

适用平台:

豹小秘豹小秘2mini招财豹招财豹Pro豹小秘DP梯控

注意:调用该接口前需要确保已定位

停止导航到指定位置

方法名称:stopAdvanceNavigation 调用方式:

RobotApi.getInstance().stopAdvanceNavigation(reqId);

适用平台:

豹小秘豹小秘2mini招财豹招财豹Pro豹小秘DP梯控

注意:该接口只能用于停止startElevatorNavigation启动的导航

状态和错误码定义

onStatusUpdate

导航过程中上报的事件,上报时任务不会停止。

名称code定义
STATUS_START_NAVIGATION1014导航开始
STATUS_NAVI_REPLACE_DESTINATION1048切换目的地并开始导航
STATUS_ESTIMATE_LOST1045定位丢失
STATUS_DISTANCE_WITH_DESTINATION1050距目的地距离,单位(m)例:extraData = “3”
STATUS_NAVI_AVOID_IMMEDIATELY1051避障
STATUS_GOAL_OCCLUDED1016避障开始
STATUS_NAVI_AVOID1018
STATUS_GOAL_OCCLUDED_END1017避障结束
STATUS_NAVI_AVOID_END1019
STATUS_NAVI_OBSTACLES_AVOID1023
STATUS_NAVI_MULTI_ROBOT_WAITING1034开始等待其他机器人通过(多机避障开始)
STATUS_NAVI_MULTI_ROBOT_WAITING_END1035多机避障结束
STATUS_NAVI_GO_STRAIGHT1036机器人在直线上行走
STATUS_NAVI_TURN_LEFT1037机器人左转
STATUS_NAVI_TURN_RIGHT1038机器人右转

onResult

导航功能结束时,上报的状态

名称code定义
RESULT_NAVIGATION_ARRIVED102到达目的地
RESULT_OK1
RESULT_FAILURE2导航失败
RESULT_DESTINATION_AVAILABLE103目的地可达,未被占用
RESULT_DESTINATION_IN_RANGE104到达目的地范围内
ACTION_RESPONSE_STOP_SUCCESS3action停止成功
STATUS_NAVI_OUT_MAP1020超出地图范围
STATUS_NAVI_GLOBAL_PATH_FAILED1025导航路径规划失败
STATUS_NAVI_MULTI_MAP_NOT_MATCH1040多机地图未匹配
STATUS_NAVI_MULTI_LORA_DISCONNECT1041多机lora断开连接
STATUS_NAVI_MULTI_LORA_CONFIG_FAIL1042多机配置有问题
STATUS_NAVI_MULTI_VERSION_NOT_MATCH1043视觉未匹配
STATUS_NAVI_WHEEL_SLIP1044导航时轮子打滑

onError

导航出现异常结束时,上报的状态

名称code定义
ERROR_PARAMETER-102参数错误
ERROR_TARGET_NOT_FOUND-107未找到点位
ERROR_DESTINATION_NOT_EXIST-108目的地不存在
ERROR_ESTIMATE_ERROR-128重定位失败
ERROR_MULTIPLE_MODE_ERROR-127多机信息错误
ERROR_PARAMS_JSON_PARSER_ERROR-32750026json解析错误
ERROR_NO_AVAILABLE_DESTINATION-129未找到可用的目的地
ERROR_NOT_ESTIMATE-116未定位
ERROR_IN_DESTINATION-113已经在目的地
ERROR_DESTINATION_CAN_NOT_ARRAIVE-109目的地不可达
ERROR_MULTI_ROBOT_WAITING_TIMEOUT-125多机避障等待超时
ERROR_NAVIGATION_AVOID_TIMEOUT-136机器人避障超时
ACTION_RESPONSE_ALREADY_RUN-1Request busy
ACTION_RESPONSE_REQUEST_RES_ERROR-6请求失败
ACTION_RESPONSE_RES_UNAVAILBALE-9请求不可用
ERROR_WHEEL_OVER_CURRENT_RUN_OUT-124

梯控示例地址

这篇文章是否有帮助?

0