## AMR MQTT (Mutiple Edit) ### TaskCommand 發送導航命令給AMR format: json topic: AMR_API/TaskCommand/AMR_ID type: publish **Sample** ```json= { "msg_type": "batch_task", "msg_id": "w001", "tasks": [ { "sequence": 1, "task_type": 0, "task_id": "nav_room_201", "goal_pose": {"x": 10.0, "y": 5.0, "theta": 0.0}, "control_status": {"1": 1, "2": 0, "3": 0} }, { "sequence": 2, "task_type": 81, "task_id": "open_201", "goal_pose": {"x": 0.0, "y": 0.0, "theta": 0.0}, "control_status": {"1": 1, "2": 0, "3": 0} }, { "sequence": 3, "task_type": 82, "task_id": "uv_201", "goal_pose": {"x": 0.0, "y": 0.0, "theta": 0.0}, "control_status": {"1": 1, "2": 1, "3": 1} } ] } ``` **Attributes Description** task_type:Int,任務類別,0為導航,1為近端定位,6為初始化定位等等 (詳細如附錄) * task_id:String,任務流水號 * goal_pose:Double,AMR導航目標點 * control_status:Int,控制模組(櫃門、紫外光、車燈) ### TaskCommandAck 接收AMR任務回覆事件 format: json topic: AMR_API/TaskCommandAck/AMR_ID type: Subscribe **Sample** ```json= { "msg_id": "i2454", "msg_event": "received", "msg_record": 3, // record sequence number in msg (multi-task) "timestemp": 1705472193001 } ``` ### TaskResponse 接收AMR任務處理事件 format: json topic: AMR_API/TaskResponse/AMR_ID type: Subscribe **Sample** ```json= { "msg_id": "i2454", "msg_event": "done", "msg_record": 3, "timestemp": 1705472193001 } ``` **Attributes Description** * task_id:String,任務流水號 * event:String,任務的處理狀況 * timestemp:Long,此訊息時間戳,unix time (milliseconds) 1. done/navigating/fail (0) 1. initialpose_fail/initialpose_done (6) 1. cancel_task_done (7) 1. velodyne_done/velodyne_fail (93) 1. sick_done/sick_fail (92) 1. charge_done/charge_no_tag (4) 1. uncharge_done/uncharge_no_tag (5) 1. move_done (8)(9)(10) ### Status 接收AMR狀態 format: json topic: AMR_API/Status/AMR_ID type: Subscribe **Sample** ```json= { "position": { "x":15.6, "y":20.5, "theta":3.02 }, "soc": 56.2, "error": 0, "timestemp": 1705472193001, "charge_status": 0, "sensor_status": { “sick_front”:true, “sick_rear”:true, “velodyne”:false, }, "emergency_button": 0, "door_status": { “top”: 1, “middle”: 1, “bottom”: 0, }, "uv_light_status": { “top”: 0, “middle”: 0, “bottom”:1, }, "car_light_status": { “front”: 1, “rear_right”: 1, “rear_left”: 1, }, "tag_detection": 0, "current_task_sequence": 1, "current_task_id": u111, } ``` **Attributes Description** * position:Double,AMR位置 * soc:Int,AMR電量百分比 * error:Int,錯誤訊息代碼,0代表沒錯誤,1代表異常等等 (如遇不同異常,再新增) * 目前 馬達無 error 回傳,因此此欄位無效 * timestemp:Long,此訊息時間戳,unix time (milliseconds) * charge_status:Int,AMR充電開關的狀態,1為開啟,0為關閉 * sensor_status:Bool,sensor開啟狀態,false代表異常,true代表正常開啟 * emergency_button:Int,緊急按鈕狀態,0代表鬆開,1代表按下 * door_status:Int,櫃門開關狀態(磁簧開關),1代表打開,0代表關起 (有上中下三個櫃門) * uv_light_status:Int,紫外線燈開關狀態,1代表打開,0代表關起 (有上中下三組) * car_light_status:Int,車燈開關狀態,1代表打開,0代表關起 (有前面大燈、後面左右方向燈) * tag_detection:Int,是否偵測到 apriltag,1代表偵測到,0代表無偵測到,用於確認是否在正確的位置開啟AMR * current_task_sequence: Int,任務執行順序 (無任務時為 -1) * current_task_id: Int,任務執行ID (無任務時為 -1)