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

地图与位置信息

机器人是否已定位

方法名称: isRobotEstimate

调用示例:

RobotApi.isRobotEstimate().then((result) => {
    //TODO: 命令执行结果处理
});

参数说明: 无

最低版本: 1.0.0

适用平台:

豹小秘mini招财豹豹小递max豹小秘DP

获取机器人当前坐标点

方法名称: getPosition

调用示例:

RobotApi.getPosition().then((result) => {
    //TODO: 命令执行结果处理
});

参数说明: 无

最低版本: 1.0.0

适用平台:

豹小秘mini招财豹豹小递max豹小秘DP

获取当前地图名称

方法名称: getMapName

调用示例:

let listener = new CommandListener();
listener.addListener(CommandListener.EVENT_RESULT,
    (result: number, message: string) => {
        //TODO: 命令执行结果
        //删除listener
        listener.removeListener();
    });
RobotApi.getMapName(listener.getId());

参数说明:

  • callbackId:回调id

最低版本: 1.0.0

适用平台:

豹小秘mini招财豹豹小递max豹小秘DP

根据位置点名称获取详细坐标

方法名称: getPlace

调用示例:

let listener = new CommandListener();
listener.addListener(CommandListener.EVENT_RESULT,
    (result: number, message: string) => {
        //TODO: 命令执行结果
        //删除listener
        listener.removeListener();
    });
RobotApi.getPlace(listener.getId(), placeName);

参数说明:

  • callbackId:回调id
  • placeName:位置点名称

最低版本: 1.0.0

适用平台:

豹小秘mini招财豹豹小递max豹小秘DP

获取当前地图所有位置点

方法名称: getPlaceList

调用示例:

RobotApi.getPlaceList().then((result) => {
    //TODO: 命令执行结果处理
});

参数说明: 无

最低版本: 1.0.0

适用平台:

豹小秘mini招财豹豹小递max豹小秘DP

获取当前地图所有位置点名称

方法名称: getPlaceListWithName

调用示例:

let listener = new CommandListener();
listener.addListener(CommandListener.EVENT_RESULT,
    (result: number, message: string) => {
        //TODO: 命令执行结果处理
        //删除listener
        listener.removeListener();
    });
RobotApi.getPlaceListWithName(listener.getId());

参数说明:

  • callbackId:回调id

最低版本: 1.0.0

适用平台:

豹小秘mini招财豹豹小递max豹小秘DP

判断位置点是否存在

方法名称: havePlace

调用示例:

let locationEstimateUtil = new LocationEstimateUtil();
locationEstimateUtil.havePlace(placeName).then((result) => {
    //TODO: true 存在,false 不存在
});

参数说明:

  • placeName:位置点名称

最低版本: 1.0.0

适用平台:

豹小秘mini招财豹豹小递max豹小秘DP

判断机器人是否在位置点

方法名称: isInPlace

调用示例:

let locationEstimateUtil = new LocationEstimateUtil();
locationEstimateUtil.isInPlace(placeName, range).then((result) => {
    //TODO: true 在位置点,false 不在位置点
});

参数说明:

  • placeName:位置点名称
  • range:位置点范围(类型:number,单位:米),机器人坐标点在位置点指定范围内均返回true

最低版本: 1.0.0

适用平台:

豹小秘mini招财豹豹小递max豹小秘DP

机器人归正到某个点的建图方向

方法名称: resumeSpecialPlaceTheta

调用示例:

let listener = new CommandListener();
listener.addListener(CommandListener.EVENT_RESULT,
    (result: number, message: string) => {
        //TODO: 命令执行结果
        //删除listener
        listener.removeListener();
    });
RobotApi.resumeSpecialPlaceTheta(listener.getId(), placeName);

参数说明:

  • placeName:位置点名称。建图时候,每个地点都有一个方向,如果想要让机器人朝向某个点的建图方向,调用该接口;该接口只会旋转机器人,不会有空间的移动。

最低版本: 1.0.0

切换地图

方法名称:switchMap

调用示例:

let action = new CommandListener();
action.addListener(CommandListener.EVENT_RESULT, (msg: any) => {
    console.log(TAG, 'switchMap : ' + JSON.stringify(msg));
    if (msg && msg.result && msg.result === 1) {
        let message = msg.message;
        if (message == 'succeed') {
            console.log(TAG, 'switchMap succeed');
            this.relocation()
        } else {
            console.log(TAG, 'switchMap failed');
        }
    } else {
        console.log(TAG, 'switchMap failed');
    }
    action.removeListener()
});
RobotApi.switchMap(action.getId(), mapName);

参数说明:

  • napName:需要切换的地图名称。

最低版本: 1.0.0

适用平台:

豹小秘mini招财豹豹小递max豹小秘DP

定位

方法名称:setFixedEstimate

调用示例:

let estimatePose = {
    px: params.px,//机器人当前位置x
    py: params.py,//机器人当前位置y
    theta: params.theta,//机器人当前朝向
};
console.log(TAG, 'estimatePose params: ' + JSON.stringify(estimatePose));
let action = new CommandListener();
action.addListener(CommandListener.EVENT_RESULT, (msg: any) => {
    console.log(TAG, 'relocation : ' + JSON.stringify(msg));
    if (msg && msg.result && msg.result === 1) {
        let message = msg.message;
        if (message == 'succeed') {
            console.log(TAG, 'relocation succeed');
        } else {
            console.log(TAG, 'relocation failed');
        }
    } else {
        console.log(TAG, 'relocation failed');
    }
});
RobotApi.setFixedEstimate(action.getId(), JSON.stringify(estimatePose));

参数说明:

  • estimatePose:机器人位置信息

最低版本: 1.0.0

适用平台:

豹小秘mini招财豹豹小递max豹小秘DP

这篇文章是否有帮助?

0