提交
This commit is contained in:
commit
bad7606d27
1
flows-generic协议(43DAAD).json
Normal file
1
flows-generic协议(43DAAD).json
Normal file
@ -0,0 +1 @@
|
|||||||
|
[{"id":"fca2f5f.cdf3008","type":"tab","label":"generic协议","disabled":false,"info":""},{"id":"203ee85.484e918","type":"udp in","z":"fca2f5f.cdf3008","name":"","iface":"","port":"5597","ipv":"udp4","multicast":"false","group":"","datatype":"buffer","x":200,"y":200,"wires":[["13dcad67.7cbf03"]]},{"id":"13dcad67.7cbf03","type":"function","z":"fca2f5f.cdf3008","name":"","func":"var mess = String.fromCharCode.apply(null, new Uint8Array(msg.payload));\n//msg.payload = mess;\n\nvar obj = mess.replace(/\\n/g,\",\").replace(/\\t/g,\",\").replace(\" \",\"\").replace(\" \",\"\").replace(\" \",\"\") ;\nmsg.obj = obj;\n\nvar arr = obj.split(',');\nvar length = arr.length;\n\nvar myDate = new Date(); //实例一个时间对象;\nvar hours = ((Array(2).join(0)+myDate.getHours() ).slice(-2)) ;\nvar minutes = ((Array(2).join(0)+myDate.getMinutes()).slice(-2)) ;\nvar seconds = ((Array(2).join(0)+myDate.getSeconds()).slice(-2)) ;\nvar time = hours + \"\" + minutes + \"\" + seconds ; // 时分秒 hhmmss\n\n//日期:年/月/日\nvar day = ((Array(2).join(0)+myDate.getDate() ).slice(-2)) ;\nvar month = ((Array(2).join(0)+(myDate.getMonth()+1)).slice(-2)) ;\nvar year = myDate.getFullYear().toString().substr(2, 2) ;\nvar date = day + \"\" + month + \"\" + year; // 日月年 ddmmyy\n\nfor(var i=0;i<length;i++)\n{\n var tmp = arr[i].split('=');\n var key = tmp[0];\n var val = tmp[1];\n \n switch(key)\n {\n case \"lng\":\n lng = val;\n break;\n case \"lat\":\n lat = val;\n break;\n case \"heading\":\n heading = val; //航向(0~360)\n break;\n case \"airspeed\":\n airspeed = val;\n break;\n case \"GS\":\n GS = parseInt(val * 0.514); //1节相当于 0.514 米/秒\n break;\n case \"A\":\n A = parseInt(val * 0.3048); //海拔高度(单位:米)\n break;\n case \"AGL\":\n AGL = parseInt(val * 0.3048); //离地高度(单位:米)\n break; \n default:\n break;\n }\n}\n\n//创建对象\nvar json = {\n\t\"bh\":\"43DAAD\", //无人机编号、\n\t\"lng\":lng, //经度\n\t\"lat\":lat, //纬度\n\t\"hdg\":heading, //航向(0~360)\n\t\"vf\":GS, //速度(单位:米/秒)\n\t\"ta\":AGL, //离地高度(单位:米)\n\t\"tla\":A, //海拔高度(单位:米)\n\t\"sc\":15, //卫星数\n\t\"cri\":50, //电池剩余电量百分比(电池剩余电量的百分比,范围为 [0, 100])\n\t\"fly\":true, //飞行状态(true-正在飞行\n\t\"time\":time, //时分秒hhmmss\n\t\"day\":date, //日月年ddmmyy\n\t\"www\":\"\", //skylines域名\n\t\"port\":0, //skylines端口\n\t\"key\":\"\" //skylines密钥\n}\n\nmsg.payload = json;\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":380,"y":200,"wires":[["4cf3ecc6.8a6a04","3dc4f858.f9a1a8"]]},{"id":"3dc4f858.f9a1a8","type":"mqtt out","z":"fca2f5f.cdf3008","name":"","topic":"/xxh/dji/43DAAD","qos":"2","retain":"","respTopic":"","contentType":"","userProps":"","correl":"","expiry":"","broker":"609ccc10.80f084","x":580,"y":200,"wires":[]},{"id":"4cf3ecc6.8a6a04","type":"debug","z":"fca2f5f.cdf3008","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":550,"y":140,"wires":[]},{"id":"609ccc10.80f084","type":"mqtt-broker","name":"mqtt.xinxinghang.cn","broker":"mqtt.xinxinghang.cn","port":"1883","clientid":"","usetls":false,"protocolVersion":"4","keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","birthMsg":{},"closeTopic":"","closeQos":"0","closePayload":"","closeMsg":{},"willTopic":"","willQos":"0","willPayload":"","willMsg":{},"sessionExpiry":""}]
|
84
output.xml
Normal file
84
output.xml
Normal file
@ -0,0 +1,84 @@
|
|||||||
|
<?xml version="1.0"?>
|
||||||
|
<PropertyList>
|
||||||
|
<generic>
|
||||||
|
<output>
|
||||||
|
<line_separator>newline</line_separator>
|
||||||
|
<var_separator>newline</var_separator>
|
||||||
|
<binary_mode>false</binary_mode>
|
||||||
|
|
||||||
|
<chunk>
|
||||||
|
<name>time (秒)</name>
|
||||||
|
<type>float</type>
|
||||||
|
<format>time=%.4f</format>
|
||||||
|
<node>/sim/time/elapsed-sec</node>
|
||||||
|
</chunk>
|
||||||
|
|
||||||
|
<!-- Position -->
|
||||||
|
|
||||||
|
<chunk>
|
||||||
|
<name>longitude(经度)</name>
|
||||||
|
<node>/position/longitude-deg</node>
|
||||||
|
<type>float</type>
|
||||||
|
<format>lng=%03.7f</format>
|
||||||
|
</chunk>
|
||||||
|
|
||||||
|
<chunk>
|
||||||
|
<name>Latitude(纬度)</name>
|
||||||
|
<node>/position/latitude-deg</node>
|
||||||
|
<type>float</type>
|
||||||
|
<format>lat=%03.7f</format>
|
||||||
|
</chunk>
|
||||||
|
|
||||||
|
<chunk>
|
||||||
|
<name>Heading (航向)</name>
|
||||||
|
<type>float</type>
|
||||||
|
<format>heading=%.1f</format>
|
||||||
|
<node>/orientation/heading-deg</node>
|
||||||
|
</chunk>
|
||||||
|
|
||||||
|
<chunk>
|
||||||
|
<name>MACH Number(马赫数)</name>
|
||||||
|
<format>M=%4.1f</format>
|
||||||
|
<type>float</type>
|
||||||
|
<node>/velocities/mach</node>
|
||||||
|
</chunk>
|
||||||
|
|
||||||
|
<chunk>
|
||||||
|
<name>speed(空速)</name>
|
||||||
|
<format>airspeed=%d</format>
|
||||||
|
<node>/velocities/airspeed-kt</node>
|
||||||
|
</chunk>
|
||||||
|
|
||||||
|
<chunk>
|
||||||
|
<name>Ground Speed(地面速度:kts)</name>
|
||||||
|
<format>GS=%3d</format>
|
||||||
|
<node>/instrumentation/gps/indicated-ground-speed-kt</node>
|
||||||
|
</chunk>
|
||||||
|
|
||||||
|
<chunk>
|
||||||
|
<name>G Load(G负载)</name>
|
||||||
|
<format>G=%2.1f</format>
|
||||||
|
<type>float</type>
|
||||||
|
<node>/accelerations/pilot/z-accel-fps_sec</node>
|
||||||
|
<factor>-0.03108095</factor>
|
||||||
|
<damp>1.0</damp>
|
||||||
|
</chunk>
|
||||||
|
|
||||||
|
<chunk>
|
||||||
|
<name>altitude(海拔-英尺)</name>
|
||||||
|
<format>A=%02d</format>
|
||||||
|
<node>/position/altitude-ft</node>
|
||||||
|
</chunk>
|
||||||
|
|
||||||
|
<chunk>
|
||||||
|
<name>AGL(离地高度)</name>
|
||||||
|
<format>AGL=%4.0f</format>
|
||||||
|
<type>float</type>
|
||||||
|
<node>/position/altitude-agl-ft</node>
|
||||||
|
</chunk>
|
||||||
|
|
||||||
|
</output>
|
||||||
|
|
||||||
|
</generic>
|
||||||
|
|
||||||
|
</PropertyList>
|
Loading…
Reference in New Issue
Block a user