This repository has been archived by the owner on Feb 23, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
/
flows_ardumower.json
1 lines (1 loc) · 60.6 KB
/
flows_ardumower.json
1
[{"id":"dc281da1.88d63","type":"tab","label":"Configuration","disabled":false,"info":""},{"id":"996353eb.92f4e","type":"tab","label":"Ardumower Control Center","disabled":false,"info":""},{"id":"cf477024.84de6","type":"tab","label":"Manual contol","disabled":false,"info":""},{"id":"78cfa82b.f54128","type":"tab","label":"System","disabled":false,"info":""},{"id":"f65812f2.ecbd5","type":"tab","label":"Geography","disabled":false,"info":""},{"id":"3d47517a.c4096e","type":"subflow","name":"Control","info":"Use to Control Ardumower Menu","in":[],"out":[]},{"id":"2f965912.a3f236","type":"ui_base","theme":{"name":"theme-dark","lightTheme":{"default":"#0094CE","baseColor":"#0094CE","baseFont":"Arial,Arial,Helvetica,sans-serif","edited":true,"reset":false},"darkTheme":{"default":"#097479","baseColor":"#097479","baseFont":"-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif","edited":true,"reset":false},"customTheme":{"name":"","default":"#4B7930","baseColor":"#4B7930","baseFont":"-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif"},"themeState":{"base-color":{"default":"#097479","value":"#097479","edited":false},"page-titlebar-backgroundColor":{"value":"#097479","edited":false},"page-backgroundColor":{"value":"#111111","edited":false},"page-sidebar-backgroundColor":{"value":"#000000","edited":false},"group-textColor":{"value":"#0eb8c0","edited":false},"group-borderColor":{"value":"#555555","edited":false},"group-backgroundColor":{"value":"#333333","edited":false},"widget-textColor":{"value":"#eeeeee","edited":false},"widget-backgroundColor":{"value":"#097479","edited":false},"widget-borderColor":{"value":"#333333","edited":false},"base-font":{"value":"-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif"}}},"site":{"name":"Node-RED Dashboard","hideToolbar":"false","allowSwipe":"true","dateFormat":"DD/MM/YYYY","sizes":{"sx":48,"sy":48,"gx":6,"gy":6,"cx":6,"cy":6,"px":0,"py":0}}},{"id":"9550e4e.ea6f618","type":"ui_group","z":"","name":"Control","tab":"9df9427b.dc6ef","order":1,"disp":true,"width":"6","collapse":false},{"id":"9df9427b.dc6ef","type":"ui_tab","z":"","name":"Home","icon":"dashboard","order":1},{"id":"f4409ac2.4ad268","type":"serial-port","z":"","serialport":"/dev/ttyACM0","serialbaud":"19200","databits":"8","parity":"none","stopbits":"1","newline":"\\n","bin":"false","out":"char","addchar":true},{"id":"cb435d16.e15d2","type":"ui_group","z":"","name":"Control","tab":"ec29f028.0ad65","disp":true,"width":"18"},{"id":"ec29f028.0ad65","type":"ui_tab","z":"","name":"Serial Monitor","icon":"dashboard","order":2},{"id":"dd71f26e.56c44","type":"ui_group","z":"","name":"Power","tab":"9df9427b.dc6ef","order":2,"disp":true,"width":"6"},{"id":"52892a0c.d9c5b4","type":"ui_group","z":"","name":"Camera","tab":"56c2703a.7a819","order":2,"disp":true,"width":"6","collapse":false},{"id":"56c2703a.7a819","type":"ui_tab","z":"","name":"Manual","icon":"dashboard","order":3},{"id":"ffae3285.5c638","type":"ui_group","z":"","name":"Motor","tab":"9df9427b.dc6ef","disp":true,"width":"6","collapse":false},{"id":"19968ed7.1cab91","type":"ui_group","z":"","name":"Bumper","tab":"9df9427b.dc6ef","disp":true,"width":"6","collapse":false},{"id":"3d8fdd23.305b72","type":"ui_group","z":"","name":"Sonar","tab":"9df9427b.dc6ef","disp":true,"width":"6","collapse":false},{"id":"bb711151.ed35a","type":"ui_group","z":"","name":"Odometry","tab":"9df9427b.dc6ef","disp":true,"width":"6","collapse":false},{"id":"e25f4c45.811f8","type":"ui_group","z":"","name":"GPS","tab":"9df9427b.dc6ef","disp":true,"width":"6","collapse":false},{"id":"d4eb4969.ba0838","type":"ui_group","z":"","name":"Perimeter","tab":"9df9427b.dc6ef","disp":true,"width":"6","collapse":false},{"id":"59e86f00.609b7","type":"ui_tab","z":"","name":"System","icon":"dashboard","order":5},{"id":"f9e60e97.c27ac","type":"ui_group","z":"","name":"Raspberry PI","tab":"59e86f00.609b7","order":1,"disp":true,"width":"6","collapse":false},{"id":"34f9e30.16f7d1e","type":"ui_group","z":"","name":"Drop","tab":"9df9427b.dc6ef","disp":true,"width":"6","collapse":false},{"id":"87dadfbb.9312d","type":"ui_group","z":"","name":"IMU","tab":"9df9427b.dc6ef","disp":true,"width":"6","collapse":false},{"id":"37de859f.4586aa","type":"ui_group","z":"","name":"Event configuration","tab":"59e86f00.609b7","order":3,"disp":true,"width":"6","collapse":true},{"id":"20c5bc1a.cb6ce4","type":"ui_group","z":"","name":"State","tab":"56c2703a.7a819","order":1,"disp":true,"width":"6","collapse":true},{"id":"d365c8e8.c714f8","type":"ui_group","z":"","name":"Joystick","tab":"56c2703a.7a819","order":3,"disp":true,"width":"6","collapse":true},{"id":"ab9f2e67.77b02","type":"ui_group","z":"","name":"Node-RED","tab":"59e86f00.609b7","order":2,"disp":true,"width":"6","collapse":false},{"id":"d9c6f8bf.f72878","type":"ui_tab","z":"","name":"Geography","icon":"dashboard","order":4},{"id":"f594fe6b.96793","type":"ui_group","z":"","name":"Map","tab":"d9c6f8bf.f72878","disp":false,"width":"10","collapse":false},{"id":"28837999.cb9716","type":"ui_group","z":"","name":"Camera","tab":"d9c6f8bf.f72878","disp":true,"width":"6","collapse":false},{"id":"72301ec0.49b6d","type":"ui_group","z":"","name":"Compass","tab":"d9c6f8bf.f72878","disp":true,"width":"6","collapse":false},{"id":"2017e821.b85c88","type":"serial in","z":"996353eb.92f4e","name":"ArdumowerSerial","serial":"f4409ac2.4ad268","x":85,"y":96,"wires":[["718ffb6e.a54834","d19213f5.6460d","70883272.49a5dc","444c34b2.6f14cc","b2e0364f.02ba18","922205c8.c0aea8","1060363a.2509aa","8e98ac80.085cd","63382853.ff5e38","878a331.f64f8d","4bb5bacf.0e9014","ecf0cb8b.e1e438"]]},{"id":"718ffb6e.a54834","type":"function","z":"996353eb.92f4e","name":"RMSTA","func":"var rmstabegin = msg.payload.toString().search(\"\\\\$RMSTA\");\n\nif (rmstabegin == -1){\n \n}\nelse{\n \n var output = msg.payload.split(\",\");\n\nstate = {payload:(output[2])};\nerrorCode = {payload:(output[3])};\npower = {payload:parseFloat(output[4])};;\npower.batVolt = {payload:parseFloat(output[4])};\npower.chgVolt = {payload:parseFloat(output[5])};\nchgCurrent = {payload:parseFloat(output[6])};\n\nreturn [state, errorCode, power, chgCurrent];\n\n\n}\n","outputs":4,"noerr":0,"x":353.70001220703125,"y":270.20001220703125,"wires":[["ec14c35f.01e31"],["d5a3c2ee.619a5"],["9285118a.8ffbf"],["755112b2.89e63c"]]},{"id":"d19213f5.6460d","type":"debug","z":"996353eb.92f4e","name":"","active":false,"console":"false","complete":"false","x":388.7000160217285,"y":46.00000858306885,"wires":[]},{"id":"70883272.49a5dc","type":"join","z":"996353eb.92f4e","name":"","mode":"custom","build":"string","property":"payload","propertyType":"msg","key":"topic","joiner":"<br>","joinerType":"str","accumulate":false,"timeout":"","count":"2","x":408,"y":83,"wires":[["eda52a73.780d48"]]},{"id":"9645e483.40ba28","type":"ui_template","z":"996353eb.92f4e","group":"cb435d16.e15d2","name":"","order":0,"width":"15","height":"6","format":"<div id=\"console\" ng-bind-html=\"msg.payload\" style=\"font-size:10px;\"></div>\n \n","storeOutMessages":true,"fwdInMessages":true,"templateScope":"local","x":760,"y":80,"wires":[["70883272.49a5dc"]]},{"id":"eda52a73.780d48","type":"function","z":"996353eb.92f4e","name":"TrimConsole","func":"var length = msg.payload.toString().length;\nvar keeplength = 5000;\n\nif (length > keeplength ){\n var begin = length - keeplength;\n \n msg.payload = msg.payload.toString().substring(begin);\n}\nreturn msg;","outputs":1,"noerr":0,"x":602,"y":115,"wires":[["9645e483.40ba28"]]},{"id":"ec14c35f.01e31","type":"ui_text","z":"996353eb.92f4e","group":"9550e4e.ea6f618","order":0,"width":0,"height":0,"name":"","label":"State","format":"{{msg.payload}}","layout":"row-spread","x":566,"y":177,"wires":[]},{"id":"d5a3c2ee.619a5","type":"ui_text","z":"996353eb.92f4e","group":"9550e4e.ea6f618","order":0,"width":0,"height":0,"name":"","label":"Error Code","format":"{{msg.payload}}","layout":"row-spread","x":585,"y":217,"wires":[]},{"id":"444c34b2.6f14cc","type":"function","z":"996353eb.92f4e","name":"RMMOT","func":"var rmmotbegin = msg.payload.toString().search(\"\\\\$RMMOT\");\n\nif (rmmotbegin == -1){\n \n}\nelse{\n \n var output = msg.payload.split(\",\");\n\nleftSense = {payload:(output[2])};\nrightSense = {payload:(output[3])};\nmowSense = {payload:parseFloat(output[4])};\nleftCounter = {payload:parseFloat(output[5])};\nrightCounter = {payload:parseFloat(output[6])};\nmowCounter = {payload:parseFloat(output[7])};\n\nreturn [leftSense, rightSense, mowSense, leftCounter, rightCounter, mowCounter];\n\n\n}\n","outputs":6,"noerr":0,"x":354,"y":439,"wires":[["d3768d9b.7bdba"],["923e67a2.045928"],["b76a43c0.4e459"],["d85b4ff7.c8437"],["c5d9d113.27023"],["36f1bea6.78eb62"]]},{"id":"d3768d9b.7bdba","type":"ui_gauge","z":"996353eb.92f4e","name":"","group":"ffae3285.5c638","order":0,"width":"2","height":"2","gtype":"gage","title":"left","label":"W","format":"{{value}}","min":0,"max":10,"colors":["#00b500","#e6e600","#ca3838"],"seg1":"","seg2":"","x":568,"y":405,"wires":[]},{"id":"923e67a2.045928","type":"ui_gauge","z":"996353eb.92f4e","name":"","group":"ffae3285.5c638","order":0,"width":"2","height":"2","gtype":"gage","title":"right","label":"W","format":"{{value}}","min":0,"max":10,"colors":["#00b500","#e6e600","#ca3838"],"seg1":"","seg2":"","x":565,"y":447,"wires":[]},{"id":"b76a43c0.4e459","type":"ui_gauge","z":"996353eb.92f4e","name":"","group":"ffae3285.5c638","order":0,"width":"2","height":"2","gtype":"gage","title":"mow","label":"W","format":"{{value}}","min":0,"max":10,"colors":["#00b500","#e6e600","#ca3838"],"seg1":"","seg2":"","x":565,"y":485,"wires":[]},{"id":"b2e0364f.02ba18","type":"function","z":"996353eb.92f4e","name":"RMBUM","func":"var rmbumbegin = msg.payload.toString().search(\"\\\\$RMBUM\");\n\nif (rmbumbegin == -1){\n \n}\nelse{\n \n var output = msg.payload.split(\",\");\n\nleftCounter = {payload:parseInt(output[2])};\nrightCounter = {payload:parseInt(output[3])};\ncenterCounter = {payload:parseInt(output[4])};\nleftTrigger = {payload:parseInt(output[5])};\nrightTrigger = {payload:parseInt(output[6])};\ncenterTrigger = {payload:parseInt(output[7])};\n\nif (leftTrigger.payload === 0)\n{\n leftTrigger.color = \"green\";\n}\nelse\n{\n leftTrigger.color = \"red\";\n}\n\nif (rightTrigger.payload === 0)\n{\n rightTrigger.color = \"green\";\n}\nelse\n{\n rightTrigger.color = \"red\";\n}\n\nif (centerTrigger.payload === 0)\n{\n centerTrigger.color = \"green\";\n}\nelse\n{\n centerTrigger.color = \"red\";\n}\nreturn [leftCounter, rightCounter, centerCounter,leftTrigger, rightTrigger, centerTrigger];\n\n\n}\n","outputs":6,"noerr":0,"x":354,"y":616,"wires":[["25c3cbe5.1cf6f4"],["62a3cadf.72bf14"],["8a6117fb.02c748"],["a3f5513b.cbfc3"],["6e86d782.b84308"],["bdea85a0.5f8628"]]},{"id":"a3f5513b.cbfc3","type":"ui_template","z":"996353eb.92f4e","group":"19968ed7.1cab91","name":"left triggered","order":1,"width":"2","height":"1","format":"<script language=\"javascript\" type=\"text/javascript\">\n\n (function(scope){ \n scope.$watch('msg', function(msg) {\n if (msg.payload == \"1\")\n {\n flashRed(\"bumperleft_trigger\");\n }\n \n });\n })(scope);\n</script>\n\n<svg class=\"trigger_normal\" id=\"bumperleft_trigger\">\n <circle id=\"bumleft_trigger\" cx=\"10\" cy=\"20\" r=\"10\"/>\n</svg>\n","storeOutMessages":true,"fwdInMessages":true,"templateScope":"local","x":741,"y":563,"wires":[[]]},{"id":"6e86d782.b84308","type":"ui_template","z":"996353eb.92f4e","group":"19968ed7.1cab91","name":"right triggered","order":3,"width":"2","height":"1","format":"<script language=\"javascript\" type=\"text/javascript\">\n\n (function(scope){ \n scope.$watch('msg', function(msg) {\n if (msg.payload == \"1\")\n {\n flashRed(\"bumperright_trigger\");\n }\n \n });\n })(scope);\n</script>\n\n<svg class=\"trigger_normal\" id=\"bumperright_trigger\">\n <circle id=\"bumright_trigger\" cx=\"10\" cy=\"20\" r=\"10\"/>\n</svg>\n","storeOutMessages":true,"fwdInMessages":true,"templateScope":"local","x":741,"y":644,"wires":[[]]},{"id":"bdea85a0.5f8628","type":"ui_template","z":"996353eb.92f4e","group":"19968ed7.1cab91","name":"center triggered","order":2,"width":"2","height":"1","format":"<script language=\"javascript\" type=\"text/javascript\">\n\n (function(scope){ \n scope.$watch('msg', function(msg) {\n if (msg.payload == \"1\")\n {\n flashRed(\"bumpercenter_trigger\");\n }\n \n });\n })(scope);\n</script>\n\n<svg class=\"trigger_normal\" id=\"bumpercenter_trigger\">\n <circle id=\"bumcenter_trigger\" cx=\"10\" cy=\"20\" r=\"10\"/>\n</svg>\n","storeOutMessages":true,"fwdInMessages":true,"templateScope":"local","x":740,"y":603,"wires":[[]]},{"id":"25c3cbe5.1cf6f4","type":"ui_text","z":"996353eb.92f4e","group":"19968ed7.1cab91","order":4,"width":"2","height":"1","name":"","label":"left counter","format":"{{msg.payload}}","layout":"col-center","x":573,"y":558,"wires":[]},{"id":"8a6117fb.02c748","type":"ui_text","z":"996353eb.92f4e","group":"19968ed7.1cab91","order":5,"width":"2","height":"1","name":"","label":"center counter","format":"{{msg.payload}}","layout":"col-center","x":567,"y":623,"wires":[]},{"id":"62a3cadf.72bf14","type":"ui_text","z":"996353eb.92f4e","group":"19968ed7.1cab91","order":6,"width":"2","height":"1","name":"","label":"right counter","format":"{{msg.payload}}","layout":"col-center","x":562,"y":594,"wires":[]},{"id":"922205c8.c0aea8","type":"function","z":"996353eb.92f4e","name":"RMSON","func":"var rmsonbegin = msg.payload.toString().search(\"\\\\$RMSON\");\n\nif (rmsonbegin == -1){\n \n}\nelse{\n \n var output = msg.payload.split(\",\");\n\nleftDist = {payload:parseFloat(output[2])};\nleftDist.topic = 'sonarLeft';\nrightDist = {payload:parseFloat(output[3])};\nrightDist.topic = 'sonarRight';\ncenterDist = {payload:parseFloat(output[4])};\ncenterDist.topic = 'sonarCenter';\nleftCounter = {payload:parseInt(output[5])};\nrightCounter = {payload:parseInt(output[6])};\ncenterCounter = {payload:parseInt(output[7])};\n\n// set correct values if origin value is 0\nif (leftDist.payload === 0)\n{\n leftDist.payload = 100;\n}\n\nif (rightDist.payload === 0)\n{\n rightDist.payload = 100;\n}\n\nif (centerDist.payload === 0)\n{\n centerDist.payload = 100;\n}\nreturn [leftDist, rightDist, centerDist, leftCounter, rightCounter, centerCounter];\n\n\n}\n","outputs":6,"noerr":0,"x":356,"y":775,"wires":[["b34e1eeb.f96b8","ce4da4c6.38c928"],["b34e1eeb.f96b8"],["b34e1eeb.f96b8"],["f4f37e76.84b0e"],["24f24ca9.890a24"],["29f0529e.77720e"]]},{"id":"d85b4ff7.c8437","type":"ui_text","z":"996353eb.92f4e","group":"ffae3285.5c638","order":0,"width":"2","height":"1","name":"","label":"overload left","format":"{{msg.payload}}","layout":"col-center","x":706,"y":424,"wires":[]},{"id":"c5d9d113.27023","type":"ui_text","z":"996353eb.92f4e","group":"ffae3285.5c638","order":0,"width":"2","height":"1","name":"","label":"overload right","format":"{{msg.payload}}","layout":"col-center","x":715,"y":458,"wires":[]},{"id":"36f1bea6.78eb62","type":"ui_text","z":"996353eb.92f4e","group":"ffae3285.5c638","order":0,"width":"2","height":"1","name":"","label":"overload mow","format":"{{msg.payload}}","layout":"col-center","x":713,"y":495,"wires":[]},{"id":"f4f37e76.84b0e","type":"ui_text","z":"996353eb.92f4e","group":"3d8fdd23.305b72","order":0,"width":"2","height":"1","name":"","label":"Sonar left","format":"{{msg.payload}}","layout":"col-center","x":713,"y":732,"wires":[]},{"id":"29f0529e.77720e","type":"ui_text","z":"996353eb.92f4e","group":"3d8fdd23.305b72","order":0,"width":"2","height":"1","name":"","label":"Sonar center","format":"{{msg.payload}}","layout":"col-center","x":720,"y":776,"wires":[]},{"id":"24f24ca9.890a24","type":"ui_text","z":"996353eb.92f4e","group":"3d8fdd23.305b72","order":0,"width":"2","height":"1","name":"","label":"Sonar right","format":"{{msg.payload}}","layout":"col-center","x":721,"y":820,"wires":[]},{"id":"1060363a.2509aa","type":"function","z":"996353eb.92f4e","name":"RMODO","func":"var rmodobegin = msg.payload.toString().search(\"\\\\$RMODO\");\n\nif (rmodobegin == -1){\n \n}\nelse{\n \n var output = msg.payload.split(\",\");\n\nleft = {payload:parseInt(output[2])};\nright = {payload:parseInt(output[3])};\n\nreturn [left, right];\n\n\n}\n","outputs":2,"noerr":0,"x":350,"y":934,"wires":[["1ddb97c2.6536a8"],["d0a7b5b9.8341e8"]]},{"id":"1ddb97c2.6536a8","type":"ui_text","z":"996353eb.92f4e","group":"bb711151.ed35a","order":0,"width":"3","height":"2","name":"","label":"Odometry left","format":"{{msg.payload}}","layout":"col-center","x":568,"y":913,"wires":[]},{"id":"d0a7b5b9.8341e8","type":"ui_text","z":"996353eb.92f4e","group":"bb711151.ed35a","order":0,"width":"3","height":"2","name":"","label":"Odometry right","format":"{{msg.payload}}","layout":"col-center","x":569,"y":952,"wires":[]},{"id":"8e98ac80.085cd","type":"function","z":"996353eb.92f4e","name":"RMGPS","func":"var rmgpsbegin = msg.payload.toString().search(\"\\\\$RMGPS\");\n\nif (rmgpsbegin == -1){\n \n}\nelse{\n \n var output = msg.payload.split(\",\");\n\nlat = {payload:(output[2])/100000};\nlon = {payload:(output[3])/100000};\nmap = {payload: {name:\"Ardumower\", lat:lat.payload, lon:lon.payload}};\n\nreturn [lat, lon,map];\n\n\n}\n","outputs":3,"noerr":0,"x":343,"y":1042,"wires":[["23aa1e2.b8bb5e2"],["8ecf2435.22df18"],["2d6563b1.89842c","28cf36b0.a2f57a"]]},{"id":"23aa1e2.b8bb5e2","type":"ui_text","z":"996353eb.92f4e","group":"f594fe6b.96793","order":0,"width":"3","height":"2","name":"","label":"Latitude","format":"{{msg.payload}}","layout":"col-center","x":541,"y":1021,"wires":[]},{"id":"8ecf2435.22df18","type":"ui_text","z":"996353eb.92f4e","group":"f594fe6b.96793","order":0,"width":"3","height":"2","name":"","label":"Longitude","format":"{{msg.payload}}","layout":"col-center","x":542,"y":1060,"wires":[]},{"id":"63382853.ff5e38","type":"function","z":"996353eb.92f4e","name":"RMPER","func":"var rmperbegin = msg.payload.toString().search(\"\\\\$RMPER\");\n\nif (rmperbegin == -1){\n \n}\nelse{\n \n var output = msg.payload.split(\",\");\n\nmag = {payload:parseInt(output[2])};\ninside = {payload:parseInt(output[3])};\ncounter = {payload:parseInt(output[3])};\n\nif (inside.payload == 1)\n{\n inside.color = \"green\";\n}\nelse\n{\n inside.color = \"red\";\n}\n\nreturn [mag, inside, counter];\n\n\n}\n","outputs":3,"noerr":0,"x":333,"y":1156,"wires":[["f36048e8.bb7398","c15da6e6.13bfb8"],["f4f2c224.ef64f"],["d2489154.8ab7a"]]},{"id":"f36048e8.bb7398","type":"ui_text","z":"996353eb.92f4e","group":"d4eb4969.ba0838","order":0,"width":"2","height":"2","name":"","label":"mag","format":"{{msg.payload}}","layout":"col-center","x":521,"y":1135,"wires":[]},{"id":"d2489154.8ab7a","type":"ui_text","z":"996353eb.92f4e","group":"d4eb4969.ba0838","order":0,"width":"2","height":"2","name":"","label":"counter","format":"{{msg.payload}}","layout":"col-center","x":529,"y":1211,"wires":[]},{"id":"f4f2c224.ef64f","type":"ui_template","z":"996353eb.92f4e","group":"d4eb4969.ba0838","name":"inside","order":0,"width":"2","height":"2","format":"<style>\n\n#peri_inside {\n stroke: none;\n fill: {{msg.color}};\n}\n\n</style>\n\n<svg>\n <circle id=\"peri_inside\" cx=\"10\" cy=\"20\" r=\"10\"/>\n</svg>","storeOutMessages":true,"fwdInMessages":true,"templateScope":"local","x":517,"y":1173,"wires":[[]]},{"id":"d2f74ca3.031ea","type":"exec","z":"78cfa82b.f54128","command":"sudo poweroff #","addpay":false,"append":"","useSpawn":"","timer":"","oldrc":false,"name":"turn off Pi","x":562.2432250976562,"y":205.5811004638672,"wires":[[],[],[]]},{"id":"a53a6105.9e24d","type":"ui_button","z":"78cfa82b.f54128","name":"","group":"f9e60e97.c27ac","order":0,"width":0,"height":0,"passthru":false,"label":"Shutdown","color":"","bgcolor":"","icon":"","payload":"Do you really want to shutdown Ardumower's Raspberry PI?","payloadType":"str","topic":"","x":251,"y":109,"wires":[["b0cffe85.d047"]]},{"id":"edbed3bf.8015e","type":"exec","z":"996353eb.92f4e","command":"sudo poweroff #","addpay":false,"append":"","useSpawn":"","timer":"","oldrc":false,"name":"turn off Pi","x":522,"y":1518,"wires":[[],[],[]]},{"id":"878a331.f64f8d","type":"function","z":"996353eb.92f4e","name":"RMOFF","func":"var rmoffbegin = msg.payload.toString().search(\"\\\\$RMOFF\");\n\nif (rmoffbegin == -1){\n \n}\nelse{\nmsg.payload = \"off\";\nreturn msg\n}\n","outputs":1,"noerr":0,"x":351,"y":1513,"wires":[["edbed3bf.8015e"]]},{"id":"4bb5bacf.0e9014","type":"function","z":"996353eb.92f4e","name":"RMDRO","func":"var rmdrobegin = msg.payload.toString().search(\"\\\\$RMDRO\");\n\nif (rmdrobegin == -1){\n \n}\nelse{\n \n var output = msg.payload.split(\",\");\n\nleftCounter = {payload:parseInt(output[2])};\nrightCounter = {payload:parseInt(output[3])};\nleftTrigger = {payload:parseInt(output[4])};\nrightTrigger = {payload:parseInt(output[5])};\n\nif (leftTrigger.payload === 0)\n{\n leftTrigger.color = \"green\";\n}\nelse\n{\n leftTrigger.color = \"red\";\n}\n\nif (rightTrigger.payload === 0)\n{\n rightTrigger.color = \"green\";\n}\nelse\n{\n rightTrigger.color = \"red\";\n}\n\n\nreturn [leftounter, rightCounter,leftTrigger, rightTrigger];\n\n\n}\n","outputs":4,"noerr":0,"x":342,"y":1294,"wires":[["f3fc2acc.742508"],["efd8ec66.6cc64"],["8536d050.095d2"],["d766e233.5847c"]]},{"id":"8536d050.095d2","type":"ui_template","z":"996353eb.92f4e","group":"34f9e30.16f7d1e","name":"left triggered","order":0,"width":"2","height":"1","format":"<style>\n\n#drop_left {\n stroke: none;\n fill: {{msg.color}};\n}\n\n</style>\n\n<svg>\n <circle id=\"drop_left\" cx=\"10\" cy=\"20\" r=\"10\"/>\n</svg>","storeOutMessages":true,"fwdInMessages":true,"templateScope":"local","x":686,"y":1271,"wires":[[]]},{"id":"d766e233.5847c","type":"ui_template","z":"996353eb.92f4e","group":"34f9e30.16f7d1e","name":"right triggered","order":0,"width":"2","height":"1","format":"<style>\n\n#drop_right {\n stroke: none;\n fill: {{msg.color}};\n}\n\n</style>\n\n<svg>\n <circle id=\"drop_right\" cx=\"10\" cy=\"20\" r=\"10\"/>\n</svg>","storeOutMessages":true,"fwdInMessages":true,"templateScope":"local","x":692,"y":1308,"wires":[[]]},{"id":"f3fc2acc.742508","type":"ui_text","z":"996353eb.92f4e","group":"34f9e30.16f7d1e","order":0,"width":"2","height":"1","name":"","label":"left counter","format":"{{msg.payload}}","layout":"col-center","x":518,"y":1266,"wires":[]},{"id":"efd8ec66.6cc64","type":"ui_text","z":"996353eb.92f4e","group":"34f9e30.16f7d1e","order":0,"width":"2","height":"1","name":"","label":"right counter","format":"{{msg.payload}}","layout":"col-center","x":507,"y":1302,"wires":[]},{"id":"ecf0cb8b.e1e438","type":"function","z":"996353eb.92f4e","name":"RMIMU","func":"var rmimubegin = msg.payload.toString().search(\"\\\\$RMIMU\");\n\nif (rmimubegin == -1){\n \n}\nelse{\n \n var output = msg.payload.split(\",\");\n\nyaw = {payload:parseInt(output[2])};\npit = {payload:parseInt(output[3])};\nroll = {payload:parseInt(output[4])};\ntilt = {payload:parseInt(output[5])};\n\nreturn [yaw, pit, roll, tilt];\n\n\n}\n","outputs":4,"noerr":0,"x":339,"y":1396,"wires":[["e011e72f.487428","c3474a57.6ae658"],["a1e6f3a0.3e08a"],["b6922eca.e369c"],["806f2516.5b61e8"]]},{"id":"e011e72f.487428","type":"ui_text","z":"996353eb.92f4e","group":"72301ec0.49b6d","order":0,"width":"2","height":"2","name":"","label":"Yaw","format":"{{msg.payload}}","layout":"col-center","x":527,"y":1375,"wires":[]},{"id":"a1e6f3a0.3e08a","type":"ui_text","z":"996353eb.92f4e","group":"72301ec0.49b6d","order":0,"width":"2","height":"2","name":"","label":"PIT","format":"{{msg.payload}}","layout":"col-center","x":528,"y":1414,"wires":[]},{"id":"b6922eca.e369c","type":"ui_text","z":"996353eb.92f4e","group":"72301ec0.49b6d","order":0,"width":"2","height":"2","name":"","label":"Roll","format":"{{msg.payload}}","layout":"col-center","x":636,"y":1390,"wires":[]},{"id":"806f2516.5b61e8","type":"ui_text","z":"996353eb.92f4e","group":"72301ec0.49b6d","order":0,"width":"2","height":"2","name":"","label":"Tilt","format":"{{msg.payload}}","layout":"col-center","x":637,"y":1429,"wires":[]},{"id":"cde4c205.7e1a7","type":"ui_text_input","z":"996353eb.92f4e","name":"","label":"Send Command","group":"cb435d16.e15d2","order":0,"width":"8","height":"1","passthru":false,"mode":"text","delay":"0","topic":"","x":315,"y":1589,"wires":[["f2419746.587348","176c738d.3f3f4c"]]},{"id":"90c9518.9f2c2b","type":"serial out","z":"996353eb.92f4e","name":"Ardumower serial out","serial":"f4409ac2.4ad268","x":708,"y":1596,"wires":[]},{"id":"f2419746.587348","type":"function","z":"996353eb.92f4e","name":"clear send command","func":"msg.payload = \"\";\nreturn msg;","outputs":1,"noerr":0,"x":374,"y":1663,"wires":[["cde4c205.7e1a7"]]},{"id":"b0cffe85.d047","type":"ui_toast","z":"78cfa82b.f54128","position":"dialog","displayTime":"3","highlight":"","outputs":1,"ok":"OK","cancel":"Cancel","topic":"Shutdown Raspberry?","name":"","x":401,"y":109,"wires":[["ec7b92ed.8f332"]]},{"id":"ec7b92ed.8f332","type":"switch","z":"78cfa82b.f54128","name":"Check for shutdown","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"OK","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":375.95330810546875,"y":205.20950317382812,"wires":[["d2f74ca3.031ea"]]},{"id":"9285118a.8ffbf","type":"ui_template","z":"996353eb.92f4e","group":"dd71f26e.56c44","name":"PowerGraph","order":1,"width":"6","height":"6","format":"<script src=\"/myjs/RGraph/libraries/RGraph.gauge.js\" ></script>\n\n<script language=\"javascript\" type=\"text/javascript\">\n\n (function(scope){ \n scope.$watch('msg', function(msg) {\n var battery = gauge3.value[0];\n var charge = gauge3.value[1];\n /* if (msg.topic == 'battery')\n {\n battery = msg.batVolt.payload;\n }\n if (msg.topic == 'charge')\n {\n charge = msg.chgVolt.payload;\n }*/\n battery = msg.batVolt.payload;\n charge = msg.chgVolt.payload;\n gauge3.value=[battery,charge];\n gauge3.set('titleTop', 'Battery ' + battery + ' V');\n gauge3.set('titleBottom', 'Charge ' + charge + ' V');\n gauge3.grow();\n });\n })(scope);\n \n var gauge3 = new RGraph.Gauge({\n id: 'cvs_power',\n min: 20,\n max: 30,\n value: [0,0],\n options: {\n titleTopSize: '15',\n titleTopFont: 'Impact',\n titleTopColor: '#ff8888',\n titleTopPos: 0.25,\n titleBottomSize: '14',\n titleBottomFont: 'Impact',\n titleBottomColor: '#8888ff',\n titleBottomPos: 0.3,\n backgroundColor: 'black',\n backgroundGradient: true,\n centerpinColor: '#666',\n needleSize: [null, 50],\n needleColors: ['Gradient(transparent:yellow:orange:#ff8888:#ff8888)', \n 'Gradient(transparent:cyan:green:blue:blue)'],\n textColor: 'white',\n tickmarksBigColor: 'white',\n tickmarksMediumColor: 'white',\n tickmarksSmallColor: 'white',\n borderWidth: 1,\n borderOuter: '#666',\n borderInner: '#3333',\n colorsRanges: [\n \n [20,22,'rgba(255,0,0,0.6)'],\n [22,23,'rgba(255,200,0,0.6)'], \n [23,24,'rgba(255,200,0,0.6)'], \n [24,25,'rgba(0,200,0,0.6)'], \n [25,30,'rgba(0,255,0,0.6)']\n ],\n textAccessible: true\n }\n });\n gauge3.grow();\n\n </script>\n\n <canvas id=\"cvs_power\" width=\"300\" height=\"300\">[No canvas support]</canvas>","storeOutMessages":false,"fwdInMessages":false,"templateScope":"local","x":588,"y":267,"wires":[[]]},{"id":"b34e1eeb.f96b8","type":"ui_template","z":"996353eb.92f4e","group":"3d8fdd23.305b72","name":"SonarGraph","order":1,"width":"6","height":"6","format":"<script src=\"/myjs/RGraph/libraries/RGraph.radar.js\"></script>\n<script language=\"javascript\" type=\"text/javascript\">\n\n (function(scope){ \n scope.$watch('msg', function(msg) {\n var color_ok = 'rgba(0,255,0,0.25)';\n var color_slow = 'rgba(255,200,0,0.5)';\n var color_trigger = 'rgba(255,0,0,0.5)';\n var data = sonar.data[0];\n // var center = data[0];\n data = sonar.data[1];\n // var right = data[2];\n data = sonar.data[2];\n // var left = data[9];\n var color = sonar.get('colors');\n \n if (msg.topic == 'sonarLeft')\n {\n left = msg.payload;\n color[2] = color_ok;\n if (left < 60)\n {\n color[2] = color_slow;\n }\n if (left < 30){\n color[2] = color_trigger;\n }\n \n }\n if (msg.topic == 'sonarCenter')\n {\n center = msg.payload;\n color[0] = color_ok;\n if (center < 60)\n {\n color[0] = color_slow;\n } \n if (center < 30){\n color[0] = color_trigger;\n }\n }\n if (msg.topic == 'sonarRight')\n {\n right = msg.payload;\n color[1] = color_ok;\n if (right < 60)\n {\n color[1] = color_slow;\n }\n if (right < 30){\n color[1] = color_trigger;\n }\n } \n sonar.data=[\n [center,center,0,0,0,0,0,0,0,0,0,center],\n [0,right,right,right,0,0,0,0,0,0,0,0],\n [0,0,0,0,0,0,0,0,0,left,left,left]\n ];\n sonar.set('colors', color);\n sonar.grow({frames:1});\n });\n })(scope);\n \n var sonar = new RGraph.Radar({\n id: 'cvs_sonar',\n data: [\n [0,0,0,0,0,0,0,0,0,0,0,0],\n [0,0,0,0,0,0,0,0,0,0,0,0],\n [0,0,0,0,0,0,0,0,0,0,0,0],\n ],\n options: {\n ymax: 100,\n labels: ['Center','Right', ' ', ' ', 'Left'],\n textColor: 'white',\n backgroundCirclesPoly: true,\n backgroundCirclesCount: 10,\n backgroundCirclesSpacing: 30,\n colors: ['rgba(255,255,0,0.25)', 'rgba(255,255,0,0.25)', 'rgba(255,255,0,0.25)'],\n axesColor: 'transparent',\n highlights: true,\n strokestyle: 'rgba(0,0,0,0)',\n textAccessible: true\n }\n });\n sonar.grow({frames:1});\n\n </script>\n\n <canvas id=\"cvs_sonar\" width=\"250\" height=\"250\">\n [No canvas support]\n</canvas>\n","storeOutMessages":false,"fwdInMessages":false,"templateScope":"local","x":539,"y":722,"wires":[[]]},{"id":"755112b2.89e63c","type":"ui_template","z":"996353eb.92f4e","group":"dd71f26e.56c44","name":"chgCurrentGraph","order":0,"width":"4","height":"2","format":"<script src=\"/myjs/RGraph/libraries/RGraph.hprogress.js\"></script>\n\n\n<script language=\"javascript\" type=\"text/javascript\">\n\n (function(scope){ \n scope.$watch('msg', function(msg) {\n var current = chgCurrent.value;\n \n \n current = msg.payload;\n chgCurrent.value= current;\n chgCurrent.grow();\n });\n })(scope);\n \n var chgCurrent = new RGraph.HProgress({\n id: 'cvs_chgCurrent',\n min: 0,\n max: 5,\n value: 0,\n options: {\n textAccessible: true,\n margin: 7,\n bevel: true,\n numticks: 5,\n labelsCount: 5,\n title: 'Charge A',\n textColor: 'white',\n colors: ['red']\n }\n }).grow();\n\n </script>\n<script>\n \n</script>\n\n\n<canvas id=\"cvs_chgCurrent\" width=\"180\" height=\"60\">\n [No canvas support]\n</canvas>","storeOutMessages":true,"fwdInMessages":true,"templateScope":"local","x":605,"y":302,"wires":[[]]},{"id":"bef80b45.178058","type":"ui_template","z":"996353eb.92f4e","group":"9550e4e.ea6f618","name":"Header script files and CSS","order":0,"width":0,"height":0,"format":"<script src=\"/myjs/RGraph/libraries/RGraph.common.core.js\" ></script>\n\n<style>\n\n.trigger_normal{\n fill: green;\n}\n\n.trigger_triggered{\n fill: red;\n}\n\n</style>\n\n<script>\nfunction flashRed(id) {\n var redBox = document.getElementById(id);\n redBox.classList.add('trigger_triggered');\n setTimeout(function(){\n redBox.classList.remove('trigger_triggered');\n }, 500)\n}\n</script>\n\n","storeOutMessages":true,"fwdInMessages":true,"templateScope":"global","x":168,"y":28,"wires":[[]]},{"id":"ce4da4c6.38c928","type":"debug","z":"996353eb.92f4e","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":467,"y":681,"wires":[]},{"id":"c15da6e6.13bfb8","type":"ui_chart","z":"996353eb.92f4e","name":"","group":"d4eb4969.ba0838","order":0,"width":"6","height":"3","label":"mag","chartType":"line","legend":"false","xformat":"HH:mm:ss","interpolate":"linear","nodata":"","dot":false,"ymin":"-3000","ymax":"3000","removeOlder":1,"removeOlderPoints":"20","removeOlderUnit":"3600","cutout":0,"useOneColor":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"useOldStyle":false,"x":644,"y":1157,"wires":[[],[]]},{"id":"2f043f69.f1c64","type":"ui_switch","z":"78cfa82b.f54128","name":"Event trigger active?","label":"Event trigger active?","group":"37de859f.4586aa","order":3,"width":0,"height":0,"passthru":true,"decouple":"false","topic":"cfg_event_trigger","style":"","onvalue":"true","onvalueType":"bool","onicon":"","oncolor":"","offvalue":"false","offvalueType":"bool","officon":"","offcolor":"","x":197,"y":279,"wires":[["84f26df6.a6be9"]]},{"id":"84f26df6.a6be9","type":"function","z":"78cfa82b.f54128","name":"set_event","func":"var event_trigger = context.get('cfg_event_trigger') || false;\nvar event_frequency = context.get('cfg_event_frequency') || 0;\nvar event_type = context.get('cfg_event_type') || '';\n\n\nif (msg.topic == 'cfg_event_trigger') {\n event_trigger = msg.payload;\n context.set('cfg_event_trigger', event_trigger);\n}\n\nif (msg.topic == 'cfg_event_frequency') {\n event_frequency = msg.payload;\n context.set('cfg_event_frequency', event_frequency);\n}\n\nif (msg.topic == 'cfg_event_type') {\n event_type = msg.payload;\n context.set('cfg_event_type', event_type);\n}\n\n// put your other code here, state contains the state of the switch\n// for example:\nif (msg.payload == 'send_message') {\n var trigger = 0;\n \n if (event_trigger === true)\n {\n trigger = 1;\n }\n \n return {payload: \"$RMREQ,\"+ event_type + \",\" + \n event_frequency + \",\" + trigger + \"\\n\"\n };\n}\n\nreturn;","outputs":1,"noerr":0,"x":385,"y":306,"wires":[["728ac872.58b558","9fc23fb4.68356"]]},{"id":"a513e1d.3ccba2","type":"ui_numeric","z":"78cfa82b.f54128","name":"Event frequency [Hz]","label":"Event frequency [Hz]","group":"37de859f.4586aa","order":2,"width":0,"height":0,"passthru":true,"topic":"cfg_event_frequency","format":"{{value}}","min":"-1","max":10,"step":1,"x":172,"y":342,"wires":[["84f26df6.a6be9"]]},{"id":"81d65c14.b3fff","type":"ui_button","z":"78cfa82b.f54128","name":"Set Event","group":"37de859f.4586aa","order":4,"width":0,"height":0,"passthru":false,"label":"Send event","color":"","bgcolor":"","icon":"","payload":"send_message","payloadType":"str","topic":"","x":239,"y":482,"wires":[["84f26df6.a6be9"]]},{"id":"81527fee.a0d09","type":"ui_dropdown","z":"78cfa82b.f54128","name":"Event type","label":"","place":"Select option","group":"37de859f.4586aa","order":1,"width":0,"height":0,"passthru":true,"options":[{"label":"Bumper","value":"BUM","type":"str"},{"label":"Config","value":"CFG","type":"str"},{"label":"Drop","value":"DRO","type":"str"},{"label":"GPS","value":"GPS","type":"str"},{"label":"IMU","value":"IMU","type":"str"},{"label":"Motor","value":"MOT","type":"str"},{"label":"Odometry","value":"ODO","type":"str"},{"label":"Perimeter","value":"PER","type":"str"},{"label":"Sonar","value":"SON","type":"str"},{"label":"Status","value":"STA","type":"str"}],"payload":"","topic":"cfg_event_type","x":162,"y":411,"wires":[["84f26df6.a6be9"]]},{"id":"728ac872.58b558","type":"serial out","z":"78cfa82b.f54128","name":"Ardumower serial out","serial":"f4409ac2.4ad268","x":578,"y":305,"wires":[]},{"id":"9fc23fb4.68356","type":"debug","z":"78cfa82b.f54128","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":497,"y":356,"wires":[]},{"id":"f15d3384.ba5de","type":"config","z":"dc281da1.88d63","name":"camera_url","properties":[{"p":"camera_url","pt":"global","to":"http://192.168.178.37:8081","tot":"str"}],"active":true,"x":154,"y":87,"wires":[]},{"id":"4eb4089.03fbcf8","type":"ui_template","z":"996353eb.92f4e","group":"9550e4e.ea6f618","name":"camera","order":1,"width":"6","height":"6","format":"\n<script language=\"javascript\" type=\"text/javascript\">\n (function(scope){ \n scope.$watch('msg', function(msg) {\n \n window.ifr = document.getElementById(\"camera\");\n window.ifr.src=msg.payload;\n });\n })(scope);\n\n</script>\n<iframe id=\"camera\" seamless width=\"100%\" height=\"100%\"></iframe>","storeOutMessages":false,"fwdInMessages":false,"templateScope":"local","x":90,"y":1850,"wires":[[]]},{"id":"94fac448.a1acc8","type":"function","z":"996353eb.92f4e","name":"get_camera_url","func":"msg.payload = global.get(\"camera_url\");\nreturn msg;","outputs":1,"noerr":0,"x":103,"y":1803,"wires":[["4eb4089.03fbcf8"]]},{"id":"417c7f37.7bfb4","type":"inject","z":"996353eb.92f4e","name":"Trigger camera","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":true,"onceDelay":0.1,"x":105,"y":1750,"wires":[["94fac448.a1acc8"]]},{"id":"86ca6499.ea6268","type":"ui_template","z":"cf477024.84de6","group":"52892a0c.d9c5b4","name":"camera","order":1,"width":"6","height":"6","format":"\n<script language=\"javascript\" type=\"text/javascript\">\n (function(scope){ \n scope.$watch('msg', function(msg) {\n \n window.ifr = document.getElementById(\"camera\");\n window.ifr.src=msg.payload;\n });\n })(scope);\n\n</script>\n<iframe id=\"camera\" seamless width=\"100%\" height=\"100%\"></iframe>","storeOutMessages":false,"fwdInMessages":false,"templateScope":"local","x":98.30222129821777,"y":386.0605697631836,"wires":[[]]},{"id":"d1cb92a5.0e9b2","type":"inject","z":"cf477024.84de6","name":"Trigger UI Templates","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":true,"onceDelay":0.1,"x":110,"y":283,"wires":[["8b092d1b.0e2ed","e5e103e3.8bd8a"]]},{"id":"8b092d1b.0e2ed","type":"ui_template","z":"cf477024.84de6","group":"d365c8e8.c714f8","name":"Joystick","order":3,"width":"6","height":"6","format":"<script src=\"/myjs/nippleJS/nipplejs.min.js\" ></script>\n\n<div data-type=\"dynamic\" id=\"zone_joystick\" style=\"position:absolute; width:200px; height:200px; background-color:grey;\"></div>\n\n<script>\n\n\n(function(scope){ \n\n function createJoystick(){\n var dynamic = nipplejs.create({\n zone: document.getElementById('zone_joystick'),\n mode: 'dynamic',\n catchDistance: 150,\n color: 'white'\n });\n dynamic.on('move', function(evt, nipple_obj) {\n setTimeout(function() {\n var posx = nipple_obj.position.x;\n var posy = nipple_obj.position.y;\n var centerx = nipple_obj.instance.position.x;\n var centery = nipple_obj.instance.position.y;\n // use scope.send to trigger a message in the runtime flow\n scope.send({payload:{x: posx, y:posy, centerx:centerx, centery:centery}});\n }, 0);\n\n });\n\ndynamic.on('end', function(evt, nipple_obj) {\n setTimeout(function() {\n var posx =0;\n var posy = 0;\n var centerx = 0;\n var centery = 0;\n // use scope.send to trigger a message in the runtime flow\n scope.send({payload:{x: posx, y:posy, centerx:centerx, centery:centery}});\n }, 0);\n\n }); \n }\n\n\n scope.$watch('msg', function(msg) {\n createJoystick();\n\n });\n})(scope);\n\n</script>","storeOutMessages":false,"fwdInMessages":false,"templateScope":"local","x":317,"y":362,"wires":[["fbdf3963.9c2858"]]},{"id":"fbdf3963.9c2858","type":"function","z":"cf477024.84de6","name":"calculate motor speed","func":"\n\nvar speed = msg.payload.centery - msg.payload.y;\nvar steer =msg.payload.centerx - msg.payload.x;\n\n\nif (speed >= 0){\n var speed_left = speed + steer *-1;\n var speed_right = speed + steer;\n}else{\n var speed_left = speed + steer;\n var speed_right = speed + steer * -1; \n}\n\nspeed_left = speed_left / 2;\nspeed_right = speed_right / 2;\n\nvar manual = {payload:{speed_left:speed_left,\n speed_right : speed_right}};\n\nvar last_leftspeed = flow.get(\"manual_speed_left\");\nvar last_rightspeed = flow.get(\"manual_speed_right\");\n\n\nflow.set(\"manual_speed_left\", speed_left);\nflow.set(\"manual_speed_right\", speed_right);\n\nif (speed_left === 0 &&\n speed_right === 0)\n {\n manual.topic = \"Manual_stop\";\n } else {\n manual.topic = \"Manual_drive\";\n }\n \nreturn manual;\n","outputs":1,"noerr":0,"x":504,"y":364,"wires":[[]]},{"id":"f00f0fdc.449ca","type":"debug","z":"cf477024.84de6","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","x":824,"y":376,"wires":[]},{"id":"869750.020948b","type":"function","z":"cf477024.84de6","name":"create RMMOV message","func":"if (flow.get(\"state\") === \"manual\"){\n\nvar manual_mow = flow.get(\"manual_mow\")||0;\nif (manual_mow != 1){\n manual_mow = 0;\n}\n\nvar speed_left = flow.get(\"manual_speed_left\")||0;\nvar speed_right = flow.get(\"manual_speed_right\")||0;\n\nvar command = \"$RMMOV,\" + manual_mow + \",\" +\n parseInt(speed_left) +\n \",\" + parseInt(speed_right)+\",0,0,0\\n\";\n\nmsg.payload = command;\n\n return msg;\n}\n","outputs":1,"noerr":0,"x":448,"y":525,"wires":[["10c5c02e.aba8e","f00f0fdc.449ca"]]},{"id":"da466514.df1188","type":"ui_template","z":"cf477024.84de6","group":"20c5bc1a.cb6ce4","name":"Off","order":1,"width":"2","height":"2","format":"<div class='bLable'>OFF</div>\n<div id='bubble_state_off' ng-class=\"{0:'state not_active',1:'state state_off',2:'bubble tri',3:'bubble Quad'}[0]\" ng-click=\"sendClick($event)\"></div>\n\n<script>\n\n (function(scope){ \n scope.$watch('msg', function(msg) {\n var bubble = document.getElementById('bubble_state_off');\n if (msg.payload.state === \"off\")\n {\n bubble.attributes.class.value = \"state state_off\";\n \n }else{\n bubble.attributes.class.value = \"state not_active\";\n \n }\n \n });\n })(scope); \n \nvar sc = scope;\nvar sendClick = function(event){\n \n var thisRing = event.currentTarget.attributes.class.value;\n if(thisRing === \"state not_active\"){\n event.currentTarget.attributes.class.value = \"state state_off\";\n state = 1;\n } \n var uiid = JSON.stringify(event.currentTarget.attributes.id.value);\n sc.send({payload:{state:\"off\"}});\n}\nscope.sendClick = sendClick;\n</script>","storeOutMessages":true,"fwdInMessages":false,"templateScope":"local","x":315,"y":29,"wires":[["1dbab17f.a81e7f","51c8eda2.b3ef24","9b832497.fc60b8","a4d07dc0.0a4a2","41621b3d.dbe0f4","40d3a2b5.8a1c4c"]]},{"id":"1dbab17f.a81e7f","type":"ui_template","z":"cf477024.84de6","group":"20c5bc1a.cb6ce4","name":"Home","order":3,"width":"2","height":"2","format":"<div class='bLable'>Home</div>\n<div id='bubble_state_home' ng-class=\"{0:'state not_active',1:'state state_home',2:'bubble tri',3:'bubble Quad'}[0]\" ng-click=\"sendClick($event)\"></div>\n\n<script>\n\n (function(scope){ \n scope.$watch('msg', function(msg) {\n var bubble = document.getElementById('bubble_state_home');\n if (msg.payload.state === \"home\")\n {\n bubble.attributes.class.value = \"state state_home\";\n \n }else{\n bubble.attributes.class.value = \"state not_active\";\n \n }\n \n });\n })(scope); \n \nvar sc = scope;\nvar sendClick = function(event){\n \n var thisRing = event.currentTarget.attributes.class.value;\n if(thisRing === \"state not_active\"){\n event.currentTarget.attributes.class.value = \"state state_home\";\n state = 1;\n } \n var uiid = JSON.stringify(event.currentTarget.attributes.id.value);\n sc.send({payload:{state:\"home\"}});\n}\nscope.sendClick = sendClick;\n</script>","storeOutMessages":true,"fwdInMessages":false,"templateScope":"local","x":320,"y":88,"wires":[["da466514.df1188","51c8eda2.b3ef24","9b832497.fc60b8","a4d07dc0.0a4a2","40d3a2b5.8a1c4c"]]},{"id":"84c06df5.d9f77","type":"ui_template","z":"cf477024.84de6","group":"9550e4e.ea6f618","name":"CSS","order":0,"width":0,"height":0,"format":"<style>\n.bc {float: left; padding::0; margin:0 9px 0 0 !important;} \n.bLable {padding-left: 6px;}\n.state {float: left; width: 3.5em; height: 3.5em; border-radius: 50%; border: 7px solid #D21E1E; text-align:center; display:table-cell; outline: none !important; outline: 0 !important;}\n.not_active {border-color: #D21E1E;}\n.state_off {border-color: #5E9C31;}\n.state_home {border-color: #5E9C31;}\n.state_auto {border-color: #5E9C31;}\n.state_manual {border-color: #5E9C31;}\n.state_rc {border-color: #5E9C31;}\n.state_manual_mow {border-color: #5E9C31;}\n.tri {border-color: #D08C03;}\n.quad {border-color: #60A6E8;}\n</style>\n","storeOutMessages":true,"fwdInMessages":true,"templateScope":"global","x":131,"y":33,"wires":[[]]},{"id":"51c8eda2.b3ef24","type":"ui_template","z":"cf477024.84de6","group":"20c5bc1a.cb6ce4","name":"Manual","order":4,"width":"2","height":"2","format":"<div class='bLable'>Manual</div>\n<div id='bubble_state_manual' ng-class=\"{0:'state not_active',1:'state state_manual',2:'bubble tri',3:'bubble Quad'}[0]\" ng-click=\"sendClick($event)\"></div>\n\n<script>\n\n (function(scope){ \n scope.$watch('msg', function(msg) {\n var bubble = document.getElementById('bubble_state_manual');\n if (msg.payload.state === \"manual\")\n {\n bubble.attributes.class.value = \"state state_manual\";\n \n }else{\n bubble.attributes.class.value = \"state not_active\";\n \n }\n \n });\n })(scope); \n \nvar sc = scope;\nvar sendClick = function(event){\n \n var thisRing = event.currentTarget.attributes.class.value;\n if(thisRing === \"state not_active\"){\n event.currentTarget.attributes.class.value = \"state state_manual\";\n state = 1;\n } \n var uiid = JSON.stringify(event.currentTarget.attributes.id.value);\n sc.send({payload:{state:\"manual\"}});\n}\nscope.sendClick = sendClick;\n</script>","storeOutMessages":true,"fwdInMessages":false,"templateScope":"local","x":329,"y":126,"wires":[["da466514.df1188","1dbab17f.a81e7f","9b832497.fc60b8","a4d07dc0.0a4a2","40d3a2b5.8a1c4c"]]},{"id":"9b832497.fc60b8","type":"ui_template","z":"cf477024.84de6","group":"20c5bc1a.cb6ce4","name":"Auto","order":2,"width":"2","height":"2","format":"<div class='bLable'>Auto</div>\n<div id='bubble_state_auto' ng-class=\"{0:'state not_active',1:'state state_manual',2:'bubble tri',3:'bubble Quad'}[0]\" ng-click=\"sendClick($event)\"></div>\n\n<script>\n\n (function(scope){ \n scope.$watch('msg', function(msg) {\n var bubble = document.getElementById('bubble_state_auto');\n if (msg.payload.state === \"auto\")\n {\n bubble.attributes.class.value = \"state state_auto\";\n \n }else{\n bubble.attributes.class.value = \"state not_active\";\n \n }\n \n });\n })(scope); \n \nvar sc = scope;\nvar sendClick = function(event){\n \n var thisRing = event.currentTarget.attributes.class.value;\n if(thisRing === \"state not_active\"){\n event.currentTarget.attributes.class.value = \"state state_auto\";\n state = 1;\n } \n var uiid = JSON.stringify(event.currentTarget.attributes.id.value);\n sc.send({payload:{state:\"auto\"}});\n}\nscope.sendClick = sendClick;\n</script>","storeOutMessages":true,"fwdInMessages":false,"templateScope":"local","x":313,"y":164,"wires":[["51c8eda2.b3ef24","1dbab17f.a81e7f","da466514.df1188","a4d07dc0.0a4a2","40d3a2b5.8a1c4c"]]},{"id":"a4d07dc0.0a4a2","type":"function","z":"cf477024.84de6","name":"create RMMOW command","func":"if (msg.payload.state === \"off\")\n{\n msg.payload = \"$RMMOW,0\\n\";\n flow.set(\"state\",\"off\");\n}\n\nif (msg.payload.state === \"auto\")\n{\n msg.payload =\"$RMMOW,1\\n\";\n flow.set(\"state\",\"auto\");\n}\n\nif (msg.payload.state === \"home\")\n{\n msg.payload =\"$RMMOW,2\\n\";\n flow.set(\"state\",\"home\");\n}\n\nif (msg.payload.state === \"rc\")\n{\n msg.payload = \"$RMMOW,3\\n\";\n flow.set(\"state\",\"rc\");\n}\n\nif (msg.payload.state === \"manual\")\n{\n msg.payload = \"$RMMOW,0\\n\";\n flow.set(\"state\",\"manual\");\n}\nreturn msg;\n","outputs":1,"noerr":0,"x":636,"y":106,"wires":[["c8001448.e3a2b8","3a786234.0f330e"]]},{"id":"41621b3d.dbe0f4","type":"ui_template","z":"cf477024.84de6","group":"20c5bc1a.cb6ce4","name":"RC","order":5,"width":"2","height":"2","format":"<div class='bLable'>RC</div>\n<div id='bubble_state_rc' ng-class=\"{0:'state not_active',1:'state state_rc',2:'bubble tri',3:'bubble Quad'}[0]\" ng-click=\"sendClick($event)\"></div>\n\n<script>\n\n (function(scope){ \n scope.$watch('msg', function(msg) {\n var bubble = document.getElementById('bubble_state_rc');\n if (msg.payload.state === \"rc\")\n {\n bubble.attributes.class.value = \"state state_rc\";\n \n }else{\n bubble.attributes.class.value = \"state not_active\";\n \n }\n \n });\n })(scope); \n \nvar sc = scope;\nvar sendClick = function(event){\n \n var thisRing = event.currentTarget.attributes.class.value;\n if(thisRing === \"state not_active\"){\n event.currentTarget.attributes.class.value = \"state state_rc\";\n state = 1;\n } \n var uiid = JSON.stringify(event.currentTarget.attributes.id.value);\n sc.send({payload:{state:\"rc\"}});\n}\nscope.sendClick = sendClick;\n</script>","storeOutMessages":true,"fwdInMessages":false,"templateScope":"local","x":319,"y":203,"wires":[["9b832497.fc60b8","51c8eda2.b3ef24","1dbab17f.a81e7f","da466514.df1188","a4d07dc0.0a4a2","40d3a2b5.8a1c4c"]]},{"id":"c8001448.e3a2b8","type":"debug","z":"cf477024.84de6","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":660,"y":182,"wires":[]},{"id":"40d3a2b5.8a1c4c","type":"debug","z":"cf477024.84de6","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":511,"y":36,"wires":[]},{"id":"dcea86c6.37aae8","type":"function","z":"cf477024.84de6","name":"set manual mow motor","func":"if (msg.payload === true)\n{\n flow.set(\"manual_mow\", 1);\n} else {\n flow.set(\"manual_mow\",0);\n}\n","outputs":1,"noerr":0,"x":528,"y":257,"wires":[[]]},{"id":"3a9753bc.e69fac","type":"ui_switch","z":"cf477024.84de6","name":"","label":"Mow Motor","group":"d365c8e8.c714f8","order":2,"width":"3","height":"1","passthru":true,"decouple":"false","topic":"","style":"","onvalue":"true","onvalueType":"bool","onicon":"","oncolor":"","offvalue":"false","offvalueType":"bool","officon":"","offcolor":"","x":313,"y":254,"wires":[["dcea86c6.37aae8"]]},{"id":"10c5c02e.aba8e","type":"serial out","z":"cf477024.84de6","name":"Ardumower serial out","serial":"f4409ac2.4ad268","x":823,"y":494,"wires":[]},{"id":"3a786234.0f330e","type":"serial out","z":"cf477024.84de6","name":"Ardumower serial out","serial":"f4409ac2.4ad268","x":854,"y":145,"wires":[]},{"id":"4e285659.8cd318","type":"exec","z":"78cfa82b.f54128","command":"sudo service nodered restart","addpay":true,"append":"","useSpawn":"false","timer":"","oldrc":false,"name":"restart node-red","x":592,"y":646.5,"wires":[[],[],[]]},{"id":"ade96df.1e00d9","type":"ui_button","z":"78cfa82b.f54128","name":"","group":"ab9f2e67.77b02","order":0,"width":"0","height":"0","passthru":false,"label":"Restart Node-RED","color":"","bgcolor":"","icon":"","payload":"Do you really want to restart Node-RED service?","payloadType":"str","topic":"","x":177,"y":569,"wires":[["1c4a9472.143ddc"]]},{"id":"1c4a9472.143ddc","type":"ui_toast","z":"78cfa82b.f54128","position":"dialog","displayTime":"3","highlight":"","outputs":1,"ok":"OK","cancel":"Cancel","topic":"Restart Node-RED?","name":"","x":362,"y":568,"wires":[["d344cecc.a5d49"]]},{"id":"d344cecc.a5d49","type":"switch","z":"78cfa82b.f54128","name":"Check for shutdown","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"OK","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":558.9533081054688,"y":568.20947265625,"wires":[["4e285659.8cd318"]]},{"id":"75ec8c76.7a9754","type":"serial in","z":"cf477024.84de6","name":"Ardumower IN","serial":"f4409ac2.4ad268","x":166,"y":628,"wires":[["8f51cc63.47247"]]},{"id":"8f51cc63.47247","type":"ui_text","z":"cf477024.84de6","group":"d365c8e8.c714f8","order":1,"width":"6","height":"1","name":"Serial","label":"","format":"{{msg.payload}}","layout":"row-left","x":392,"y":625,"wires":[]},{"id":"2d6563b1.89842c","type":"worldmap","z":"996353eb.92f4e","name":"","lat":"50.23629","lon":"6.69234","zoom":"18","layer":"Esri Satellite","cluster":"","maxage":"","usermenu":"show","layers":"show","panit":"false","x":667,"y":1093,"wires":[]},{"id":"28cf36b0.a2f57a","type":"debug","z":"996353eb.92f4e","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":681,"y":1054,"wires":[]},{"id":"3c7c6b48.6c9e44","type":"ui_template","z":"f65812f2.ecbd5","group":"f594fe6b.96793","name":"Map","order":0,"width":0,"height":0,"format":"<iframe src=\"/worldmap\" width=\"500px\" height=\"400px\" ></iframe>","storeOutMessages":true,"fwdInMessages":true,"templateScope":"local","x":337.5,"y":66,"wires":[[]]},{"id":"93c482b1.d31f4","type":"ui_template","z":"f65812f2.ecbd5","group":"28837999.cb9716","name":"camera","order":1,"width":"6","height":"6","format":"\n<script language=\"javascript\" type=\"text/javascript\">\n (function(scope){ \n scope.$watch('msg', function(msg) {\n \n window.ifr = document.getElementById(\"camera\");\n window.ifr.src=msg.payload;\n });\n })(scope);\n\n</script>\n<iframe id=\"camera\" seamless width=\"100%\" height=\"100%\"></iframe>","storeOutMessages":false,"fwdInMessages":false,"templateScope":"local","x":141.84191513061523,"y":225.6473731994629,"wires":[[]]},{"id":"e5e103e3.8bd8a","type":"function","z":"cf477024.84de6","name":"get_camera_url","func":"msg.payload = global.get(\"camera_url\");\nreturn msg;","outputs":1,"noerr":0,"x":107.4417495727539,"y":331.37298583984375,"wires":[["86ca6499.ea6268"]]},{"id":"115be876.d73078","type":"function","z":"f65812f2.ecbd5","name":"get_camera_url","func":"msg.payload = global.get(\"camera_url\");\nreturn msg;","outputs":1,"noerr":0,"x":121.01334381103516,"y":163.9900360107422,"wires":[["93c482b1.d31f4"]]},{"id":"95587f0c.d4ac5","type":"inject","z":"f65812f2.ecbd5","name":"Trigger UI Templates","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":true,"onceDelay":0.1,"x":107.75835418701172,"y":114.73483562469482,"wires":[["115be876.d73078"]]},{"id":"72eb92fd.b9ff5c","type":"ui_template","z":"996353eb.92f4e","group":"72301ec0.49b6d","name":"Compass","order":1,"width":"6","height":"6","format":"<script src=\"/myjs/RGraph/libraries/RGraph.drawing.image.js\"></script>\n<script src=\"/myjs/RGraph/libraries/RGraph.odo.js\"></script>\n<script language=\"javascript\" type=\"text/javascript\">\n\n (function(scope){ \n scope.$watch('msg', function(msg) {\n compass.value = msg.payload;\n compass.grow();\n \n });\n })(scope);\n \n var img = new RGraph.Drawing.Image({\n id: 'cvs_compass',\n x: -4,\n y: 0,\n src: '/Images/compass.png'\n }).draw()\nvar compass = new RGraph.Odometer({\n id: 'cvs_compass',\n min: 0,\n max: 360,\n value: 0,\n options: {\n greenColor: 'rgba(0,0,0,0)',\n yellowColor: 'rgba(0,0,0,0)',\n redColor: 'rgba(0,0,0,0)',\n backgroundColor: 'rgba(0,0,0,0)',\n backgroundBorder: 'rgba(0,0,0,0)',\n backgroundLinesColor: 'rgba(0,0,0,0)',\n tickmarks: false,\n tickmarksBigColor: 'rgba(0,0,0,0)',\n textColor: 'rgba(0,0,0,0)',\n needleColor: '#ddd',\n needleTail: false,\n needleHead: false,\n needleThickness: 5\n }\n }).draw();\n \n </script>\n\n <canvas id=\"cvs_compass\" width=\"300\" height=\"300\">\n [No canvas support]\n</canvas>\n","storeOutMessages":false,"fwdInMessages":false,"templateScope":"local","x":674,"y":1470,"wires":[[]]},{"id":"c3474a57.6ae658","type":"function","z":"996353eb.92f4e","name":"Compass degree","func":"if (msg.payload < 0 )\n{\n msg.payload = msg.payload * -1 +180;\n}\n\n\nreturn msg;","outputs":1,"noerr":0,"x":464,"y":1472,"wires":[["72eb92fd.b9ff5c","4afa87fd.ff33b8"]]},{"id":"4afa87fd.ff33b8","type":"debug","z":"996353eb.92f4e","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":673,"y":1513,"wires":[]},{"id":"176c738d.3f3f4c","type":"function","z":"996353eb.92f4e","name":"add Enter \\n","func":"msg.payload = msg.payload + \"\\n\";\nreturn msg;","outputs":1,"noerr":0,"x":509,"y":1593,"wires":[["90c9518.9f2c2b"]]},{"id":"15867ec5.deab81","type":"trigger","z":"cf477024.84de6","op1":"1","op2":"0","op1type":"str","op2type":"str","duration":"500","extend":false,"units":"ms","reset":"","bytopic":"all","name":"send each 500ms","x":448,"y":453,"wires":[["869750.020948b"]]},{"id":"f42ec9e.df46938","type":"inject","z":"cf477024.84de6","name":"Trigger Joystick data send to mower","topic":"","payload":"","payloadType":"date","repeat":"1","crontab":"","once":true,"onceDelay":0.1,"x":172,"y":459,"wires":[["15867ec5.deab81"]]}]