Hi @E1cid ,
The following is my flow in which I am trying to track the position of the UAV and also making a track line with it but it does not seems to draw/make a line in the maps ? I want to have multiple coordinates so that the UAV completes a flight path/track, can you see what I am doing wrong here?
Thank you.
[
{
"id": "6a1a72128b6a3842",
"type": "tab",
"label": "User_Interface_SIMULU",
"disabled": false,
"info": "",
"env": []
},
{
"id": "ef044715988c5a66",
"type": "function",
"z": "6a1a72128b6a3842",
"name": "Style Gauge",
"func": "var msg1 = {}; \nvar msg2 = {}; \n\nvar circleColor = msg.indicator_color; \nvar textColor = \"white\"; \n\n\nmsg1.ui_control = \n{ \"gtype\": \"compass\",\n \"options\":{\n \"gaugeColor\": circleColor, \n \"levelColors\": [\"red\",\"blue\",\"yellow\"],\n \"hideValue\": false,\n \"textColor\": textColor,\n \"gaugeHeight\": 1.50,\n \"circleThickness\": 0.08,\n \"height\": 20,\n }\n};\n\nmsg2 = msg;\n\nreturn [msg1, msg2];",
"outputs": 2,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 990,
"y": 160,
"wires": [
[
"bd4e5771559f76c8"
],
[
"bd4e5771559f76c8"
]
]
},
{
"id": "ba70f8b2eb787e10",
"type": "mqtt in",
"z": "6a1a72128b6a3842",
"name": "",
"topic": "gas/uas/0xWINKELBRUNN/gas_cmds/flight_state",
"qos": "0",
"datatype": "auto-detect",
"broker": "a635293a09a88a33",
"nl": false,
"rap": true,
"rh": 0,
"inputs": 0,
"x": 200,
"y": 160,
"wires": [
[
"18be8df23cba51a5",
"f8cbfb25e1061605"
]
]
},
{
"id": "3ac59ca0956a88d0",
"type": "debug",
"z": "6a1a72128b6a3842",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 710,
"y": 320,
"wires": []
},
{
"id": "18be8df23cba51a5",
"type": "function",
"z": "6a1a72128b6a3842",
"name": "Flight_State and Direction Functionality",
"func": "var payload = msg.payload;\nvar topic = msg.topic;\nvar lat = msg.lattitude;\nvar lon = msg.longitude;\nvar name = msg.name;\nmsg.name = 'SIMULU';\n\nvar coordinates = {\n 'x': [51.68, 0],\n 'y': [0, 8.02]\n}\n\nif(topic == \"gas/uas/0xWINKELBRUNN/gas_cmds/flight_state\"){\n msg.navigation = \"flight\";\n msg.indicator_color = payload;\n return msg;\n}\n\nif(topic == \"gas/uas/0xWINKELBRUNN/gas_cmds/guidance/geofence/dir\"){\n msg.navigation = \"flight\";\n msg.indicator_color = \"red\";\n msg.direction = parseFloat(payload).toFixed(2);\n for(var i=0;i<Object.keys(coordinates).length;i++){\n msg.payload = {\n 'name': msg.name +i.toString(),\n 'lat': coordinates.x[i],\n 'lon': coordinates.y[i],\n 'icon': 'fa-plane',\n 'iconColor': 'blue',\n 'layer': 'dir'\n }\n node.send(msg);\n\n }\n return msg; \n \n}\nif(topic != \"gas/uas/0xWINJKELBRUNN/gas_cmds/guidance/geofence/dir\"){\n msg.payload = {\n name : msg.name,\n deleted : true,\n command : {\n clear : 'dir'\n }\n }\n}\n\n\n\n",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 620,
"y": 220,
"wires": [
[
"3ac59ca0956a88d0",
"94f9e96c39bc49e1",
"ef044715988c5a66",
"fe77787841f182b0",
"d91430ed79438eec",
"4270807e778dbf05"
]
]
},
{
"id": "3054da89f1625705",
"type": "mqtt in",
"z": "6a1a72128b6a3842",
"name": "",
"topic": "gas/uas/0xWINKELBRUNN/gas_cmds/guidance/geofence/#",
"qos": "0",
"datatype": "auto-detect",
"broker": "a635293a09a88a33",
"nl": false,
"rap": true,
"rh": 0,
"inputs": 0,
"x": 220,
"y": 280,
"wires": [
[
"7e3d5f575013bbce"
]
]
},
{
"id": "7e3d5f575013bbce",
"type": "switch",
"z": "6a1a72128b6a3842",
"name": "Switch b/w topics",
"property": "topic",
"propertyType": "msg",
"rules": [
{
"t": "eq",
"v": "gas/uas/0xWINKELBRUNN/gas_cmds/guidance/geofence/dir",
"vt": "str"
},
{
"t": "eq",
"v": "gas/uas/0xWINKELBRUNN/gas_cmds/guidance/geofence/distance",
"vt": "str"
},
{
"t": "eq",
"v": "gas/uas/0xWINKELBRUNN/gas_cmds/warning/geofence",
"vt": "str"
}
],
"checkall": "true",
"repair": false,
"outputs": 3,
"x": 350,
"y": 400,
"wires": [
[
"18be8df23cba51a5"
],
[
"6b3fb520ddf64f94"
],
[
"6b3fb520ddf64f94"
]
]
},
{
"id": "6b3fb520ddf64f94",
"type": "function",
"z": "6a1a72128b6a3842",
"name": "Distance and Warning with Audio Functionality",
"func": "var payload = msg.payload;\nlet topic1 = msg.topic;\nlet topic2 = msg.topic;\nvar payloadaudio = msg.payloadaudio;\nvar out;\n\nlet text = \"Increase Altitude\";\n\nflow.set('value', null);\n//if(topic != \"gas/0xWINKELBRUNN/gas_cmds/guidance/geofence/distance\"){\n // msg.height_2 = \"arrow_downward\";\n //msg.height = \"a\";\n //msg.color = \"purple\";\n //return msg;\n//}\n\nif(topic1 == \"gas/uas/0xWINKELBRUNN/gas_cmds/guidance/geofence/distance\"){\n msg.navigation = \"flight\";\n msg.indicator_color = \"red\";\n msg.value = parseFloat(payload).toFixed(2);\n msg.height_1 = \"arrow_upward\";\n msg.height = \"X\";\n msg.color = \"red\";\n out = JSON.stringify(text);\n msg.payloadaudio = out;\n return msg;\n}\n\nif(topic2 == \"gas/uas/0xWINKELBRUNN/gas_cmds/warning/geofence\"){\n var distance = flow.get('value');\n msg.value = distance;\n return msg;\n}\n\n//else{\n // msg.reset = true;\n // return msg;\n//}\n\n\n\n",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 700,
"y": 400,
"wires": [
[
"13277dd1d6135de0",
"c2cc9d2c52c4fbeb",
"bb3a101222697f35",
"df70d532008d85c3",
"b7e541c6cf59bc5b"
]
]
},
{
"id": "b7e541c6cf59bc5b",
"type": "debug",
"z": "6a1a72128b6a3842",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 1050,
"y": 320,
"wires": []
},
{
"id": "0d8cb293d6660787",
"type": "mqtt in",
"z": "6a1a72128b6a3842",
"name": "",
"topic": "gas/uas/0xWINKELBRUNN/gas_cmds/warning/geofence",
"qos": "0",
"datatype": "auto-detect",
"broker": "a635293a09a88a33",
"nl": false,
"rap": true,
"rh": 0,
"inputs": 0,
"x": 210,
"y": 520,
"wires": [
[
"05a6f4081d8bd503",
"ea3f127edfabea20",
"7e3d5f575013bbce"
]
]
},
{
"id": "05a6f4081d8bd503",
"type": "debug",
"z": "6a1a72128b6a3842",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 210,
"y": 620,
"wires": []
},
{
"id": "ea3f127edfabea20",
"type": "function",
"z": "6a1a72128b6a3842",
"name": "Geofence Trigger",
"func": "var payload = msg.payload;\nvar topic = msg.topic;\n\nif(topic == \"gas/uas/0xWINKELBRUNN/gas_cmds/warning/geofence\"){\n msg.geofence = payload;\n}\nif(msg.payload == false){\n msg.reset = true;\n}\nreturn msg;\n\n\n",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 570,
"y": 520,
"wires": [
[
"8866a4cbaf06df87",
"50cac0e3e57c33cc"
]
]
},
{
"id": "df70d532008d85c3",
"type": "change",
"z": "6a1a72128b6a3842",
"name": "Set to payloadaudio",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "payloadaudio",
"tot": "msg"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 840,
"y": 500,
"wires": [
[
"50cac0e3e57c33cc"
]
]
},
{
"id": "f8cbfb25e1061605",
"type": "function",
"z": "6a1a72128b6a3842",
"name": "function 1",
"func": "let payload = msg.payload;\nlet topic = msg.topic;\nlet out;\nlet payloadauido = msg.payloadaudio;\nlet text = \"Stable\";\nmsg.topic = \"gas/uas/0xWINKELBRUNN/gas_cmds/flight_state\";\n\nif(msg.payload == \"yellow\"){\n out = JSON.stringify(text);\n msg.payloadaudio = out;\n return msg;\n}\nif(msg.payload == \"green\"){\n msg.reset = true;\n return msg;\n}",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 440,
"y": 120,
"wires": [
[
"e799758c82d482c3"
]
]
},
{
"id": "e799758c82d482c3",
"type": "change",
"z": "6a1a72128b6a3842",
"name": "",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "payloadaudio",
"tot": "msg"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 600,
"y": 120,
"wires": [
[
"466927c18ab520d8"
]
]
},
{
"id": "91982b09e6f2dce3",
"type": "worldmap",
"z": "6a1a72128b6a3842",
"name": "",
"lat": "2.9",
"lon": "6.8",
"zoom": "4",
"layer": "OSMC",
"cluster": "4",
"maxage": "1",
"usermenu": "show",
"layers": "show",
"panit": "true",
"panlock": "false",
"zoomlock": "false",
"hiderightclick": "false",
"coords": "deg",
"showgrid": "false",
"allowFileDrop": "false",
"path": "/worldmap",
"overlist": "DR,CO,RA,DN,AC,TL,HM",
"maplist": "OSMG,OSMC,EsriC,EsriS,EsriT,EsriDG,UKOS",
"mapname": "",
"mapurl": "",
"mapopt": "",
"mapwms": false,
"x": 1220,
"y": 80,
"wires": []
},
{
"id": "d91430ed79438eec",
"type": "worldmap-tracks",
"z": "6a1a72128b6a3842",
"name": "",
"depth": "10",
"layer": "single",
"smooth": true,
"x": 930,
"y": 80,
"wires": [
[
"91982b09e6f2dce3"
]
]
},
{
"id": "bb3a101222697f35",
"type": "ui_text",
"z": "6a1a72128b6a3842",
"group": "1b60bd173cfedbb2",
"order": 8,
"width": 0,
"height": 0,
"name": "Display Message",
"label": "",
"format": "{{msg.payloadaudio}} ",
"layout": "row-center",
"className": "",
"x": 1130,
"y": 500,
"wires": []
},
{
"id": "bd4e5771559f76c8",
"type": "ui_gauge",
"z": "6a1a72128b6a3842",
"name": "",
"group": "1b60bd173cfedbb2",
"order": 7,
"width": 6,
"height": 4,
"gtype": "compass",
"title": "Navigation",
"label": "Degrees",
"format": "{{msg.direction}}",
"min": 0,
"max": "10",
"colors": [
"#00b500",
"#e6e600",
"#ca3838"
],
"seg1": "",
"seg2": "",
"className": "",
"x": 1190,
"y": 160,
"wires": []
},
{
"id": "50cac0e3e57c33cc",
"type": "ui_audio",
"z": "6a1a72128b6a3842",
"d": true,
"name": "Audio on Dashboard",
"group": "1b60bd173cfedbb2",
"voice": "Google US English",
"always": true,
"x": 1140,
"y": 540,
"wires": []
},
{
"id": "466927c18ab520d8",
"type": "ui_audio",
"z": "6a1a72128b6a3842",
"d": true,
"name": "",
"group": "1b60bd173cfedbb2",
"voice": "Google US English",
"always": "",
"x": 680,
"y": 160,
"wires": []
},
{
"id": "94f9e96c39bc49e1",
"type": "ui_template",
"z": "6a1a72128b6a3842",
"group": "1b60bd173cfedbb2",
"name": "Flight_Status",
"order": 2,
"width": 7,
"height": 4,
"format": "<style>\n\n #flight_status {\n background:{{msg.indicator_color}};\n font-size: 72px;\n \n border-radius: 50%;\n text-align:right;\n \n transition-duration: 8s;\n transition-property: transform;\n transform: rotate({{msg.direction}}deg);\n }\n \n .navigation{\n display:flex;\n position:absolute;\n \n }\n .navigation_status{\n margin-left:25px;\n padding-top:10px;\n padding-left:40px;\n \n }\n \n .flight_status{\n margin-left:40px;\n padding-top:20px;\n \n }\n \n @media screen (min-width:480px) and (orientation:landscape){\n width: 480px;\n height: 320px;\n \n }\n @keyframes blinker{\n 50%{\n opacity:0;\n }\n 100%{\n opacity:1;\n }\n }\n @keyframes downwards{\n 0%{\n opacity:0;\n }\n 50%{\n opacity:1; visibility:hidden;\n }\n 100%{\n opacity:0; \n }\n }\n \n</style>\n\n<div class=\"navigation\">\n <div class=\"flight_status\">\n <table class= \"navigation_status\">\n <tr>\n <td><h3>Flight_Status:</h3></td>\n <td><i class=\"material-icons\" id=\"flight_status\">{{msg.navigation}}</i></td>\n </tr>\n \n </table>\n \n </div>\n\n</div>\n\n \n<script>\n //Create Label\n //const label = document.createElement(\"label\");\n //label.set attribute(\"for\", \"distance\");\n //label.innerHTML = \"Distance: \"\n \n //insert label\n //document.appendChild(label);\n\n //create input\n //const input = document.createElement(\"input\");\n //input.setAttribute(\"id\",\"distance\");\n //document.body.appendChild(input); //insert input\n \n //const distanceText = document.getElementbyId(\"distance\");\n // distanceText.setAttribute(\"placeholder\", \"Distance in meters\");\n \n //const value = distanceText.value;\n //console.log({{msg.value}});\n\n</script>\n\n\n",
"storeOutMessages": false,
"fwdInMessages": true,
"resendOnRefresh": true,
"templateScope": "local",
"className": "",
"x": 990,
"y": 200,
"wires": [
[]
]
},
{
"id": "13277dd1d6135de0",
"type": "ui_template",
"z": "6a1a72128b6a3842",
"group": "1b60bd173cfedbb2",
"name": "Geofence/Distance",
"order": 3,
"width": 5,
"height": 2,
"format": "<style>\n\n .distance{\n margin-left:30px;\n float:right;\n padding-top:25px;\n display:flex;\n position:absolute;\n \n \n }\n .distance_status{\n padding-left:30px;\n }\n \n</style>\n\n\n\n<div class=\"distance\">\n <table class=\"distance_status\">\n <tr>\n <td><h4>Distance to Exit: {{msg.value}} meters</h4></td>\n </tr>\n \n </table>\n \n</div>\n",
"storeOutMessages": false,
"fwdInMessages": true,
"resendOnRefresh": true,
"templateScope": "local",
"className": "",
"x": 1150,
"y": 380,
"wires": [
[]
]
},
{
"id": "fe77787841f182b0",
"type": "ui_template",
"z": "6a1a72128b6a3842",
"group": "1b60bd173cfedbb2",
"name": "Geofence/Direction",
"order": 4,
"width": 5,
"height": 2,
"format": "<style>\n\n .direction{\n margin-left:30px;\n float:right;\n position:static;\n display:flex;\n padding-top:10px;\n }\n \n .direction_status{\n padding-left:30px;\n height:10px;\n }\n\n</style>\n\n<div class=\"direction\">\n <table class=\"direction_status\">\n <tr>\n <td><h4>Drone Direction: {{msg.direction}} Degrees</h4></td>\n </tr>\n \n </table>\n \n</div>\n \n",
"storeOutMessages": false,
"fwdInMessages": true,
"resendOnRefresh": true,
"templateScope": "local",
"className": "",
"x": 990,
"y": 240,
"wires": [
[]
]
},
{
"id": "8866a4cbaf06df87",
"type": "ui_template",
"z": "6a1a72128b6a3842",
"group": "1b60bd173cfedbb2",
"name": "Warning/Geofence",
"order": 5,
"width": 6,
"height": 1,
"format": "<style>\n .geofence{\n display:inline-block;\n }\n .geofence_status{\n margin-left:50px;\n padding-left:20px;\n \n }\n</style>\n\n\n\n<div class= \"geofence\">\n <table class = \"geofence_status\">\n <tr>\n <td><h4>Entering Geofence: {{msg.geofence}}</h4></td>\n </tr>\n \n </table>\n \n</div>",
"storeOutMessages": false,
"fwdInMessages": true,
"resendOnRefresh": true,
"templateScope": "local",
"className": "",
"x": 870,
"y": 600,
"wires": [
[]
]
},
{
"id": "c2cc9d2c52c4fbeb",
"type": "ui_template",
"z": "6a1a72128b6a3842",
"group": "1b60bd173cfedbb2",
"name": "Height_Status",
"order": 1,
"width": 3,
"height": 4,
"format": "<style>\n #height_upwards{\n font-size:72px;\n text-align:center;\n vertical-align:middle;\n border-radius:50%;\n background:{{msg.color}};\n animation: blinker 1s linear infinite;\n }\n #height_downwards{\n font-size:72px;\n text-align:center;\n vertical-align:middle;\n border-radius:50%;\n background:{{msg.color}};\n animation: downwards 1s alternate infinite;\n /*visibility:hidden;*/\n }\n #text{\n position:relative;\n text-align:center;\n padding-top:1px;\n }\n #height_downwards{\n position:relative;\n top:30px;\n \n }\n .height{\n display:flex;\n margin-left:20px;\n width:50%;\n \n }\n \n</style>\n\n<div class=\"height\">\n <table class=\"height_status\">\n <tr>\n <td><h3>Height:</h3></td>\n </tr>\n <tr>\n <td><i class=\"material-icons\" id=\"height_upwards\">{{msg.height_1}}</i></td>\n </tr>\n <tr>\n <td id= \"text\"><h4>{{msg.height}} meters</h4></td>\n </tr>\n <tr>\n <td><i class=\"material-icons\" id=\"height_downwards\">{{msg.height_2}}</i></td>\n </tr>\n \n </table>\n \n</div>",
"storeOutMessages": true,
"fwdInMessages": true,
"resendOnRefresh": true,
"templateScope": "local",
"className": "",
"x": 1180,
"y": 440,
"wires": [
[]
]
},
{
"id": "4270807e778dbf05",
"type": "ui_worldmap",
"z": "6a1a72128b6a3842",
"group": "1b60bd173cfedbb2",
"order": 6,
"width": 9,
"height": 5,
"name": "",
"lat": "2.9",
"lon": "6.8",
"zoom": "4",
"layer": "OSMG",
"cluster": "4",
"maxage": "1",
"usermenu": "hide",
"layers": "hide",
"panit": "true",
"panlock": "false",
"zoomlock": "false",
"hiderightclick": "true",
"coords": "deg",
"showgrid": "false",
"allowFileDrop": "false",
"path": "/worldmap",
"overlist": "DR,CO,RA,DN,HM",
"maplist": "OSMG,OSMC,EsriC,EsriS,EsriT,EsriDG,UKOS",
"mapname": "",
"mapurl": "",
"mapopt": "",
"mapwms": false,
"x": 840,
"y": 40,
"wires": []
},
{
"id": "a635293a09a88a33",
"type": "mqtt-broker",
"name": "SIMULU - Standard pub/sub",
"broker": "wss://mqtt.simulu.app",
"port": "443",
"tls": "ca1efa415c070b56",
"clientid": "",
"autoConnect": true,
"usetls": true,
"protocolVersion": "4",
"keepalive": "60",
"cleansession": true,
"birthTopic": "",
"birthQos": "0",
"birthPayload": "",
"birthMsg": {},
"closeTopic": "",
"closeQos": "0",
"closePayload": "",
"closeMsg": {},
"willTopic": "",
"willQos": "0",
"willPayload": "",
"willMsg": {},
"userProps": "",
"sessionExpiry": ""
},
{
"id": "1b60bd173cfedbb2",
"type": "ui_group",
"name": "User_Interface",
"tab": "a50c557d2ff0efa6",
"order": 1,
"disp": true,
"width": 15,
"collapse": false,
"className": ""
},
{
"id": "ca1efa415c070b56",
"type": "tls-config",
"name": "",
"cert": "",
"key": "",
"ca": "",
"certname": "",
"keyname": "",
"caname": "",
"servername": "",
"verifyservercert": true,
"alpnprotocol": ""
},
{
"id": "a50c557d2ff0efa6",
"type": "ui_tab",
"name": "SIMULU",
"icon": "dashboard",
"disabled": false,
"hidden": false
}
]