Skip to content Skip to main navigation Skip to footer

Elevator Navigation

Introduction

Elevator navigation refers to the robot’s ability to move: the robot can travel from point A to point B, automatically plan its route along the way, automatically switch maps between floors, and effectively avoid obstacles.

Robot navigation uses many sensors, including the bottom lidar, RGBD and the head IR sensor (on some models). Do not block these sensors during navigation, or problems such as the robot not moving or path planning failing may occur.

The robot can only navigate if: a map has been created for it and it has been localized successfully on that map; a patrol line has been created for it; it is standing on a map point of the patrol line; it does not use a copied map (a copied map causes map point ID and floor conflicts, and destinations cannot be reached); the lidar is on; and it is an elevator-control robot. Be sure to keep this in mind!

Note: Kagao elevator control requires ROM 10.3 or later; in-house elevator control requires ROM 10.5 or later. Ask your pre-sales contact which elevator control type your robot uses.

Get Multi-Map Point Data

Method name: getMultiFloorConfigAndPose Result callback:

        //Get the multi-map point list:
        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();
                }
            }
        });

Navigate to a Specified Location

Method name: startElevatorNavigation Result callback:

        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 method:

    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 + " stopped successfully", extraData);
                break;
            case Definition.RESULT_FAILURE:
                //stop(status, message + " navigation failed", 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 method:

    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 method:

    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;
        }
    }

Parameters:

  • definition.DEBUG_REQ_ID: int; command ID, the reqid parameter
  • dest: string; the destination of this navigation. It must not be empty and must be a map point on the target floor’s map
  • floor: int; the floor mapping of the destination floor. The destination floor’s floor mapping (FloorIndex) cannot be 0 and must be in the map group managed in MapTool’s multi-floor management
  • listener: ActionListener; listener for the function. Required callbacks: onResult, onError, onStatusUpdate

Supported platforms:

GreetingBotGreetingBot 2GreetingBot MiniLuckiBotLuckiBot ProBigScreenBotElevator Control
NoNoNoNoNoNoYes

Note: Make sure the robot is localized before calling this API

Stop Navigating to a Specified Location

Method name: stopAdvanceNavigation How to call:

RobotApi.getInstance().stopAdvanceNavigation(reqId);

Supported platforms:

GreetingBotGreetingBot 2GreetingBot MiniLuckiBotLuckiBot ProBigScreenBotElevator Control
NoNoNoNoNoNoYes

Note: This API can only stop navigation started by startElevatorNavigation

Status and Error Code Definitions

onStatusUpdate

Events reported during navigation. The task does not stop when these are reported.

NamecodeDefinition
STATUS_START_NAVIGATION1014Navigation started
STATUS_NAVI_REPLACE_DESTINATION1048Destination switched and navigation started
STATUS_ESTIMATE_LOST1045Localization lost
STATUS_DISTANCE_WITH_DESTINATION1050Distance to the destination, in m. Example: extraData = “3”
STATUS_NAVI_AVOID_IMMEDIATELY1051Obstacle avoidance
STATUS_GOAL_OCCLUDED1016Obstacle avoidance started
STATUS_NAVI_AVOID1018
STATUS_GOAL_OCCLUDED_END1017Obstacle avoidance ended
STATUS_NAVI_AVOID_END1019
STATUS_NAVI_OBSTACLES_AVOID1023
STATUS_NAVI_MULTI_ROBOT_WAITING1034Started waiting for other robots to pass (multi-robot obstacle avoidance started)
STATUS_NAVI_MULTI_ROBOT_WAITING_END1035Multi-robot obstacle avoidance ended
STATUS_NAVI_GO_STRAIGHT1036Robot is moving in a straight line
STATUS_NAVI_TURN_LEFT1037Robot is turning left
STATUS_NAVI_TURN_RIGHT1038Robot is turning right

onResult

Status reported when navigation ends

NamecodeDefinition
RESULT_NAVIGATION_ARRIVED102Arrived at the destination
RESULT_OK1
RESULT_FAILURE2Navigation failed
RESULT_DESTINATION_AVAILABLE103Destination is reachable and not occupied
RESULT_DESTINATION_IN_RANGE104Arrived within range of the destination
ACTION_RESPONSE_STOP_SUCCESS3Action stopped successfully
STATUS_NAVI_OUT_MAP1020Out of map range
STATUS_NAVI_GLOBAL_PATH_FAILED1025Navigation path planning failed
STATUS_NAVI_MULTI_MAP_NOT_MATCH1040Multi-robot maps do not match
STATUS_NAVI_MULTI_LORA_DISCONNECT1041Multi-robot LoRa disconnected
STATUS_NAVI_MULTI_LORA_CONFIG_FAIL1042Multi-robot configuration problem
STATUS_NAVI_MULTI_VERSION_NOT_MATCH1043Vision does not match
STATUS_NAVI_WHEEL_SLIP1044Wheel slipped during navigation

onError

Status reported when navigation ends abnormally

NamecodeDefinition
ERROR_PARAMETER-102Parameter error
ERROR_TARGET_NOT_FOUND-107Map point not found
ERROR_DESTINATION_NOT_EXIST-108Destination does not exist
ERROR_ESTIMATE_ERROR-128Relocalization failed
ERROR_MULTIPLE_MODE_ERROR-127Multi-robot information error
ERROR_PARAMS_JSON_PARSER_ERROR-32750026JSON parsing error
ERROR_NO_AVAILABLE_DESTINATION-129No available destination found
ERROR_NOT_ESTIMATE-116Not localized
ERROR_IN_DESTINATION-113Already at the destination
ERROR_DESTINATION_CAN_NOT_ARRAIVE-109Destination unreachable
ERROR_MULTI_ROBOT_WAITING_TIMEOUT-125Multi-robot obstacle avoidance wait timed out
ERROR_NAVIGATION_AVOID_TIMEOUT-136Robot obstacle avoidance timed out
ACTION_RESPONSE_ALREADY_RUN-1Request busy
ACTION_RESPONSE_REQUEST_RES_ERROR-6Request failed
ACTION_RESPONSE_RES_UNAVAILBALE-9Request unavailable
ERROR_WHEEL_OVER_CURRENT_RUN_OUT-124

Elevator control sample code