Skip to content
HanselLi edited this page Feb 24, 2022 · 1 revision

导航管理

自检完成后可以通过PuduOS获取导航管理类

val puDuNavigationManager by lazy { PuduOS.getService(PuduOS.NAVIGATION_SERVICE) as NavigationManager }

同步获取定位状态

val locationStatus=puDuNavigationManager .getLocationStatus()

文档背景:

方法 类型 描述
isNormal Boolean 是否正常
isWarning Boolean 是否警告
isError Boolean 是否出错

我们可以通过isNormal判断机器人是否获取定位

获取当前位置信息

val pose=puDuNavigationManager.getCurrentPose()

Pose说明

字段 类型 含义
x Double 位置坐标X
y Double 位置坐标Y
z Double 位置坐标Z

获取定位类型

val locateType=puDuNavigationManager.getLocateType()

locateType说明

常量 含义
DEFAULT 0 默认
MARKER 1 标记
LASER 2 激光
LASER_MARKER 3 融合
SLAM 4 同步定位与建图
 fun getLostLocation(view: View) {
        puDuNavigationManager.setLostLocalization(false, object : ActionListener<String>() {
            override fun onStatusUpdate(status: Int, result: ActionData?) {
                super.onStatusUpdate(status, result)
                val data=result?.any as LocationStatus
                showResult(RESULT_OK, gson.toJson(data))
            }

            override fun onResult(code: Int, result: String?) {
            }
        })

文档背景

Clone this wiki locally