...
try {
// Pre-execution track data display example during a robot task
// The real-time status data reported by the robot is as follows:
let state = {
"x": 5.14,
"y": -18.04,
"yaw": 1.57,
"ori": 90,
"floorId": "69c35c34204c425717de7044",
"businessId": "69c35bd5204c425717de7043",
"buildingId": "66da6f298fded280e731af7a",
"speed": 0,
"battery": 90,
"isCharging": false,
"locQuality": 100,
"isEmergencyStop": false,
"isManualMode": false,
"isRemoteMode": false,
"isGoHome": false,
"hasObstruction": false,
"hasPersonAhead": false,
"dispatch": 0,
"distance": 9.1,
"moveState": "moving",
"serialNum": 8475,
"enableRcs": false,
"robotSignal": "none",
"isInElevator": false,
"hasNet": true,
"runMode": 1,
"detourRadius": 1,
"maxSpeed": 1.2,
"vers": {
"vda5050Ver": "master",
"softVer": "master",
"hwVer": "2.11.0-pi64",
"packageVer": "0.4.19",
"serialVer": null
},
"pid": 6,
"errors": [],
"taskObj": {
"taskId": "tsn-e4897699-0788-4b29-9c55-756c089ef76f",
"taskType": 4,
"runType": 21,
"sourceType": 7,
"hasRunNum": 1,
"taskIndex": 0,
"totalNum": 1,
"isPaused": true,
"isFinish": false,
"isCancel": false,
"isReturn": false,
"isInteraction": false,
"stepIndex": 0,
"actIndex": 3,
"duration": 17,
"mileage": 11.94,
"stepNum": 2,
"totalDis": 21.08,
"remainingDis": 9.34,
"target": {
"name": "19004",
"x": 4.08302732056267,
"y": -8.934853815682445,
"actType": -1
}
},
"disinfect": {
"isDryBurned": false,
"gearType": 0
},
"isTesting": false,
"path": {
"positions": [
[
5.135190987154432,
-18.037787588506887
],
[
5.139223449134561,
-17.09624374098701
],
[
5.145666791689941,
-15.591780817250571
],
[
5.151225130742907,
-14.293958304964507
],
[
5.1578688846336505,
-12.742701124837815
],
[
5.164512638524392,
-11.191443944711121
],
[
5.164747763325516,
-11.136544404185221
],
[
5.171273954815696,
-9.612736994321477
],
[
5.174157191752643,
-8.939526927542872
]
]
}
}
const paths = state.path.positions
console.log('Pre-execution track data', paths)
if (this.tasksTrackID) { // update
this.axMap.trackLine(this.tasksTrackID, paths, {
color: '#f00', // color
width: 2, // width, unit: pixel
dash: 'dash' // dashed line
});
} else { // add
this.tasksTrackID = this.axMap.addLine(paths, {
color: '#f00', // color
width: 2, // width, unit: pixel
dash: 'dash' // dashed line
});
}
} catch (e) {
console.warn('Exception', e)
const errText = e.errText
}
...