From 0887d70b764a4464c0bdd7903df4423334118975 Mon Sep 17 00:00:00 2001 From: Romain Bazile Date: Tue, 15 Sep 2020 17:33:49 +0200 Subject: [PATCH] update to main.json to fix camera bugs --- flows/main.json | 4081 ++++++++++++++++++++++++----------------------- 1 file changed, 2079 insertions(+), 2002 deletions(-) diff --git a/flows/main.json b/flows/main.json index 4106b23..fe53f36 100644 --- a/flows/main.json +++ b/flows/main.json @@ -1,6 +1,25 @@ [ { - "id": "97600dff.93378", + "id": "c4414305.176578", + "type": "tab", + "label": "Main", + "disabled": false, + "info": "" + }, + { + "id": "aafb7d9f.f516f", + "type": "subflow", + "name": "RPi Monitoring", + "info": "", + "category": "", + "in": [], + "out": [], + "env": [], + "color": "#87A980", + "icon": "node-red/status.svg" + }, + { + "id": "3f0fd072.06e2c8", "type": "subflow", "name": "Acquisition actuation", "info": "", @@ -8,17 +27,1319 @@ "in": [], "out": [], "env": [], - "color": "#A6BBCF" + "color": "#A6BBCF", + "icon": "font-awesome/fa-camera" }, { - "id": "604c996b.1a8428", - "type": "ui_button", - "z": "97600dff.93378", + "id": "435c6174.e0c8b", + "type": "subflow", + "name": "Python Code Creation", + "info": "", + "category": "", + "in": [ + { + "x": 40, + "y": 40, + "wires": [ + { + "id": "10348484.8ca5b3" + }, + { + "id": "e49710cf.c4831" + } + ] + } + ], + "out": [], + "env": [], + "color": "#DDAA99" + }, + { + "id": "4273b9bf.bb07a8", + "type": "subflow", + "name": "Acquisition inputs", + "info": "", + "category": "", + "in": [ + { + "x": 40, + "y": 40, + "wires": [ + { + "id": "55d70110.127d38" + }, + { + "id": "4e6a3b73.7472d4" + }, + { + "id": "ec5967a.409eb18" + } + ] + } + ], + "out": [ + { + "x": 740, + "y": 40, + "wires": [ + { + "id": "a105d7c9.07d71", + "port": 0 + }, + { + "id": "816c19e2.f940e", + "port": 0 + }, + { + "id": "530d8426.5c4bec", + "port": 0 + } + ] + } + ], + "env": [], + "color": "#A6BBCF", + "icon": "node-red-contrib-camerapi/photo.png" + }, + { + "id": "4d3786dd.dd79f", + "type": "subflow", + "name": "Process metadata", + "info": "", + "category": "", + "in": [ + { + "x": 40, + "y": 80, + "wires": [ + { + "id": "7228965.6f65ae8" + } + ] + } + ], + "out": [ + { + "x": 700, + "y": 80, + "wires": [ + { + "id": "7bad3862.c22b5", + "port": 0 + } + ] + } + ], + "env": [], + "color": "#DDAA99" + }, + { + "id": "20bc0424.146724", + "type": "subflow", + "name": "MQTT Receive & Plot", + "info": "", + "category": "", + "in": [], + "out": [], + "env": [], + "color": "#F3B567", + "icon": "node-red/bridge.svg" + }, + { + "id": "7aea7e49.4a3c88", + "type": "subflow", + "name": "System Commands", + "info": "", + "category": "", + "in": [], + "out": [], + "env": [], + "color": "#FFCC66", + "icon": "node-red-dashboard/ui_button.png" + }, + { + "id": "672ac548.1a9bac", + "type": "subflow", + "name": "Object metadata", + "info": "", + "category": "", + "in": [ + { + "x": 40, + "y": 40, + "wires": [ + { + "id": "46ef98a.3d3e8e8" + }, + { + "id": "e6b2a290.7593c8" + }, + { + "id": "61bc4942.96a3d" + } + ] + } + ], + "out": [ + { + "x": 1060, + "y": 159, + "wires": [ + { + "id": "d7ac6b26.75e388", + "port": 0 + }, + { + "id": "70dcbf49.4b0e6", + "port": 0 + } + ] + }, + { + "x": 1060, + "y": 59, + "wires": [ + { + "id": "415b9f0c.5f0b48", + "port": 0 + }, + { + "id": "3e9ae6e6.35b942", + "port": 0 + } + ] + } + ], + "env": [], + "color": "#DDAA99" + }, + { + "id": "5163a57b.0008b4", + "type": "subflow", + "name": "Acquisition metadata", + "info": "", + "category": "", + "in": [ + { + "x": 50, + "y": 30, + "wires": [ + { + "id": "7c09012f.b50098" + }, + { + "id": "3e3b0646.cf9a1a" + }, + { + "id": "2b4282c2.8752ae" + }, + { + "id": "90439ce.e3524e" + }, + { + "id": "7f710823.92974" + }, + { + "id": "9355d580.a2338" + }, + { + "id": "c8be3f91.8686e" + }, + { + "id": "98bb1c89.99c7b8" + }, + { + "id": "218c020a.2b0566" + } + ] + } + ], + "out": [ + { + "x": 740, + "y": 40, + "wires": [ + { + "id": "52374b71.714fd4", + "port": 0 + }, + { + "id": "858ed565.0993b8", + "port": 0 + }, + { + "id": "2cf276d8.880672", + "port": 0 + }, + { + "id": "ebcf7cae.9e21c8", + "port": 0 + }, + { + "id": "7291a2a3.c9a974", + "port": 0 + }, + { + "id": "25294db5.4fe722", + "port": 0 + }, + { + "id": "4cfd49e3.3db3c", + "port": 0 + }, + { + "id": "7dbb773.926b488", + "port": 0 + } + ] + }, + { + "x": 900, + "y": 360, + "wires": [ + { + "id": "79923da9.365d7c", + "port": 0 + } + ] + } + ], + "env": [], + "color": "#DDAA99" + }, + { + "id": "b1edcbe7.366f7", + "type": "subflow", + "name": "Pump actuation", + "info": "", + "category": "", + "in": [ + { + "x": 40, + "y": 40, + "wires": [ + { + "id": "66f2533e.b3080c" + }, + { + "id": "e3472832.6c2cc8" + } + ] + } + ], + "out": [ + { + "x": 700, + "y": 40, + "wires": [ + { + "id": "1f1c2de7.b242f2", + "port": 0 + }, + { + "id": "8cab4571.004668", + "port": 0 + } + ] + } + ], + "env": [], + "color": "#A6BBCF", + "icon": "font-awesome/fa-recycle" + }, + { + "id": "3df4e02.36602a", + "type": "subflow", + "name": "Focus actuation", + "info": "", + "category": "", + "in": [ + { + "x": 40, + "y": 40, + "wires": [ + { + "id": "ba9fc5ee.19aee8" + } + ] + } + ], + "out": [ + { + "x": 800, + "y": 200, + "wires": [ + { + "id": "3df51223.81e336", + "port": 0 + } + ] + } + ], + "env": [], + "color": "#A6BBCF", + "icon": "node-red/sort.svg" + }, + { + "id": "6bc47c75.93e24c", + "type": "subflow", + "name": "Sample metadata", + "info": "", + "category": "", + "in": [ + { + "x": 40, + "y": 40, + "wires": [ + { + "id": "a4b7cb08.270d" + }, + { + "id": "d7cff063.331ff8" + }, + { + "id": "acfe2f.33fd31d" + }, + { + "id": "cfaa2598.c63ec" + }, + { + "id": "25201379.163e3c" + } + ] + } + ], + "out": [ + { + "x": 840, + "y": 40, + "wires": [ + { + "id": "412da17d.09c39", + "port": 0 + }, + { + "id": "236eeefd.7d50f2", + "port": 0 + }, + { + "id": "ccb4ce9e.4f9108", + "port": 0 + }, + { + "id": "d76b1790.9ffc2", + "port": 0 + }, + { + "id": "50431d7c.cc673c", + "port": 0 + } + ] + } + ], + "env": [], + "color": "#DDAA99" + }, + { + "id": "7a723961.386be", + "type": "ui_group", + "z": "", + "name": "Monitor RPi", + "tab": "c4349ea0.ea1cc8", + "order": 11, + "disp": true, + "width": 24, + "collapse": false + }, + { + "id": "3bd8d121.499b96", + "type": "ui_group", + "z": "", + "name": "Acquisition actuation", + "tab": "c4349ea0.ea1cc8", + "order": 9, + "disp": true, + "width": 24, + "collapse": false + }, + { + "id": "6fdfb3ec.fd451c", + "type": "ui_group", + "z": "", + "name": "Acquisition inputs", + "tab": "c4349ea0.ea1cc8", + "order": 8, + "disp": true, + "width": "24", + "collapse": false + }, + { + "id": "c32bf44c.3b67a8", + "type": "ui_group", + "z": "", + "name": "Process metadata", + "tab": "c4349ea0.ea1cc8", + "order": 7, + "disp": true, + "width": 24, + "collapse": false + }, + { + "id": "6e9cdee.ac3c2a", + "type": "mqtt-broker", + "z": "", "name": "", - "group": "cdb72118.692578", + "broker": "127.0.0.1", + "port": "1883", + "clientid": "test", + "usetls": false, + "compatmode": false, + "keepalive": "60", + "cleansession": true, + "birthTopic": "", + "birthQos": "0", + "birthPayload": "", + "closeTopic": "", + "closeQos": "0", + "closePayload": "", + "willTopic": "", + "willQos": "0", + "willPayload": "" + }, + { + "id": "1f183a1c.7d2846", + "type": "ui_group", + "z": "", + "name": "MQTT Plots", + "tab": "c4349ea0.ea1cc8", + "order": 10, + "disp": true, + "width": "24", + "collapse": false + }, + { + "id": "1f044bf8.be704c", + "type": "ui_group", + "z": "", + "name": "RPi commands", + "tab": "c4349ea0.ea1cc8", + "order": 12, + "disp": true, + "width": "24", + "collapse": false + }, + { + "id": "2f95b761.bd818", + "type": "ui_group", + "z": "", + "name": "Object metadata", + "tab": "c4349ea0.ea1cc8", + "order": 2, + "disp": true, + "width": 24, + "collapse": false + }, + { + "id": "14742691.56c8c1", + "type": "ui_group", + "z": "", + "name": "Acquisition metadata", + "tab": "c4349ea0.ea1cc8", + "order": 3, + "disp": true, + "width": 24, + "collapse": false + }, + { + "id": "517b2aa5.93722c", + "type": "ui_group", + "z": "", + "name": "Pump actuation", + "tab": "c4349ea0.ea1cc8", + "order": 6, + "disp": true, + "width": "24", + "collapse": false + }, + { + "id": "88613aab.984d18", + "type": "ui_group", + "z": "", + "name": "Focus actuation", + "tab": "c4349ea0.ea1cc8", + "order": 5, + "disp": true, + "width": "24", + "collapse": false + }, + { + "id": "e6efd12e.dedae8", + "type": "mqtt-broker", + "z": "", + "name": "", + "broker": "0.0.0.0", + "port": "1883", + "clientid": "Client_node", + "usetls": false, + "compatmode": false, + "keepalive": "60", + "cleansession": true, + "birthTopic": "", + "birthQos": "0", + "birthPayload": "", + "closeTopic": "", + "closeQos": "0", + "closePayload": "", + "willTopic": "", + "willQos": "0", + "willPayload": "" + }, + { + "id": "bfdb5a44.4223", + "type": "ui_group", + "z": "", + "name": "Sample metadata", + "tab": "c4349ea0.ea1cc8", "order": 1, - "width": 0, - "height": 0, + "disp": true, + "width": 24, + "collapse": false + }, + { + "id": "c4349ea0.ea1cc8", + "type": "ui_tab", + "z": "", + "name": "Acquisition", + "icon": "fa-eyedropper", + "order": 3, + "disabled": false, + "hidden": false + }, + { + "id": "6b2a8cdd.9f43cc", + "type": "ui_group", + "z": "", + "name": "Streaming camera", + "tab": "c4349ea0.ea1cc8", + "order": 4, + "disp": true, + "width": 24, + "collapse": false + }, + { + "id": "b6a679c9.da3fa8", + "type": "ui_base", + "theme": { + "name": "theme-dark", + "lightTheme": { + "default": "#0094CE", + "baseColor": "#0094CE", + "baseFont": "-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif", + "edited": false, + "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": "Untitled Theme 1", + "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": "#333333", + "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" + } + }, + "angularTheme": { + "primary": "indigo", + "accents": "blue", + "warn": "red", + "background": "grey" + } + }, + "site": { + "name": "Node-RED Dashboard", + "hideToolbar": "false", + "allowSwipe": "false", + "lockMenu": "false", + "allowTempTheme": "true", + "dateFormat": "DD/MM/YYYY", + "sizes": { + "sx": 48, + "sy": 48, + "gx": 6, + "gy": 6, + "cx": 6, + "cy": 6, + "px": 0, + "py": 0 + } + } + }, + { + "id": "d4285aee.f326e", + "type": "exec", + "z": "aafb7d9f.f516f", + "command": "free -m | grep \"Mem\" | awk -F ' ' '{print $3}'", + "addpay": false, + "append": "", + "useSpawn": "", + "timer": "", + "name": "Get memory used", + "x": 430, + "y": 100, + "wires": [ + [ + "5d2fe716.8ad198", + "6326d8e5.292c5" + ], + [], + [] + ] + }, + { + "id": "d6e7a1be.f8f8f8", + "type": "inject", + "z": "aafb7d9f.f516f", + "name": "", + "repeat": "1", + "crontab": "", + "once": false, + "onceDelay": "", + "topic": "", + "payload": "", + "payloadType": "num", + "x": 210, + "y": 100, + "wires": [ + [ + "d4285aee.f326e" + ] + ] + }, + { + "id": "5d2fe716.8ad198", + "type": "ui_chart", + "z": "aafb7d9f.f516f", + "name": "Memory Load Chart", + "group": "7a723961.386be", + "order": 8, + "width": 19, + "height": 4, + "label": "Memory Load Chart", + "chartType": "line", + "legend": "false", + "xformat": "HH:mm:ss", + "interpolate": "bezier", + "nodata": "", + "dot": true, + "ymin": "", + "ymax": "", + "removeOlder": "20", + "removeOlderPoints": "", + "removeOlderUnit": "60", + "cutout": 0, + "useOneColor": false, + "colors": [ + "#1f77b4", + "#aec7e8", + "#ff7f0e", + "#2ca02c", + "#98df8a", + "#d62728", + "#ff9896", + "#9467bd", + "#c5b0d5" + ], + "useOldStyle": false, + "outputs": 1, + "x": 660, + "y": 120, + "wires": [ + [] + ] + }, + { + "id": "6326d8e5.292c5", + "type": "ui_gauge", + "z": "aafb7d9f.f516f", + "name": "Memory Load Donut", + "group": "7a723961.386be", + "order": 7, + "width": 5, + "height": 4, + "gtype": "donut", + "title": "Memory Load Donut", + "label": "Mo", + "format": "{{value}}", + "min": 0, + "max": "4000", + "colors": [ + "#00b500", + "#e6e600", + "#ca3838" + ], + "seg1": "1000", + "seg2": "2000", + "x": 660, + "y": 80, + "wires": [] + }, + { + "id": "b38a018c.21dc18", + "type": "ui_gauge", + "z": "aafb7d9f.f516f", + "name": "CPU Temp Donut", + "group": "7a723961.386be", + "order": 1, + "width": 5, + "height": 4, + "gtype": "donut", + "title": "CPU Temp Donut", + "label": "C", + "format": "{{value}}", + "min": "35", + "max": "55", + "colors": [ + "#00b500", + "#e6e600", + "#ca3838" + ], + "seg1": "", + "seg2": "", + "x": 650, + "y": 160, + "wires": [] + }, + { + "id": "c35a43a5.f0d1e8", + "type": "exec", + "z": "aafb7d9f.f516f", + "command": "vcgencmd measure_temp | tr -d \"temp=\" | tr -d \"'C\" | tr -d \"\\n\"", + "addpay": false, + "append": "", + "useSpawn": "", + "timer": "", + "name": "RPi Temp.", + "x": 410, + "y": 180, + "wires": [ + [ + "8f6f6c48.fe30c", + "b38a018c.21dc18", + "d2d8b9f6.c82e68" + ], + [], + [] + ] + }, + { + "id": "d2d8b9f6.c82e68", + "type": "ui_chart", + "z": "aafb7d9f.f516f", + "name": "CPU Temp Chart", + "group": "7a723961.386be", + "order": 2, + "width": 19, + "height": 4, + "label": "CPU Temp Chart", + "chartType": "line", + "legend": "false", + "xformat": "HH:mm:ss", + "interpolate": "linear", + "nodata": "", + "dot": false, + "ymin": "", + "ymax": "", + "removeOlder": "20", + "removeOlderPoints": "200", + "removeOlderUnit": "60", + "cutout": 0, + "useOneColor": false, + "colors": [ + "#1f77b4", + "#aec7e8", + "#ff7f0e", + "#2ca02c", + "#98df8a", + "#d62728", + "#ff9896", + "#9467bd", + "#c5b0d5" + ], + "useOldStyle": true, + "outputs": 1, + "x": 650, + "y": 200, + "wires": [ + [] + ] + }, + { + "id": "602add74.9aa2a4", + "type": "python3-function", + "z": "aafb7d9f.f516f", + "name": "fan.py", + "func": "#!/usr/bin/python\nimport smbus\nimport sys\n\nstate = msg[\"payload\"]\n\nbus = smbus.SMBus(1)\n\nDEVICE_ADDRESS = 0x0d\n\nif state == \"off\":\n bus.write_byte_data(DEVICE_ADDRESS, 0x08, 0x00)\n bus.write_byte_data(DEVICE_ADDRESS, 0x08, 0x00)\nif state == \"on\":\n bus.write_byte_data(DEVICE_ADDRESS, 0x08, 0x01)\n bus.write_byte_data(DEVICE_ADDRESS, 0x08, 0x01)", + "outputs": 1, + "x": 1290, + "y": 140, + "wires": [ + [] + ] + }, + { + "id": "8f6f6c48.fe30c", + "type": "switch", + "z": "aafb7d9f.f516f", + "name": "", + "property": "payload", + "propertyType": "msg", + "rules": [ + { + "t": "gt", + "v": "45", + "vt": "num" + }, + { + "t": "lte", + "v": "40", + "vt": "num" + } + ], + "checkall": "true", + "repair": false, + "outputs": 2, + "x": 950, + "y": 140, + "wires": [ + [ + "916264f4.1b31f" + ], + [ + "743c04f5.97e51c" + ] + ] + }, + { + "id": "743c04f5.97e51c", + "type": "change", + "z": "aafb7d9f.f516f", + "name": "", + "rules": [ + { + "t": "set", + "p": "payload", + "pt": "msg", + "to": "off", + "tot": "str" + } + ], + "action": "", + "property": "", + "from": "", + "to": "", + "reg": false, + "x": 1120, + "y": 160, + "wires": [ + [ + "602add74.9aa2a4" + ] + ] + }, + { + "id": "9f9c97d.42b1768", + "type": "inject", + "z": "aafb7d9f.f516f", + "name": "", + "repeat": "5", + "crontab": "", + "once": false, + "onceDelay": "", + "topic": "", + "payload": "", + "payloadType": "date", + "x": 190, + "y": 180, + "wires": [ + [ + "2d899302.9bc384", + "e0f99dcc.c0257", + "c35a43a5.f0d1e8" + ] + ] + }, + { + "id": "2d899302.9bc384", + "type": "exec", + "z": "aafb7d9f.f516f", + "command": "top -d 0.5 -b -n2 | grep \"Cpu(s)\"|tail -n 1 | awk '{print $2 + $4}' | tr -d \"\\n\"", + "addpay": false, + "append": "", + "useSpawn": "", + "timer": "", + "name": "CPU Load", + "x": 410, + "y": 260, + "wires": [ + [ + "35e3cb5a.debb74", + "84d67d53.6001e" + ], + [], + [] + ] + }, + { + "id": "e0f99dcc.c0257", + "type": "exec", + "z": "aafb7d9f.f516f", + "command": "free | grep Mem | awk '{print 100*($4+$6+$7)/$2}' | awk -F \".\" '{print $1}' | tr -d \"\\n\"", + "addpay": false, + "append": "", + "useSpawn": "", + "timer": "", + "name": "Free Memory", + "x": 410, + "y": 340, + "wires": [ + [ + "f86fc2d5.49c258", + "cf879f92.12d6b" + ], + [], + [] + ] + }, + { + "id": "35e3cb5a.debb74", + "type": "ui_gauge", + "z": "aafb7d9f.f516f", + "name": "CPU Load Donut", + "group": "7a723961.386be", + "order": 5, + "width": 5, + "height": 4, + "gtype": "donut", + "title": "CPU Load Donut", + "label": "CPU", + "format": "{{value}}", + "min": 0, + "max": "100", + "colors": [ + "#00b500", + "#e6e600", + "#ca3838" + ], + "seg1": "", + "seg2": "", + "x": 650, + "y": 240, + "wires": [] + }, + { + "id": "f86fc2d5.49c258", + "type": "ui_gauge", + "z": "aafb7d9f.f516f", + "name": "Free memory Donut", + "group": "7a723961.386be", + "order": 9, + "width": 5, + "height": 4, + "gtype": "donut", + "title": "Free memory Donut", + "label": "RAM", + "format": "{{value}}", + "min": 0, + "max": "200", + "colors": [ + "#00b500", + "#e6e600", + "#ca3838" + ], + "seg1": "", + "seg2": "", + "x": 660, + "y": 320, + "wires": [] + }, + { + "id": "91eb9ad.4dbb5e8", + "type": "exec", + "z": "aafb7d9f.f516f", + "command": "df -h | grep /dev/root | awk -F ' ' '{print $3}' | tr -d G | tr \"\\n$\" \"\\ \" | sed 's/,/./' | tr -d \" \" ", + "addpay": false, + "append": "", + "useSpawn": "", + "timer": "", + "name": "Disk Usage", + "x": 410, + "y": 420, + "wires": [ + [ + "7653ee80.f1f07", + "8ae4d547.d3bb98" + ], + [], + [] + ] + }, + { + "id": "7653ee80.f1f07", + "type": "ui_gauge", + "z": "aafb7d9f.f516f", + "name": "Disk Usage Donut", + "group": "7a723961.386be", + "order": 3, + "width": 5, + "height": 4, + "gtype": "donut", + "title": "Disk Usage Donut", + "label": "Go", + "format": "{{value}}", + "min": 0, + "max": "256", + "colors": [ + "#00b500", + "#e6e600", + "#ca3838" + ], + "seg1": "", + "seg2": "", + "x": 650, + "y": 400, + "wires": [] + }, + { + "id": "84d67d53.6001e", + "type": "ui_chart", + "z": "aafb7d9f.f516f", + "name": "CPU Load Chart", + "group": "7a723961.386be", + "order": 6, + "width": 19, + "height": 4, + "label": "CPU Load Chart", + "chartType": "line", + "legend": "false", + "xformat": "HH:mm:ss", + "interpolate": "linear", + "nodata": "", + "dot": false, + "ymin": "", + "ymax": "", + "removeOlder": "20", + "removeOlderPoints": "", + "removeOlderUnit": "60", + "cutout": 0, + "useOneColor": false, + "colors": [ + "#1f77b4", + "#aec7e8", + "#ff7f0e", + "#2ca02c", + "#98df8a", + "#d62728", + "#ff9896", + "#9467bd", + "#c5b0d5" + ], + "useOldStyle": true, + "outputs": 1, + "x": 640, + "y": 280, + "wires": [ + [] + ] + }, + { + "id": "cf879f92.12d6b", + "type": "ui_chart", + "z": "aafb7d9f.f516f", + "name": "Free memory Chart", + "group": "7a723961.386be", + "order": 10, + "width": 19, + "height": 4, + "label": "Free memory Chart", + "chartType": "line", + "legend": "false", + "xformat": "HH:mm:ss", + "interpolate": "linear", + "nodata": "", + "dot": false, + "ymin": "", + "ymax": "", + "removeOlder": "20", + "removeOlderPoints": "", + "removeOlderUnit": "60", + "cutout": 0, + "useOneColor": false, + "colors": [ + "#1f77b4", + "#aec7e8", + "#ff7f0e", + "#2ca02c", + "#98df8a", + "#d62728", + "#ff9896", + "#9467bd", + "#c5b0d5" + ], + "useOldStyle": true, + "outputs": 1, + "x": 650, + "y": 360, + "wires": [ + [] + ] + }, + { + "id": "22b3544f.b649bc", + "type": "inject", + "z": "aafb7d9f.f516f", + "name": "", + "repeat": "60", + "crontab": "", + "once": false, + "onceDelay": "", + "topic": "", + "payload": "", + "payloadType": "date", + "x": 190, + "y": 420, + "wires": [ + [ + "91eb9ad.4dbb5e8" + ] + ] + }, + { + "id": "8ae4d547.d3bb98", + "type": "ui_chart", + "z": "aafb7d9f.f516f", + "name": "Disk Usage Chart", + "group": "7a723961.386be", + "order": 4, + "width": 19, + "height": 4, + "label": "Disk Usage Chart", + "chartType": "line", + "legend": "false", + "xformat": "HH:mm:ss", + "interpolate": "linear", + "nodata": "", + "dot": false, + "ymin": "", + "ymax": "", + "removeOlder": "20", + "removeOlderPoints": "", + "removeOlderUnit": "60", + "cutout": 0, + "useOneColor": false, + "colors": [ + "#1f77b4", + "#aec7e8", + "#ff7f0e", + "#2ca02c", + "#98df8a", + "#d62728", + "#ff9896", + "#9467bd", + "#c5b0d5" + ], + "useOldStyle": true, + "outputs": 1, + "x": 650, + "y": 440, + "wires": [ + [] + ] + }, + { + "id": "916264f4.1b31f", + "type": "change", + "z": "aafb7d9f.f516f", + "name": "", + "rules": [ + { + "t": "set", + "p": "payload", + "pt": "msg", + "to": "on", + "tot": "str" + } + ], + "action": "", + "property": "", + "from": "", + "to": "", + "reg": false, + "x": 1120, + "y": 120, + "wires": [ + [ + "602add74.9aa2a4" + ] + ] + }, + { + "id": "a06de215.74a87", + "type": "ui_button", + "z": "3f0fd072.06e2c8", + "name": "", + "group": "3bd8d121.499b96", + "order": 2, + "width": 16, + "height": 1, "passthru": false, "label": "Start Acquisition", "tooltip": "", @@ -32,31 +1353,31 @@ "y": 100, "wires": [ [ - "b854ad48.5869e8" + "d6238ee1.db955" ] ] }, { - "id": "b854ad48.5869e8", + "id": "d6238ee1.db955", "type": "function", - "z": "97600dff.93378", + "z": "3f0fd072.06e2c8", "name": "image.js", - "func": "state = global.get(\"state\");\nglobal.set('img_counter',0)\nglobal.set('obj_counter',0)\nif (state == null){state=\"free\"}\n\nvar sleep_before= global.get(\"custom_sleep_before\");\nvar nb_step= global.get(\"custom_nb_step\");\nvar nb_frame= global.get(\"custom_nb_frame\");\nvar segmentation= global.get(\"custom_segmentation\");\n\nif (sleep_before === undefined || sleep_before === \"\" || sleep_before === null) {\n msg.topic = \"Missing entry :\"\n msg.payload = \"Duration before the acquisition\";\n \n}else if (nb_step === undefined || nb_step === \"\" || nb_step === null) {\n msg.topic = \"Missing entry :\"\n msg.payload = \"Number of step in between two frames\";\n \n}else if (nb_frame === undefined || nb_frame === \"\" || nb_frame === null) {\n msg.topic = \"Missing entry :\"\n msg.payload = \"Number of image to save\";\n \n}else if (segmentation === undefined || segmentation === \"\" || segmentation === null) {\n msg.topic = \"Missing entry :\"\n msg.payload = \"Realize or not the segmentation\";\n \n}else {\n nb_frame=nb_frame-1\n \n msg.payload=sleep_before+' '+nb_step+' '+nb_frame+' '+segmentation;\n}\nreturn msg;", + "func": "state = global.get(\"state\");\nglobal.set('img_counter',0)\nglobal.set('obj_counter',0)\nif (state == null){state=\"free\"}\n\nvar sleep_before= global.get(\"custom_sleep_before\");\nvar nb_step= global.get(\"custom_nb_step\");\nvar nb_frame= global.get(\"custom_nb_frame\");\n\nif (sleep_before === undefined || sleep_before === \"\" || sleep_before === null) {\n msg.topic = \"Missing entry :\"\n msg.payload = \"Duration before the acquisition\";\n \n}else if (nb_step === undefined || nb_step === \"\" || nb_step === null) {\n msg.topic = \"Missing entry :\"\n msg.payload = \"Number of step in between two frames\";\n \n}else if (nb_frame === undefined || nb_frame === \"\" || nb_frame === null) {\n msg.topic = \"Missing entry :\"\n msg.payload = \"Number of image to save\";\n \n}else {\n nb_frame=nb_frame-1\n \n msg.payload=sleep_before+' '+nb_step+' '+nb_frame;\n}\nreturn msg;", "outputs": 1, "noerr": 0, "x": 360, "y": 100, "wires": [ [ - "84505b75.883a48" + "40b06bd3.39ae74" ] ], "info": "### Focusing\n##### focus.py `nb_step` `orientation`\n\n- `nb_step` : **integer** (from 1 to 100000) - number of step to perform by the stage (about 31um/step)\n- `orientation` : **string** - orientation of the focus either `up` or `down`\n\nExample:\n\n python3.7 $HOME/PlanktonScope/scripts/focus.py 650 up\n" }, { - "id": "84505b75.883a48", + "id": "40b06bd3.39ae74", "type": "switch", - "z": "97600dff.93378", + "z": "3f0fd072.06e2c8", "name": "", "property": "topic", "propertyType": "msg", @@ -79,17 +1400,17 @@ "y": 100, "wires": [ [ - "715a8f15.dc211" + "9c6b9e61.7436" ], [ - "3173806b.bb0c7" + "f8f02776.e0e178" ] ] }, { - "id": "3173806b.bb0c7", + "id": "f8f02776.e0e178", "type": "ui_toast", - "z": "97600dff.93378", + "z": "3f0fd072.06e2c8", "position": "dialog", "displayTime": "3", "highlight": "", @@ -107,27 +1428,27 @@ ] }, { - "id": "715a8f15.dc211", + "id": "9c6b9e61.7436", "type": "mqtt out", - "z": "97600dff.93378", + "z": "3f0fd072.06e2c8", "name": "", "topic": "", "qos": "", "retain": "", - "broker": "e8ab36cc.74d77", + "broker": "e6efd12e.dedae8", "x": 670, "y": 80, "wires": [] }, { - "id": "ed689faa.3a3e08", + "id": "6ff281cf.69e9e8", "type": "ui_button", - "z": "97600dff.93378", + "z": "3f0fd072.06e2c8", "name": "Stop Acquisition", - "group": "cdb72118.692578", - "order": 2, - "width": 0, - "height": 0, + "group": "3bd8d121.499b96", + "order": 1, + "width": 8, + "height": 1, "passthru": true, "label": "STOP ACQUISITION", "tooltip": "", @@ -141,75 +1462,27 @@ "y": 140, "wires": [ [ - "f6bd3440.60d5a" + "c2451eaf.eedc1" ] ] }, { - "id": "f6bd3440.60d5a", + "id": "c2451eaf.eedc1", "type": "mqtt out", - "z": "97600dff.93378", + "z": "3f0fd072.06e2c8", "name": "", "topic": "", "qos": "", "retain": "", - "broker": "e8ab36cc.74d77", + "broker": "e6efd12e.dedae8", "x": 350, "y": 140, "wires": [] }, { - "id": "3b827bf5.c7bc64", - "type": "mqtt out", - "z": "97600dff.93378", - "name": "", - "topic": "", - "qos": "", - "retain": "", - "broker": "e8ab36cc.74d77", - "x": 350, - "y": 180, - "wires": [] - }, - { - "id": "cdb72118.692578", - "type": "ui_group", - "z": "", - "name": "Acquisition actuation", - "tab": "2b97fe34.a699fa", - "order": 10, - "disp": true, - "width": 24, - "collapse": false - }, - { - "id": "e8320d42.9a3ad8", - "type": "subflow", - "name": "MQQT Cmds", - "info": "", - "category": "", - "in": [ - { - "x": 40, - "y": 40, - "wires": [ - { - "id": "cf9e02a2.3feff" - }, - { - "id": "18da28e6.7b000f" - } - ] - } - ], - "out": [], - "env": [], - "color": "#DDAA99" - }, - { - "id": "a7301ba5.d56d48", + "id": "e972dce3.84be7", "type": "exec", - "z": "e8320d42.9a3ad8", + "z": "435c6174.e0c8b", "command": "python3.7 /home/pi/PlanktonScope/script/main.py", "addpay": false, "append": "", @@ -217,146 +1490,18 @@ "timer": "", "oldrc": false, "name": "", - "x": 910, - "y": 140, + "x": 890, + "y": 120, "wires": [ - [ - "87558394.4e589", - "a11158b1.b7649" - ], - [ - "87558394.4e589", - "a11158b1.b7649" - ], - [ - "87558394.4e589", - "a11158b1.b7649" - ] - ] - }, - { - "id": "62b9a3b1.74dbc4", - "type": "exec", - "z": "e8320d42.9a3ad8", - "command": "ps -ax | grep \"python3.7 /home/pi/PlanktonScope/script/main.py\"| head -1 | awk -F \" \" '{print$1}' ", - "addpay": false, - "append": "", - "useSpawn": "false", - "timer": "", - "oldrc": false, - "name": "", - "x": 610, - "y": 200, - "wires": [ - [ - "66fb9ed2.8ecd3" - ], + [], [], [] ] }, { - "id": "66fb9ed2.8ecd3", - "type": "exec", - "z": "e8320d42.9a3ad8", - "command": "kill", - "addpay": true, - "append": "", - "useSpawn": "false", - "timer": "", - "oldrc": false, - "name": "", - "x": 1050, - "y": 200, - "wires": [ - [ - "87558394.4e589", - "a11158b1.b7649" - ], - [ - "87558394.4e589", - "a11158b1.b7649" - ], - [ - "87558394.4e589", - "a11158b1.b7649" - ] - ] - }, - { - "id": "5df162d7.08eb34", - "type": "ui_button", - "z": "e8320d42.9a3ad8", - "name": "", - "group": "9c86b3b7.54841", - "order": 9, - "width": 12, - "height": 1, - "passthru": false, - "label": "Kill MQTT", - "tooltip": "", - "color": "", - "bgcolor": "", - "icon": "", - "payload": "", - "payloadType": "str", - "topic": "", - "x": 80, - "y": 200, - "wires": [ - [ - "62b9a3b1.74dbc4" - ] - ] - }, - { - "id": "d16389e5.3bc67", - "type": "ui_button", - "z": "e8320d42.9a3ad8", - "name": "", - "group": "9c86b3b7.54841", - "order": 10, - "width": 12, - "height": 1, - "passthru": false, - "label": "Restart MQTT", - "tooltip": "", - "color": "", - "bgcolor": "", - "icon": "", - "payload": "", - "payloadType": "str", - "topic": "", - "x": 100, - "y": 140, - "wires": [ - [ - "a7301ba5.d56d48" - ] - ] - }, - { - "id": "87558394.4e589", - "type": "ui_toast", - "z": "e8320d42.9a3ad8", - "position": "top right", - "displayTime": "3", - "highlight": "", - "sendall": true, - "outputs": 0, - "ok": "OK", - "cancel": "", - "raw": false, - "topic": "", - "name": "", - "x": 1260, - "y": 140, - "wires": [] - }, - { - "id": "500abffa.c7a788", + "id": "fd813497.f44d5", "type": "file", - "z": "e8320d42.9a3ad8", + "z": "435c6174.e0c8b", "name": "", "filename": "/home/pi/PlanktonScope/script/main.py", "appendNewline": false, @@ -367,48 +1512,33 @@ "y": 100, "wires": [ [ - "a7301ba5.d56d48" + "e972dce3.84be7" ] ] }, { - "id": "985c65de.0801b", + "id": "a2e43b6f.3b73a", "type": "template", - "z": "e8320d42.9a3ad8", + "z": "435c6174.e0c8b", "name": "main.py", "field": "payload", "fieldType": "msg", "format": "python", "syntax": "plain", - "template": "################################################################################\n#Actuator Libraries\n################################################################################\n\n#Library for exchaning messages with Node-RED\nimport paho.mqtt.client as mqtt\n\n#Library to control the PiCamera\nfrom picamera import PiCamera\n\n#Libraries to control the steppers for focusing and pumping\nfrom adafruit_motor import stepper\nfrom adafruit_motorkit import MotorKit\n\n#Library to send command over I2C for the light module on the fan\nimport smbus\n\n################################################################################\n#Practical Libraries\n################################################################################\n\n#Library to get date and time for folder name and filename\nfrom datetime import datetime, timedelta\n\n#Library to be able to sleep for a duration\nfrom time import sleep\n\n#Libraries manipulate json format, execute bash commands\nimport json, shutil, os, subprocess\n\n################################################################################\n#Morphocut Libraries\n################################################################################\n\nfrom skimage.util import img_as_ubyte\nfrom morphocut import Call\nfrom morphocut.contrib.ecotaxa import EcotaxaWriter\nfrom morphocut.contrib.zooprocess import CalculateZooProcessFeatures\nfrom morphocut.core import Pipeline\nfrom morphocut.file import Find\nfrom morphocut.image import (ExtractROI,\n FindRegions,\n ImageReader,\n ImageWriter,\n RescaleIntensity,\n RGB2Gray\n)\nfrom morphocut.stat import RunningMedian\nfrom morphocut.str import Format\nfrom morphocut.stream import TQDM, Enumerate, FilterVariables\n\n################################################################################\n#Other image processing Libraries\n################################################################################\n\nfrom skimage.feature import canny\nfrom skimage.color import rgb2gray, label2rgb\nfrom skimage.morphology import disk\nfrom skimage.morphology import erosion, dilation, closing\nfrom skimage.measure import label, regionprops\nimport cv2\n\n################################################################################\n#Streaming PiCamera over server\n################################################################################\nimport io\nimport picamera\nimport logging\nimport socketserver\nfrom threading import Condition\nfrom http import server\nimport threading\n\n################################################################################\n#Creation of the webpage containing the PiCamera Streaming\n################################################################################\n\nPAGE=\"\"\"\\\n\n\nPlanktonScope v2 | PiCamera Streaming\n\n\n\n\n\n\"\"\"\n\n################################################################################\n#Classes for the PiCamera Streaming\n################################################################################\n\nclass StreamingOutput(object):\n def __init__(self):\n self.frame = None\n self.buffer = io.BytesIO()\n self.condition = Condition()\n\n def write(self, buf):\n if buf.startswith(b'\\xff\\xd8'):\n # New frame, copy the existing buffer's content and notify all\n # clients it's available\n self.buffer.truncate()\n with self.condition:\n self.frame = self.buffer.getvalue()\n self.condition.notify_all()\n self.buffer.seek(0)\n return self.buffer.write(buf)\n\nclass StreamingHandler(server.BaseHTTPRequestHandler):\n def do_GET(self):\n if self.path == '/':\n self.send_response(301)\n self.send_header('Location', '/index.html')\n self.end_headers()\n elif self.path == '/index.html':\n content = PAGE.encode('utf-8')\n self.send_response(200)\n self.send_header('Content-Type', 'text/html')\n self.send_header('Content-Length', len(content))\n self.end_headers()\n self.wfile.write(content)\n elif self.path == '/stream.mjpg':\n self.send_response(200)\n self.send_header('Age', 0)\n self.send_header('Cache-Control', 'no-cache, private')\n self.send_header('Pragma', 'no-cache')\n self.send_header('Content-Type', 'multipart/x-mixed-replace; boundary=FRAME')\n self.end_headers()\n try:\n while True:\n with output.condition:\n output.condition.wait()\n frame = output.frame\n self.wfile.write(b'--FRAME\\r\\n')\n self.send_header('Content-Type', 'image/jpeg')\n self.send_header('Content-Length', len(frame))\n self.end_headers()\n self.wfile.write(frame)\n self.wfile.write(b'\\r\\n')\n except Exception as e:\n logging.warning(\n 'Removed streaming client %s: %s',\n self.client_address, str(e))\n else:\n self.send_error(404)\n self.end_headers()\n\nclass StreamingServer(socketserver.ThreadingMixIn, server.HTTPServer):\n allow_reuse_address = True\n daemon_threads = True\n\n################################################################################\n#MQTT core functions\n################################################################################\n\n#Run this function in order to connect to the client (Node-RED)\ndef on_connect(client, userdata, flags, rc):\n #Print when connected\n print(\"Connected! - \" + str(rc))\n #When connected, run subscribe()\n client.subscribe(\"actuator/#\")\n #Turn green the light module\n rgb(0,255,0)\n\n#Run this function in order to subscribe to all the topics begining by actuator\ndef on_subscribe(client, obj, mid, granted_qos):\n #Print when subscribed\n print(\"Subscribed! - \"+str(mid)+\" \"+str(granted_qos))\n\n#Run this command when Node-RED is sending a message on the subscribed topic\ndef on_message(client, userdata, msg):\n #Print the topic and the message\n print(msg.topic+\" \"+str(msg.qos)+\" \"+str(msg.payload))\n #Update the global variables command, args and counter\n global command\n global args\n global counter\n #Parse the topic to find the command. ex : actuator/pump -> pump\n command=msg.topic.split(\"/\")[1]\n #Decode the message to find the arguments\n args=str(msg.payload.decode())\n #Reset the counter to 0\n counter=0\n\n################################################################################\n#LEDs Actuation\n################################################################################\ndef rgb(R,G,B):\n #Update LED n1\n bus.write_byte_data(0x0d, 0x00, 0)\n bus.write_byte_data(0x0d, 0x01, R)\n bus.write_byte_data(0x0d, 0x02, G)\n bus.write_byte_data(0x0d, 0x03, B)\n\n #Update LED n2\n bus.write_byte_data(0x0d, 0x00, 1)\n bus.write_byte_data(0x0d, 0x01, R)\n bus.write_byte_data(0x0d, 0x02, G)\n bus.write_byte_data(0x0d, 0x03, B)\n\n #Update LED n3\n bus.write_byte_data(0x0d, 0x00, 2)\n bus.write_byte_data(0x0d, 0x01, R)\n bus.write_byte_data(0x0d, 0x02, G)\n bus.write_byte_data(0x0d, 0x03, B)\n\n #Update the I2C Bus in order to really update the LEDs new values\n cmd=\"i2cdetect -y 1\"\n subprocess.Popen(cmd.split(),stdout=subprocess.PIPE)\n\n################################################################################\n#Init function - executed only once\n################################################################################\n\n#define the bus used to actuate the light module on the fan\nbus = smbus.SMBus(1)\n\n#define the names for the 2 exsting steppers\nkit = MotorKit()\npump_stepper = kit.stepper1\nfocus_stepper = kit.stepper2\n#Make sure the steppers are release and do not use any power\npump_stepper.release()\nfocus_stepper.release()\n\n#Precise the settings of the PiCamera\ncamera = PiCamera()\ncamera.resolution = (3280, 2464)\ncamera.iso = 60\ncamera.shutter_speed = 500\ncamera.exposure_mode = 'fixedfps'\n\n#Declare the global variables command, args and counter\ncommand = ''\nargs = ''\ncounter=''\n\n#MQTT Client functions definition\nclient = mqtt.Client()\nclient.connect(\"192.168.4.1\",1883,60)\nclient.on_connect = on_connect\nclient.on_subscribe = on_subscribe\nclient.on_message = on_message\nclient.loop_start()\n\n################################################################################\n#Definition of the few important metadata\n################################################################################\n\nlocal_metadata = {\n \"process_datetime\": datetime.now(),\n \"acq_camera_resolution\" : camera.resolution,\n \"acq_camera_iso\" : camera.iso,\n \"acq_camera_shutter_speed\" : camera.shutter_speed\n}\n\n#Read the content of config.json containing the metadata defined on Node-RED\nconfig_json = open('/home/pi/PlanktonScope/config.json','r')\nnode_red_metadata = json.loads(config_json.read())\n\n#Concat the local metadata and the metadata from Node-RED\nglobal_metadata = {**local_metadata, **node_red_metadata}\n\n#Define the name of the .zip file that will contain the images and the .tsv table for EcoTaxa\narchive_fn = os.path.join(\"/home/pi/PlanktonScope/\",\"export\", \"ecotaxa_export.zip\")\n\n################################################################################\n#MorphoCut Script\n################################################################################\n\n#Define processing pipeline\nwith Pipeline() as p:\n\n #Recursively find .jpg files in import_path.\n #Sort to get consective frames.\n abs_path = Find(\"/home/pi/PlanktonScope/tmp\", [\".jpg\"], sort=True, verbose=True)\n\n #Extract name from abs_path\n name = Call(lambda p: os.path.splitext(os.path.basename(p))[0], abs_path)\n\n #Set the LEDs as Green\n Call(rgb, 0,255,0)\n\n #Read image\n img = ImageReader(abs_path)\n\n #Show progress bar for frames\n TQDM(Format(\"Frame {name}\", name=name))\n\n #Apply running median to approximate the background image\n flat_field = RunningMedian(img, 5)\n\n #Correct image\n img = img / flat_field\n\n #Rescale intensities and convert to uint8 to speed up calculations\n img = RescaleIntensity(img, in_range=(0, 1.1), dtype=\"uint8\")\n\n #Filter variable to reduce memory load\n FilterVariables(name,img)\n\n #Save cleaned images\n #frame_fn = Format(os.path.join(\"/home/pi/PlanktonScope/tmp\",\"CLEAN\", \"{name}.jpg\"), name=name)\n #ImageWriter(frame_fn, img)\n\n #Convert image to uint8 gray\n img_gray = RGB2Gray(img)\n\n #?\n img_gray = Call(img_as_ubyte, img_gray)\n\n #Canny edge detection using OpenCV\n img_canny = Call(cv2.Canny, img_gray, 50,100)\n\n #Dilate using OpenCV\n kernel = Call(cv2.getStructuringElement, cv2.MORPH_ELLIPSE, (15, 15))\n img_dilate = Call(cv2.dilate, img_canny, kernel, iterations=2)\n\n #Close using OpenCV\n kernel = Call(cv2.getStructuringElement, cv2.MORPH_ELLIPSE, (5, 5))\n img_close = Call(cv2.morphologyEx, img_dilate, cv2.MORPH_CLOSE, kernel, iterations=1)\n\n #Erode using OpenCV\n kernel = Call(cv2.getStructuringElement, cv2.MORPH_ELLIPSE, (15, 15))\n mask = Call(cv2.erode, img_close, kernel, iterations=2)\n\n #Find objects\n regionprops = FindRegions(\n mask, img_gray, min_area=1000, padding=10, warn_empty=name\n )\n\n #Set the LEDs as Purple\n Call(rgb, 255,0,255)\n\n # For an object, extract a vignette/ROI from the image\n roi_orig = ExtractROI(img, regionprops, bg_color=255)\n\n # Generate an object identifier\n i = Enumerate()\n\n #Call(print,i)\n\n #Define the ID of each object\n object_id = Format(\"{name}_{i:d}\", name=name, i=i)\n\n #Call(print,object_id)\n\n #Define the name of each object\n object_fn = Format(os.path.join(\"/home/pi/PlanktonScope/\",\"OBJECTS\", \"{name}.jpg\"), name=object_id)\n\n #Save the image of the object with its name\n ImageWriter(object_fn, roi_orig)\n\n #Calculate features. The calculated features are added to the global_metadata.\n #Returns a Variable representing a dict for every object in the stream.\n meta = CalculateZooProcessFeatures(\n regionprops, prefix=\"object_\", meta=global_metadata\n )\n\n #Get all the metadata\n json_meta = Call(json.dumps,meta, sort_keys=True, default=str)\n\n #Publish the json containing all the metadata to via MQTT to Node-RED\n Call(client.publish, \"receiver/segmentation/metric\", json_meta)\n\n #Add object_id to the metadata dictionary\n meta[\"object_id\"] = object_id\n\n #Generate object filenames\n orig_fn = Format(\"{object_id}.jpg\", object_id=object_id)\n\n #Write objects to an EcoTaxa archive:\n #roi image in original color, roi image in grayscale, metadata associated with each object\n EcotaxaWriter(archive_fn, (orig_fn, roi_orig), meta)\n\n #Progress bar for objects\n TQDM(Format(\"Object {object_id}\", object_id=object_id))\n\n #Publish the object_id to via MQTT to Node-RED\n Call(client.publish, \"receiver/segmentation/object_id\", object_id)\n\n #Set the LEDs as Green\n Call(rgb, 0,255,0)\n\n################################################################################\n#While loop for capting commands from Node-RED\n################################################################################\n\noutput = StreamingOutput()\naddress = ('192.168.4.1', 8000)\nserver = StreamingServer(address, StreamingHandler)\nthreading.Thread(target=server.serve_forever).start()\ncamera.start_recording(output, format='mjpeg', resize=(640, 480))\n\nwhile True:\n\n ############################################################################\n #Pump Event\n ############################################################################\n\n #If the command is \"pump\"\n if (command==\"pump\"):\n\n #Set the LEDs as Blue\n rgb(0,0,255)\n\n #Get direction from the different received arguments\n direction=args.split(\" \")[0]\n\n #Get delay (in between steps) from the different received arguments\n delay=float(args.split(\" \")[1])\n\n #Get number of steps from the different received arguments\n nb_step=int(args.split(\" \")[2])\n\n #Print status\n print(\"The pump has been started.\")\n\n #Publish the status \"Start\" to via MQTT to Node-RED\n client.publish(\"receiver/pump\", \"Start\");\n\n ########################################################################\n while True:\n\n #Depending on direction, select the right direction for the pump\n if direction == \"BACKWARD\":\n direction=stepper.BACKWARD\n\n if direction == \"FORWARD\":\n direction=stepper.FORWARD\n\n #Actuate the pump for one step in the right direction\n pump_stepper.onestep(direction=direction, style=stepper.DOUBLE)\n\n #Increment the counter\n counter+=1\n\n #Wait during the delay to pump at the right flowrate\n sleep(delay)\n\n ####################################################################\n #If counter reach the number of step, break\n if counter>nb_step:\n\n #Release the pump stepper to stop power draw\n pump_stepper.release()\n\n #Print status\n print(\"The pumping is done.\")\n\n #Change the command to not re-enter in this while loop\n command=\"wait\"\n\n #Publish the status \"Done\" to via MQTT to Node-RED\n client.publish(\"receiver/pump\", \"Done\");\n\n #Set the LEDs as Green\n rgb(0,255,0)\n\n #Reset the counter to 0\n counter=0\n\n break\n\n ####################################################################\n #If a new received command isn't \"pump\", break this while loop\n if command!=\"pump\":\n\n #Release the pump stepper to stop power draw\n pump_stepper.release()\n\n #Print status\n print(\"The pump has been interrompted.\")\n\n #Publish the status \"Interrompted\" to via MQTT to Node-RED\n client.publish(\"receiver/pump\", \"Interrompted\");\n\n #Set the LEDs as Green\n rgb(0,255,0)\n\n #Reset the counter to 0\n counter=0\n\n break\n\n ############################################################################\n #Focus Event\n ############################################################################\n\n #If the command is \"focus\"\n elif (command==\"focus\"):\n\n #Set the LEDs as Yellow\n rgb(255,255,0)\n\n #Get direction from the different received arguments\n direction=args.split(\" \")[0]\n\n #Get number of steps from the different received arguments\n nb_step=int(args.split(\" \")[1])\n\n #Print status\n print(\"The focus has been started.\")\n\n #Publish the status \"Start\" to via MQTT to Node-RED\n client.publish(\"receiver/focus\", \"Start\");\n\n ########################################################################\n while True:\n\n #Depending on direction, select the right direction for the focus\n if direction == \"FORWARD\":\n direction=stepper.FORWARD\n\n if direction == \"BACKWARD\":\n direction=stepper.BACKWARD\n\n #Actuate the focus for one microstep in the right direction\n focus_stepper.onestep(direction=direction, style=stepper.MICROSTEP)\n\n #Increment the counter\n counter+=1\n\n ####################################################################\n #If counter reach the number of step, break\n if counter>nb_step:\n\n #Release the focus steppers to stop power draw\n focus_stepper.release()\n\n #Print status\n print(\"The focusing is done.\")\n\n #Change the command to not re-enter in this while loop\n command=\"wait\"\n\n #Publish the status \"Done\" to via MQTT to Node-RED\n client.publish(\"receiver/focus\", \"Done\");\n\n #Set the LEDs as Green\n rgb(0,255,0)\n\n #Reset the counter to 0\n counter=0\n\n break\n\n ####################################################################\n #If a new received command isn't \"pump\", break this while loop\n if command!=\"focus\":\n\n #Release the focus steppers to stop power draw\n focus_stepper.release()\n\n #Print status\n print(\"The stage has been interrompted.\")\n\n #Publish the status \"Done\" to via MQTT to Node-RED\n client.publish(\"receiver/focus\", \"Interrompted\");\n\n #Set the LEDs as Green\n rgb(0,255,0)\n\n #Reset the counter to 0\n counter=0\n\n break\n\n ############################################################################\n #Image Event\n ############################################################################\n\n elif (command==\"image\"):\n \n #Publish the status \"Start\" to via MQTT to Node-RED\n client.publish(\"receiver/image\", \"Will do my best dude\");\n\n #Get duration to wait before an image from the different received arguments\n sleep_before=int(args.split(\" \")[0])\n\n #Get number of step in between two images from the different received arguments\n nb_step=int(args.split(\" \")[1])\n\n #Get the number of frames to image from the different received arguments\n nb_frame=int(args.split(\" \")[2])\n\n #Get the segmentation status (true/false) from the different received arguments\n segmentation=str(args.split(\" \")[3])\n\n #Sleep a duration before to start acquisition\n sleep(sleep_before)\n\n #Publish the status \"Start\" to via MQTT to Node-RED\n client.publish(\"receiver/image\", \"Start\");\n\n #Set the LEDs as Blue\n rgb(0,0,255)\n\n #Pump duing a given number of steps (in between each image)\n for i in range(nb_step):\n\n #If the command is still image - pump a defined nb of steps\n if (command==\"image\"):\n\n #Actuate the pump for one step in the FORWARD direction\n pump_stepper.onestep(direction=stepper.FORWARD, style=stepper.DOUBLE)\n\n #The flowrate is fixed for now.\n sleep(0.01)\n\n #If the command isn't image anymore - break\n else:\n\n break\n\n #Set the LEDs as Green\n rgb(0,255,0)\n\n while True:\n\n #Set the LEDs as Cyan\n rgb(0,255,255)\n\n #Increment the counter\n counter+=1\n\n #Get datetime\n datetime_tmp=datetime.now().strftime(\"%H_%M_%S_%f\")\n\n #Print datetime\n print(datetime_tmp)\n\n #Define the filename of the image\n filename = os.path.join(\"/home/pi/PlanktonScope/tmp\",datetime_tmp+\".jpg\")\n\n #Capture an image with the proper filename\n camera.capture(filename)\n\n #Set the LEDs as Green\n rgb(0,255,0)\n\n #Publish the name of the image to via MQTT to Node-RED\n\n client.publish(\"receiver/image\", datetime_tmp+\".jpg has been imaged.\");\n \n #Set the LEDs as Blue\n rgb(0,0,255)\n\n #Pump during a given nb of steps\n for i in range(nb_step):\n\n #Actuate the pump for one step in the FORWARD direction\n pump_stepper.onestep(direction=stepper.FORWARD, style=stepper.DOUBLE)\n\n #The flowrate is fixed for now.\n sleep(0.01)\n\n #Wait a fixed delay which set the framerate as < than 2 imag/sec\n sleep(0.5)\n\n #Set the LEDs as Green\n rgb(0,255,0)\n\n ####################################################################\n #If counter reach the number of frame, break\n if(counter>nb_frame):\n\n #Publish the status \"Completed\" to via MQTT to Node-RED\n client.publish(\"receiver/image\", \"Completed\");\n\n #Release the pump steppers to stop power draw\n pump_stepper.release()\n\n if(segmentation == \"True\"):\n\n #Publish the status \"Start\" to via MQTT to Node-RED\n client.publish(\"receiver/segmentation\", \"Start\");\n\n #Start the MorphoCut Pipeline\n p.run()\n\n #remove directory\n #shutil.rmtree(import_path)\n\n #Publish the status \"Completed\" to via MQTT to Node-RED\n client.publish(\"receiver/segmentation\", \"Completed\");\n\n #Set the LEDs as White\n rgb(255,255,255)\n\n #cmd = os.popen(\"rm -rf /home/pi/PlanktonScope/tmp/*.jpg\")\n\n #Let it happen\n sleep(1)\n\n #Set the LEDs as Green\n rgb(0,255,0)\n\n #End if(segmentation == \"True\"):\n\n #Change the command to not re-enter in this while loop\n command=\"wait\"\n \n #Set the LEDs as Green\n rgb(0,255,255)\n\n #Reset the counter to 0\n counter=0\n\n break\n\n ####################################################################\n #If a new received command isn't \"image\", break this while loop\n if command!=\"image\":\n\n #Release the pump steppers to stop power draw\n pump_stepper.release()\n\n #Print status\n print(\"The imaging has been interrompted.\")\n\n #Publish the status \"Interrompted\" to via MQTT to Node-RED\n client.publish(\"receiver/image\", \"Interrompted\");\n\n #Set the LEDs as Green\n rgb(0,255,0)\n\n #Reset the counter to 0\n counter=0\n\n break\n\n else:\n #Set the LEDs as Black\n rgb(0,0,0)\n #Its just waiting to receive command from Node-RED\n sleep(1)\n #Set the LEDs as White\n rgb(255,255,255)\n #Its just waiting to receive command from Node-RED\n sleep(1)\n", + "template": "#Library to send command over I2C for the light module on the fan and subprocess to run bash command\nimport smbus, subprocess\n################################################################################\n#LEDs Actuation\n################################################################################\n\n#define the bus used to actuate the light module on the fan\nbus = smbus.SMBus(1)\n\ndef rgb(R,G,B):\n #Update LED n1\n bus.write_byte_data(0x0d, 0x00, 0)\n bus.write_byte_data(0x0d, 0x01, R)\n bus.write_byte_data(0x0d, 0x02, G)\n bus.write_byte_data(0x0d, 0x03, B)\n\n #Update LED n2\n bus.write_byte_data(0x0d, 0x00, 1)\n bus.write_byte_data(0x0d, 0x01, R)\n bus.write_byte_data(0x0d, 0x02, G)\n bus.write_byte_data(0x0d, 0x03, B)\n\n #Update LED n3\n bus.write_byte_data(0x0d, 0x00, 2)\n bus.write_byte_data(0x0d, 0x01, R)\n bus.write_byte_data(0x0d, 0x02, G)\n bus.write_byte_data(0x0d, 0x03, B)\n\n #Update the I2C Bus in order to really update the LEDs new values\n cmd=\"i2cdetect -y 1\"\n subprocess.Popen(cmd.split(),stdout=subprocess.PIPE)\n \n#Present the RED color\nrgb(255,0,0)\n\n################################################################################\n#Actuator Libraries\n################################################################################\n\n#Library for exchaning messages with Node-RED\nimport paho.mqtt.client as mqtt\n\n#Library to control the PiCamera\nfrom picamera import PiCamera\n\n#Libraries to control the steppers for focusing and pumping\nfrom adafruit_motor import stepper\nfrom adafruit_motorkit import MotorKit\n\n################################################################################\n#Practical Libraries\n################################################################################\n\n#Library to get date and time for folder name and filename\nfrom datetime import datetime, timedelta\n\n#Library to be able to sleep for a duration\nfrom time import sleep\n\n#Libraries manipulate json format, execute bash commands\nimport json, shutil, os\n\n################################################################################\n#Morphocut Libraries\n################################################################################\n\nfrom skimage.util import img_as_ubyte\nfrom morphocut import Call\nfrom morphocut.contrib.ecotaxa import EcotaxaWriter\nfrom morphocut.contrib.zooprocess import CalculateZooProcessFeatures\nfrom morphocut.core import Pipeline\nfrom morphocut.file import Find\nfrom morphocut.image import (ExtractROI,\n FindRegions,\n ImageReader,\n ImageWriter,\n RescaleIntensity,\n RGB2Gray\n)\nfrom morphocut.stat import RunningMedian\nfrom morphocut.str import Format\nfrom morphocut.stream import TQDM, Enumerate, FilterVariables\n\n################################################################################\n#Other image processing Libraries\n################################################################################\n\nfrom skimage.feature import canny\nfrom skimage.color import rgb2gray, label2rgb\nfrom skimage.morphology import disk\nfrom skimage.morphology import erosion, dilation, closing\nfrom skimage.measure import label, regionprops\nimport cv2\n\n################################################################################\n#Streaming PiCamera over server\n################################################################################\nimport io\nimport picamera\nimport logging\nimport socketserver\nfrom threading import Condition\nfrom http import server\nimport threading\n\n################################################################################\n#Get possibility to generate random numbers\n################################################################################\n# generate random integer values\nfrom random import seed\nfrom random import randint\n\n\n\n################################################################################\n#Creation of the webpage containing the PiCamera Streaming\n################################################################################\n\nPAGE=\"\"\"\\\n\n\nPlanktonScope v2 | PiCamera Streaming\n\n\n\n\n\n\"\"\"\n\n################################################################################\n#Classes for the PiCamera Streaming\n################################################################################\n\nclass StreamingOutput(object):\n def __init__(self):\n self.frame = None\n self.buffer = io.BytesIO()\n self.condition = Condition()\n\n def write(self, buf):\n if buf.startswith(b'\\xff\\xd8'):\n # New frame, copy the existing buffer's content and notify all\n # clients it's available\n self.buffer.truncate()\n with self.condition:\n self.frame = self.buffer.getvalue()\n self.condition.notify_all()\n self.buffer.seek(0)\n return self.buffer.write(buf)\n\nclass StreamingHandler(server.BaseHTTPRequestHandler):\n def do_GET(self):\n if self.path == '/':\n self.send_response(301)\n self.send_header('Location', '/index.html')\n self.end_headers()\n elif self.path == '/index.html':\n content = PAGE.encode('utf-8')\n self.send_response(200)\n self.send_header('Content-Type', 'text/html')\n self.send_header('Content-Length', len(content))\n self.end_headers()\n self.wfile.write(content)\n elif self.path == '/stream.mjpg':\n self.send_response(200)\n self.send_header('Age', 0)\n self.send_header('Cache-Control', 'no-cache, private')\n self.send_header('Pragma', 'no-cache')\n self.send_header('Content-Type', 'multipart/x-mixed-replace; boundary=FRAME')\n self.end_headers()\n try:\n while True:\n with output.condition:\n output.condition.wait()\n frame = output.frame\n self.wfile.write(b'--FRAME\\r\\n')\n self.send_header('Content-Type', 'image/jpeg')\n self.send_header('Content-Length', len(frame))\n self.end_headers()\n self.wfile.write(frame)\n self.wfile.write(b'\\r\\n')\n except Exception as e:\n logging.warning(\n 'Removed streaming client %s: %s',\n self.client_address, str(e))\n else:\n self.send_error(404)\n self.end_headers()\n\nclass StreamingServer(socketserver.ThreadingMixIn, server.HTTPServer):\n allow_reuse_address = True\n daemon_threads = True\n\n################################################################################\n#MQTT core functions\n################################################################################\n\n#Run this function in order to connect to the client (Node-RED)\ndef on_connect(client, userdata, flags, rc):\n #Print when connected\n print(\"Connected! - \" + str(rc))\n #When connected, run subscribe()\n client.subscribe(\"actuator/#\")\n #Turn green the light module\n rgb(0,255,0)\n\n#Run this function in order to subscribe to all the topics begining by actuator\ndef on_subscribe(client, obj, mid, granted_qos):\n #Print when subscribed\n print(\"Subscribed! - \"+str(mid)+\" \"+str(granted_qos))\n\n#Run this command when Node-RED is sending a message on the subscribed topic\ndef on_message(client, userdata, msg):\n #Print the topic and the message\n print(msg.topic+\" \"+str(msg.qos)+\" \"+str(msg.payload))\n #Update the global variables command, args and counter\n global command\n global args\n global counter\n #Parse the topic to find the command. ex : actuator/pump -> pump\n command=msg.topic.split(\"/\")[1]\n #Decode the message to find the arguments\n args=str(msg.payload.decode())\n #Reset the counter to 0\n counter=0\n\n################################################################################\n#Init functions\n################################################################################\n\n#define the names for the 2 exsting steppers\nkit = MotorKit()\npump_stepper = kit.stepper1\nfocus_stepper = kit.stepper2\n#Make sure the steppers are release and do not use any power\npump_stepper.release()\nfocus_stepper.release()\n\n#Precise the settings of the PiCamera\ncamera = PiCamera()\ncamera.resolution = (3280, 2464)\ncamera.iso = 60\ncamera.shutter_speed = 500\ncamera.exposure_mode = 'fixedfps'\n\n#Declare the global variables command, args and counter\ncommand = ''\nargs = ''\ncounter=''\n\n#MQTT Client functions definition\nclient = mqtt.Client()\nclient.connect(\"127.0.0.1\",1883,60)\nclient.on_connect = on_connect\nclient.on_subscribe = on_subscribe\nclient.on_message = on_message\nclient.loop_start()\n\n################################################################################\n#Definition of the few important metadata\n################################################################################\n\nlocal_metadata = {\n \"process_datetime\": datetime.now(),\n \"acq_camera_resolution\" : camera.resolution,\n \"acq_camera_iso\" : camera.iso,\n \"acq_camera_shutter_speed\" : camera.shutter_speed\n}\n\n#Read the content of config.json containing the metadata defined on Node-RED\nconfig_json = open('/home/pi/PlanktonScope/config.json','r')\nnode_red_metadata = json.loads(config_json.read())\n\n#Concat the local metadata and the metadata from Node-RED\nglobal_metadata = {**local_metadata, **node_red_metadata}\n\n#Define the name of the .zip file that will contain the images and the .tsv table for EcoTaxa\narchive_fn = os.path.join(\"/home/pi/PlanktonScope/\",\"export\", \"ecotaxa_export.zip\")\n\n################################################################################\n#MorphoCut Script\n################################################################################\n\n#Define processing pipeline\nwith Pipeline() as p:\n\n #Recursively find .jpg files in import_path.\n #Sort to get consective frames.\n abs_path = Find(\"/home/pi/PlanktonScope/tmp\", [\".jpg\"], sort=True, verbose=True)\n\n #Extract name from abs_path\n name = Call(lambda p: os.path.splitext(os.path.basename(p))[0], abs_path)\n\n #Set the LEDs as Green\n Call(rgb, 0,255,0)\n\n #Read image\n img = ImageReader(abs_path)\n\n #Show progress bar for frames\n TQDM(Format(\"Frame {name}\", name=name))\n\n #Apply running median to approximate the background image\n flat_field = RunningMedian(img, 5)\n\n #Correct image\n img = img / flat_field\n\n #Rescale intensities and convert to uint8 to speed up calculations\n img = RescaleIntensity(img, in_range=(0, 1.1), dtype=\"uint8\")\n\n #Publish the json containing all the metadata to via MQTT to Node-RED\n Call(client.publish, \"receiver/segmentation/name\", name)\n\n #Filter variable to reduce memory load\n FilterVariables(name,img)\n\n #Save cleaned images\n #frame_fn = Format(os.path.join(\"/home/pi/PlanktonScope/tmp\",\"CLEAN\", \"{name}.jpg\"), name=name)\n #ImageWriter(frame_fn, img)\n\n #Convert image to uint8 gray\n img_gray = RGB2Gray(img)\n\n #?\n img_gray = Call(img_as_ubyte, img_gray)\n\n #Canny edge detection using OpenCV\n img_canny = Call(cv2.Canny, img_gray, 50,100)\n\n #Dilate using OpenCV\n kernel = Call(cv2.getStructuringElement, cv2.MORPH_ELLIPSE, (15, 15))\n img_dilate = Call(cv2.dilate, img_canny, kernel, iterations=2)\n\n #Close using OpenCV\n kernel = Call(cv2.getStructuringElement, cv2.MORPH_ELLIPSE, (5, 5))\n img_close = Call(cv2.morphologyEx, img_dilate, cv2.MORPH_CLOSE, kernel, iterations=1)\n\n #Erode using OpenCV\n kernel = Call(cv2.getStructuringElement, cv2.MORPH_ELLIPSE, (15, 15))\n mask = Call(cv2.erode, img_close, kernel, iterations=2)\n\n #Find objects\n regionprops = FindRegions(\n mask, img_gray, min_area=1000, padding=10, warn_empty=name\n )\n\n #Set the LEDs as Purple\n Call(rgb, 255,0,255)\n\n # For an object, extract a vignette/ROI from the image\n roi_orig = ExtractROI(img, regionprops, bg_color=255)\n\n # Generate an object identifier\n i = Enumerate()\n\n #Call(print,i)\n\n #Define the ID of each object\n object_id = Format(\"{name}_{i:d}\", name=name, i=i)\n\n #Call(print,object_id)\n\n #Define the name of each object\n object_fn = Format(os.path.join(\"/home/pi/PlanktonScope/\",\"OBJECTS\", \"{name}.jpg\"), name=object_id)\n\n #Save the image of the object with its name\n ImageWriter(object_fn, roi_orig)\n\n #Calculate features. The calculated features are added to the global_metadata.\n #Returns a Variable representing a dict for every object in the stream.\n meta = CalculateZooProcessFeatures(\n regionprops, prefix=\"object_\", meta=global_metadata\n )\n\n #Get all the metadata\n json_meta = Call(json.dumps,meta, sort_keys=True, default=str)\n\n #Publish the json containing all the metadata to via MQTT to Node-RED\n Call(client.publish, \"receiver/segmentation/metric\", json_meta)\n\n #Add object_id to the metadata dictionary\n meta[\"object_id\"] = object_id\n\n #Generate object filenames\n orig_fn = Format(\"{object_id}.jpg\", object_id=object_id)\n\n #Write objects to an EcoTaxa archive:\n #roi image in original color, roi image in grayscale, metadata associated with each object\n EcotaxaWriter(archive_fn, (orig_fn, roi_orig), meta)\n\n #Progress bar for objects\n TQDM(Format(\"Object {object_id}\", object_id=object_id))\n\n #Publish the object_id to via MQTT to Node-RED\n Call(client.publish, \"receiver/segmentation/object_id\", object_id)\n\n #Set the LEDs as Green\n Call(rgb, 0,255,0)\n\n################################################################################\n#While loop for capting commands from Node-RED\n################################################################################\n\noutput = StreamingOutput()\naddress = ('', 8000)\nserver = StreamingServer(address, StreamingHandler)\nthreading.Thread(target=server.serve_forever).start()\ncamera.start_recording(output, format='mjpeg', resize=(640, 480))\n\nwhile True:\n\n ############################################################################\n #Pump Event\n ############################################################################\n\n #If the command is \"pump\"\n if (command==\"pump\"):\n\n #Set the LEDs as Blue\n rgb(0,0,255)\n\n #Get direction from the different received arguments\n direction=args.split(\" \")[0]\n\n #Get delay (in between steps) from the different received arguments\n delay=float(args.split(\" \")[1])\n\n #Get number of steps from the different received arguments\n nb_step=int(args.split(\" \")[2])\n\n #Print status\n print(\"The pump has been started.\")\n\n #Publish the status \"Start\" to via MQTT to Node-RED\n client.publish(\"receiver/pump\", delay);\n\n ########################################################################\n while True:\n\n #Depending on direction, select the right direction for the pump\n if direction == \"BACKWARD\":\n direction=stepper.BACKWARD\n\n if direction == \"FORWARD\":\n direction=stepper.FORWARD\n\n #Actuate the pump for one step in the right direction\n pump_stepper.onestep(direction=direction, style=stepper.DOUBLE)\n\n #Increment the counter\n counter+=1\n\n #Wait during the delay to pump at the right flowrate\n sleep(delay)\n\n ####################################################################\n #If counter reach the number of step, break\n if counter>nb_step:\n\n #Release the pump stepper to stop power draw\n pump_stepper.release()\n\n #Print status\n print(\"The pumping is done.\")\n\n #Change the command to not re-enter in this while loop\n command=\"wait\"\n\n #Publish the status \"Done\" to via MQTT to Node-RED\n client.publish(\"receiver/pump\", \"Done\");\n\n #Set the LEDs as Green\n rgb(0,255,0)\n\n #Reset the counter to 0\n counter=0\n\n break\n\n ####################################################################\n #If a new received command isn't \"pump\", break this while loop\n if command!=\"pump\":\n\n #Release the pump stepper to stop power draw\n pump_stepper.release()\n\n #Print status\n print(\"The pump has been interrompted.\")\n\n #Publish the status \"Interrompted\" to via MQTT to Node-RED\n client.publish(\"receiver/pump\", \"Interrompted\");\n\n #Set the LEDs as Green\n rgb(0,255,0)\n\n #Reset the counter to 0\n counter=0\n\n break\n\n ############################################################################\n #Focus Event\n ############################################################################\n\n #If the command is \"focus\"\n elif (command==\"focus\"):\n\n #Set the LEDs as Yellow\n rgb(255,255,0)\n\n #Get direction from the different received arguments\n direction=args.split(\" \")[0]\n\n #Get number of steps from the different received arguments\n nb_step=int(args.split(\" \")[1])\n\n #Print status\n print(\"The focus has been started.\")\n\n #Publish the status \"Start\" to via MQTT to Node-RED\n client.publish(\"receiver/focus\", \"Start\");\n\n ########################################################################\n while True:\n\n #Depending on direction, select the right direction for the focus\n if direction == \"FORWARD\":\n direction=stepper.FORWARD\n\n if direction == \"BACKWARD\":\n direction=stepper.BACKWARD\n\n #Actuate the focus for one microstep in the right direction\n focus_stepper.onestep(direction=direction, style=stepper.MICROSTEP)\n\n #Increment the counter\n counter+=1\n\n ####################################################################\n #If counter reach the number of step, break\n if counter>nb_step:\n\n #Release the focus steppers to stop power draw\n focus_stepper.release()\n\n #Print status\n print(\"The focusing is done.\")\n\n #Change the command to not re-enter in this while loop\n command=\"wait\"\n\n #Publish the status \"Done\" to via MQTT to Node-RED\n client.publish(\"receiver/focus\", \"Done\");\n\n #Set the LEDs as Green\n rgb(0,255,0)\n\n #Reset the counter to 0\n counter=0\n\n break\n\n ####################################################################\n #If a new received command isn't \"pump\", break this while loop\n if command!=\"focus\":\n\n #Release the focus steppers to stop power draw\n focus_stepper.release()\n\n #Print status\n print(\"The stage has been interrompted.\")\n\n #Publish the status \"Done\" to via MQTT to Node-RED\n client.publish(\"receiver/focus\", \"Interrompted\");\n\n #Set the LEDs as Green\n rgb(0,255,0)\n\n #Reset the counter to 0\n counter=0\n\n break\n\n ############################################################################\n #Image Event\n ############################################################################\n\n elif (command==\"image\"):\n\n #Get duration to wait before an image from the different received arguments\n sleep_before=int(args.split(\" \")[0])\n\n #Get number of step in between two images from the different received arguments\n nb_step=int(args.split(\" \")[1])\n\n #Get the number of frames to image from the different received arguments\n nb_frame=int(args.split(\" \")[2])\n\n #Sleep a duration before to start acquisition\n sleep(sleep_before)\n\n #Publish the status \"Start\" to via MQTT to Node-RED\n client.publish(\"receiver/image\", \"Start\");\n\n #Set the LEDs as Blue\n rgb(0,0,255)\n\n #Pump duing a given number of steps (in between each image)\n for i in range(nb_step):\n\n #If the command is still image - pump a defined nb of steps\n if (command==\"image\"):\n\n #Actuate the pump for one step in the FORWARD direction\n pump_stepper.onestep(direction=stepper.FORWARD, style=stepper.DOUBLE)\n\n #The flowrate is fixed for now.\n sleep(0.01)\n\n #If the command isn't image anymore - break\n else:\n\n break\n\n\n #Set the LEDs as Green\n rgb(0,255,0)\n\n while True:\n #Release the pump stepper to stop power draw\n pump_stepper.release()\n\n #Set the LEDs as Cyan\n rgb(0,255,255)\n\n #Increment the counter\n counter+=1\n\n #Get datetime\n datetime_tmp=datetime.now().strftime(\"%H_%M_%S_%f\")\n\n #Print datetime\n print(datetime_tmp)\n\n #Define the filename of the image\n filename = os.path.join(\"/home/pi/PlanktonScope/tmp\",datetime_tmp+\".jpg\")\n\n #Capture an image with the proper filename\n camera.capture(filename)\n\n #Set the LEDs as Green\n rgb(0,255,0)\n\n #Publish the name of the image to via MQTT to Node-RED\n\n client.publish(\"receiver/image\", datetime_tmp+\".jpg has been imaged.\");\n \n #Set the LEDs as Blue\n rgb(0,0,255)\n\n #Pump during a given nb of steps\n for i in range(nb_step):\n\n #Actuate the pump for one step in the FORWARD direction\n pump_stepper.onestep(direction=stepper.FORWARD, style=stepper.DOUBLE)\n\n #The flowrate is fixed for now.\n sleep(0.01)\n\n #Wait a fixed delay which set the framerate as < than 2 imag/sec\n sleep(0.5)\n\n #Set the LEDs as Green\n rgb(0,255,0)\n\n ####################################################################\n #If counter reach the number of frame, break\n if(counter>nb_frame):\n\n #Publish the status \"Completed\" to via MQTT to Node-RED\n client.publish(\"receiver/image\", \"Completed\");\n\n #Release the pump steppers to stop power draw\n pump_stepper.release()\n\n #Publish the status \"Start\" to via MQTT to Node-RED\n client.publish(\"receiver/segmentation\", \"Start\");\n\n #Start the MorphoCut Pipeline\n p.run()\n\n #remove directory\n #shutil.rmtree(import_path)\n\n #Publish the status \"Completed\" to via MQTT to Node-RED\n client.publish(\"receiver/segmentation\", \"Completed\");\n\n #Set the LEDs as White\n rgb(255,255,255)\n\n sample_project=node_red_metadata['sample_project'];\n \n acq_id=node_red_metadata['acq_id'];\n \n export_name = str(sample_project)+\"_\"+str(acq_id)+\".zip\"\n \n \n os.popen(\"mv /home/pi/PlanktonScope/export/ecotaxa_export.zip /home/pi/PlanktonScope/export/\"+export_name)\n \n os.popen(\"rm -rf /home/pi/PlanktonScope/tmp/*.jpg\")\n \n os.popen(\"rm -rf /home/pi/PlanktonScope/OBJECTS/*.jpg\")\n \n\n #Let it happen\n sleep(1)\n\n #Set the LEDs as Green\n rgb(0,255,0)\n\n\n #Change the command to not re-enter in this while loop\n command=\"wait\"\n \n #Set the LEDs as Green\n rgb(0,255,255)\n\n #Reset the counter to 0\n counter=0\n\n break\n\n ####################################################################\n #If a new received command isn't \"image\", break this while loop\n if command!=\"image\":\n\n #Release the pump steppers to stop power draw\n pump_stepper.release()\n\n #Print status\n print(\"The imaging has been interrompted.\")\n\n #Publish the status \"Interrompted\" to via MQTT to Node-RED\n client.publish(\"receiver/image\", \"Interrompted\");\n\n #Set the LEDs as Green\n rgb(0,255,0)\n\n #Reset the counter to 0\n counter=0\n\n break\n\n else:\n #Its just waiting to receive command from Node-RED\n sleep(0.4)\n", "output": "str", "x": 300, "y": 100, "wires": [ [ - "500abffa.c7a788" + "fd813497.f44d5" ] ] }, { - "id": "a11158b1.b7649", - "type": "debug", - "z": "e8320d42.9a3ad8", - "name": "", - "active": true, - "tosidebar": true, - "console": false, - "tostatus": false, - "complete": "true", - "targetType": "full", - "x": 1230, - "y": 200, - "wires": [] - }, - { - "id": "cf9e02a2.3feff", + "id": "10348484.8ca5b3", "type": "exec", - "z": "e8320d42.9a3ad8", + "z": "435c6174.e0c8b", "command": "ps -ax | grep \"python3.7 /home/pi/PlanktonScope/script/main.py\"| head -1 | awk -F \" \" '{print$1}' ", "addpay": false, "append": "", @@ -420,16 +1550,16 @@ "y": 40, "wires": [ [ - "945415c5.01217" + "b41e729d.a3042" ], [], [] ] }, { - "id": "945415c5.01217", + "id": "b41e729d.a3042", "type": "exec", - "z": "e8320d42.9a3ad8", + "z": "435c6174.e0c8b", "command": "kill", "addpay": true, "append": "", @@ -437,7 +1567,7 @@ "timer": "", "oldrc": false, "name": "", - "x": 910, + "x": 870, "y": 40, "wires": [ [], @@ -446,9 +1576,9 @@ ] }, { - "id": "18da28e6.7b000f", + "id": "e49710cf.c4831", "type": "delay", - "z": "e8320d42.9a3ad8", + "z": "435c6174.e0c8b", "name": "", "pauseType": "delay", "timeout": "1", @@ -464,522 +1594,18 @@ "y": 100, "wires": [ [ - "985c65de.0801b" + "a2e43b6f.3b73a" ] ] }, { - "id": "6384a5e.e34465c", - "type": "subflow", - "name": "Datetime update", - "info": "", - "category": "", - "in": [ - { - "x": 140, - "y": 80, - "wires": [ - { - "id": "42ffcda3.49c30c" - } - ] - } - ], - "out": [], - "env": [], - "color": "#DDAA99", - "icon": "font-awesome/fa-clock-o" - }, - { - "id": "e3824a97.8f2c3", - "type": "exec", - "z": "6384a5e.e34465c", - "command": "sudo date -s", - "addpay": true, - "append": "", - "useSpawn": "false", - "timer": "", - "oldrc": false, - "name": "", - "x": 1010, - "y": 240, - "wires": [ - [], - [], - [] - ] - }, - { - "id": "a5a13db6.4c6958", - "type": "function", - "z": "6384a5e.e34465c", - "name": "", - "func": "d = new Date();\n//get weekday\nvar weekday = new Array(7);\nweekday[0] = \"Sun\";\nweekday[1] = \"Mon\";\nweekday[2] = \"Tue\";\nweekday[3] = \"Wed\";\nweekday[4] = \"Thu\";\nweekday[5] = \"Fri\";\nweekday[6] = \"Sat\";\nvar w = weekday[d.getUTCDay()];\n//get Month\nvar month = new Array(12);\nmonth[0] = \"Jan\";\nmonth[1] = \"Feb\";\nmonth[2] = \"Mar\";\nmonth[3] = \"Apr\";\nmonth[4] = \"May\";\nmonth[5] = \"Jun\";\nmonth[6] = \"Jul\";\nmonth[7] = \"Aug\";\nmonth[8] = \"Sep\";\nmonth[9] = \"Oct\";\nmonth[10] = \"Nov\";\nmonth[11] = \"Dec\";\nvar n = month[d.getUTCMonth()];\n \n//get day\nvar day = d.getUTCDay()\n\n//get Hours\nvar Hours = d.getUTCHours();\n//get Minutes\nvar Minutes = d.getUTCMinutes();\n//get Seconds\nvar Seconds = d.getUTCSeconds();\n//get FullYear\nvar FullYear = d.getUTCFullYear();\n\n//Thu Aug 09 2012 23:34:04 GMT+0200 (GMT+02:00)\n\n//Thu Aug 9 21:31:26 UTC 2012\n\n//msg.payload = \"Thu Aug 9 21:31:26 UTC 2012\"\n\nmsg.payload = '\"'+w+\" \"+n+\" \"+day+\" \"+Hours+\":\"+Minutes+\":\"+Seconds+\" UTC \"+FullYear+'\"';\nreturn msg;", - "outputs": 1, - "noerr": 0, - "x": 490, - "y": 40, - "wires": [ - [ - "bafb69f.a42ea18" - ] - ] - }, - { - "id": "bafb69f.a42ea18", - "type": "ui_template", - "z": "6384a5e.e34465c", - "group": "9c86b3b7.54841", - "name": "", - "order": 1, - "width": 0, - "height": 0, - "format": "
", - "storeOutMessages": true, - "fwdInMessages": true, - "templateScope": "local", - "x": 640, - "y": 40, - "wires": [ - [] - ] - }, - { - "id": "81f9cd4c.8540b", - "type": "ui_numeric", - "z": "6384a5e.e34465c", - "name": "tmp_year", - "label": "Year", - "tooltip": "", - "group": "9c86b3b7.54841", - "order": 2, - "width": 5, - "height": 1, - "wrap": false, - "passthru": true, - "topic": "tmp_year", - "format": "{{value}}", - "min": "2020", - "max": "2030", - "step": 1, - "x": 640, - "y": 80, - "wires": [ - [ - "8f5a74df.0663f" - ] - ] - }, - { - "id": "274f25fc.9e61ba", - "type": "ui_numeric", - "z": "6384a5e.e34465c", - "name": "tmp_month", - "label": "Month", - "tooltip": "", - "group": "9c86b3b7.54841", - "order": 3, - "width": 3, - "height": 1, - "wrap": false, - "passthru": true, - "topic": "tmp_month", - "format": "{{value}}", - "min": "1", - "max": "12", - "step": 1, - "x": 650, - "y": 120, - "wires": [ - [ - "8f5a74df.0663f" - ] - ] - }, - { - "id": "4ddcb673.905a", - "type": "ui_numeric", - "z": "6384a5e.e34465c", - "name": "tmp_day", - "label": "Day", - "tooltip": "", - "group": "9c86b3b7.54841", - "order": 4, - "width": 3, - "height": 1, - "wrap": false, - "passthru": true, - "topic": "tmp_day", - "format": "{{value}}", - "min": "1", - "max": "31", - "step": 1, - "x": 640, - "y": 160, - "wires": [ - [ - "8f5a74df.0663f" - ] - ] - }, - { - "id": "248eee4c.238282", - "type": "ui_numeric", - "z": "6384a5e.e34465c", - "name": "tmp_hour", - "label": "Hour", - "tooltip": "", - "group": "9c86b3b7.54841", - "order": 5, - "width": 3, - "height": 1, - "wrap": false, - "passthru": true, - "topic": "tmp_hour", - "format": "{{value}}", - "min": "0", - "max": "23", - "step": 1, - "x": 640, - "y": 200, - "wires": [ - [ - "8f5a74df.0663f" - ] - ] - }, - { - "id": "a368c4b7.2dc4b8", - "type": "ui_numeric", - "z": "6384a5e.e34465c", - "name": "tmp_minute", - "label": "Minute", - "tooltip": "", - "group": "9c86b3b7.54841", - "order": 6, - "width": 3, - "height": 1, - "wrap": false, - "passthru": true, - "topic": "tmp_minute", - "format": "{{value}}", - "min": "0", - "max": "59", - "step": 1, - "x": 650, - "y": 240, - "wires": [ - [ - "8f5a74df.0663f" - ] - ] - }, - { - "id": "96cc9953.9496c8", - "type": "ui_numeric", - "z": "6384a5e.e34465c", - "name": "tmp_second", - "label": "Second", - "tooltip": "", - "group": "9c86b3b7.54841", - "order": 7, - "width": 3, - "height": 1, - "wrap": false, - "passthru": true, - "topic": "tmp_second", - "format": "{{value}}", - "min": "0", - "max": "59", - "step": 1, - "x": 650, - "y": 280, - "wires": [ - [ - "8f5a74df.0663f" - ] - ] - }, - { - "id": "d6240495.8429c", - "type": "interval", - "z": "6384a5e.e34465c", - "name": "interval", - "interval": "1", - "onstart": false, - "msg": "ping", - "showstatus": true, - "unit": "seconds", - "statusformat": "YYYY-MM-D HH:mm:ss", - "x": 310, - "y": 40, - "wires": [ - [ - "a5a13db6.4c6958" - ] - ] - }, - { - "id": "e8d38dc0.c7e84", - "type": "ui_button", - "z": "6384a5e.e34465c", - "name": "", - "group": "9c86b3b7.54841", - "order": 8, - "width": 4, - "height": 1, - "passthru": false, - "label": "Update", - "tooltip": "", - "color": "black", - "bgcolor": "white", - "icon": "", - "payload": "", - "payloadType": "str", - "topic": "", - "x": 640, - "y": 320, - "wires": [ - [ - "581f71d3.bde458" - ] - ] - }, - { - "id": "581f71d3.bde458", - "type": "function", - "z": "6384a5e.e34465c", - "name": "update datetime", - "func": "var FullYear= global.get(\"year\");\nvar Month= global.get(\"month\");\nvar day= global.get(\"day\");\nvar Hours= global.get(\"hour\");\nvar Minutes= global.get(\"minute\");\nvar Seconds= global.get(\"second\");\n\nmsg.payload = new Date();\n//get Month\nvar month = new Array(12);\nmonth[1] = \"Jan\";\nmonth[2] = \"Feb\";\nmonth[3] = \"Mar\";\nmonth[4] = \"Apr\";\nmonth[5] = \"May\";\nmonth[6] = \"Jun\";\nmonth[7] = \"Jul\";\nmonth[8] = \"Aug\";\nmonth[9] = \"Sep\";\nmonth[10] = \"Oct\";\nmonth[11] = \"Nov\";\nmonth[12] = \"Dec\";\nvar n = month[Month];\n \nmsg.payload = '\"'+day+\" \"+n+\" \"+FullYear+\" \"+Hours+\":\"+Minutes+\":\"+Seconds+'\"';\n\n\nreturn msg;", - "outputs": 1, - "noerr": 0, - "x": 800, - "y": 320, - "wires": [ - [ - "6b023a67.faa104", - "e3824a97.8f2c3" - ] - ] - }, - { - "id": "8f5a74df.0663f", - "type": "function", - "z": "6384a5e.e34465c", - "name": "set global", - "func": "var value = msg.payload;\nvar key = msg.topic;\n\nglobal.set(key,value);\nreturn msg;", - "outputs": 1, - "noerr": 0, - "x": 840, - "y": 60, - "wires": [ - [] - ] - }, - { - "id": "6b023a67.faa104", - "type": "debug", - "z": "6384a5e.e34465c", - "name": "", - "active": true, - "tosidebar": true, - "console": false, - "tostatus": false, - "complete": "false", - "x": 1010, - "y": 300, - "wires": [] - }, - { - "id": "4ab089b9.1098", - "type": "function", - "z": "6384a5e.e34465c", - "name": "", - "func": "d = msg.payload;\n\nvar val = d.getUTCFullYear();\n\nmsg.payload = val;\nreturn msg;", - "outputs": 1, - "noerr": 0, - "x": 490, - "y": 80, - "wires": [ - [ - "81f9cd4c.8540b" - ] - ] - }, - { - "id": "42ffcda3.49c30c", - "type": "function", - "z": "6384a5e.e34465c", - "name": "", - "func": "d = new Date();\nmsg.payload = d\nreturn msg;", - "outputs": 1, - "noerr": 0, - "x": 310, - "y": 80, - "wires": [ - [ - "4ab089b9.1098", - "13529b2c.cb9d9d", - "c09bb768.0e7518", - "967b4488.670f08", - "3e3732d.273a04e", - "327729f0.afe466" - ] - ] - }, - { - "id": "13529b2c.cb9d9d", - "type": "function", - "z": "6384a5e.e34465c", - "name": "", - "func": "d = msg.payload;\n\nvar val = d.getUTCMonth();\n\nmsg.payload = val+1;\nreturn msg;", - "outputs": 1, - "noerr": 0, - "x": 490, - "y": 120, - "wires": [ - [ - "274f25fc.9e61ba" - ] - ] - }, - { - "id": "c09bb768.0e7518", - "type": "function", - "z": "6384a5e.e34465c", - "name": "", - "func": "d = msg.payload;\n\nvar val = d.getUTCDay();\n\nmsg.payload = val;\nreturn msg;", - "outputs": 1, - "noerr": 0, - "x": 490, - "y": 160, - "wires": [ - [ - "4ddcb673.905a" - ] - ] - }, - { - "id": "967b4488.670f08", - "type": "function", - "z": "6384a5e.e34465c", - "name": "", - "func": "d = msg.payload;\n\nvar val = d.getUTCHours();\n\nmsg.payload = val;\nreturn msg;", - "outputs": 1, - "noerr": 0, - "x": 490, - "y": 200, - "wires": [ - [ - "248eee4c.238282" - ] - ] - }, - { - "id": "3e3732d.273a04e", - "type": "function", - "z": "6384a5e.e34465c", - "name": "", - "func": "d = msg.payload;\n\nvar val = d.getUTCMinutes();\n\nmsg.payload = val;\nreturn msg;", - "outputs": 1, - "noerr": 0, - "x": 490, - "y": 240, - "wires": [ - [ - "a368c4b7.2dc4b8" - ] - ] - }, - { - "id": "327729f0.afe466", - "type": "function", - "z": "6384a5e.e34465c", - "name": "", - "func": "d = msg.payload;\n\nvar val = d.getUTCSeconds();\n\nmsg.payload = val;\nreturn msg;", - "outputs": 1, - "noerr": 0, - "x": 490, - "y": 280, - "wires": [ - [ - "96cc9953.9496c8" - ] - ] - }, - { - "id": "9c86b3b7.54841", - "type": "ui_group", - "z": "", - "name": "Datetime", - "tab": "2b97fe34.a699fa", - "order": 1, - "disp": true, - "width": "24", - "collapse": false - }, - { - "id": "a156df1e.d37178", - "type": "subflow", - "name": "Acquisition inputs", - "info": "", - "category": "", - "in": [ - { - "x": 40, - "y": 40, - "wires": [ - { - "id": "2dd27be1.476eac" - }, - { - "id": "3883d084.feb708" - }, - { - "id": "4bf1038f.d36f9c" - }, - { - "id": "ae15c276.ec8c68" - } - ] - } - ], - "out": [ - { - "x": 740, - "y": 40, - "wires": [ - { - "id": "b996437b.1a45b8", - "port": 0 - }, - { - "id": "d56a51c1.60023", - "port": 0 - }, - { - "id": "229ade87.b1656a", - "port": 0 - }, - { - "id": "5e093b67.a32f9c", - "port": 0 - } - ] - } - ], - "env": [], - "color": "#A6BBCF", - "icon": "node-red-contrib-camerapi/photo.png" - }, - { - "id": "b996437b.1a45b8", + "id": "a105d7c9.07d71", "type": "ui_text_input", - "z": "a156df1e.d37178", + "z": "4273b9bf.bb07a8", "name": "custom_nb_step", "label": "Number of steps in between two images", "tooltip": "", - "group": "48649115.fcd01", + "group": "6fdfb3ec.fd451c", "order": 2, "width": 0, "height": 0, @@ -994,13 +1620,13 @@ ] }, { - "id": "229ade87.b1656a", + "id": "530d8426.5c4bec", "type": "ui_text_input", - "z": "a156df1e.d37178", + "z": "4273b9bf.bb07a8", "name": "custom_nb_frame", "label": "Number of images per acquisition", "tooltip": "", - "group": "48649115.fcd01", + "group": "6fdfb3ec.fd451c", "order": 3, "width": 0, "height": 0, @@ -1015,9 +1641,9 @@ ] }, { - "id": "2dd27be1.476eac", + "id": "55d70110.127d38", "type": "function", - "z": "a156df1e.d37178", + "z": "4273b9bf.bb07a8", "name": "get custom_nb_step", "func": "msg.payload = msg.payload.custom_nb_step;\nreturn msg;", "outputs": 1, @@ -1026,14 +1652,14 @@ "y": 80, "wires": [ [ - "b996437b.1a45b8" + "a105d7c9.07d71" ] ] }, { - "id": "4bf1038f.d36f9c", + "id": "ec5967a.409eb18", "type": "function", - "z": "a156df1e.d37178", + "z": "4273b9bf.bb07a8", "name": "get custom_nb_frame", "func": "msg.payload = msg.payload.custom_nb_frame;\nreturn msg;", "outputs": 1, @@ -1042,30 +1668,14 @@ "y": 120, "wires": [ [ - "229ade87.b1656a" + "530d8426.5c4bec" ] ] }, { - "id": "ae15c276.ec8c68", + "id": "4e6a3b73.7472d4", "type": "function", - "z": "a156df1e.d37178", - "name": "get custom_segmentation", - "func": "msg.payload = msg.payload.custom_segmentation;\nreturn msg;", - "outputs": 1, - "noerr": 0, - "x": 230, - "y": 160, - "wires": [ - [ - "5e093b67.a32f9c" - ] - ] - }, - { - "id": "3883d084.feb708", - "type": "function", - "z": "a156df1e.d37178", + "z": "4273b9bf.bb07a8", "name": "get custom_sleep_before", "func": "msg.payload = msg.payload.custom_sleep_before;\nreturn msg;", "outputs": 1, @@ -1074,18 +1684,18 @@ "y": 40, "wires": [ [ - "d56a51c1.60023" + "816c19e2.f940e" ] ] }, { - "id": "d56a51c1.60023", + "id": "816c19e2.f940e", "type": "ui_text_input", - "z": "a156df1e.d37178", + "z": "4273b9bf.bb07a8", "name": "custom_sleep_before", "label": "Duration before the acquisition (s)", "tooltip": "", - "group": "48649115.fcd01", + "group": "6fdfb3ec.fd451c", "order": 1, "width": 0, "height": 0, @@ -1100,85 +1710,13 @@ ] }, { - "id": "5e093b67.a32f9c", - "type": "ui_switch", - "z": "a156df1e.d37178", - "name": "custom_segmentation", - "label": "Realize the segmentation", - "tooltip": "", - "group": "48649115.fcd01", - "order": 6, - "width": 0, - "height": 0, - "passthru": true, - "decouple": "false", - "topic": "custom_segmentation", - "style": "", - "onvalue": "True", - "onvalueType": "str", - "onicon": "", - "oncolor": "", - "offvalue": "False", - "offvalueType": "str", - "officon": "", - "offcolor": "", - "x": 520, - "y": 160, - "wires": [ - [] - ] - }, - { - "id": "48649115.fcd01", - "type": "ui_group", - "z": "", - "name": "Acquisition inputs", - "tab": "2b97fe34.a699fa", - "order": 9, - "disp": true, - "width": "24", - "collapse": false - }, - { - "id": "99798a85.e62408", - "type": "subflow", - "name": "Process metadata", - "info": "", - "category": "", - "in": [ - { - "x": 40, - "y": 80, - "wires": [ - { - "id": "20414296.54837e" - } - ] - } - ], - "out": [ - { - "x": 700, - "y": 80, - "wires": [ - { - "id": "d5ab9061.b06a9", - "port": 0 - } - ] - } - ], - "env": [], - "color": "#DDAA99" - }, - { - "id": "d5ab9061.b06a9", + "id": "7bad3862.c22b5", "type": "ui_text_input", - "z": "99798a85.e62408", + "z": "4d3786dd.dd79f", "name": "process_id", "label": "Id of the process", "tooltip": "", - "group": "beeb994e.b67688", + "group": "c32bf44c.3b67a8", "order": 1, "width": 0, "height": 0, @@ -1193,9 +1731,9 @@ ] }, { - "id": "20414296.54837e", + "id": "7228965.6f65ae8", "type": "function", - "z": "99798a85.e62408", + "z": "4d3786dd.dd79f", "name": "get process_id", "func": "msg.payload = msg.payload.process_id+1;\nreturn msg;", "outputs": 1, @@ -1204,55 +1742,31 @@ "y": 80, "wires": [ [ - "d5ab9061.b06a9" + "7bad3862.c22b5" ] ] }, { - "id": "beeb994e.b67688", - "type": "ui_group", - "z": "", - "name": "Process metadata", - "tab": "2b97fe34.a699fa", - "order": 8, - "disp": true, - "width": 24, - "collapse": false - }, - { - "id": "246abd43.838a5a", - "type": "subflow", - "name": "MQTT Receive & Plot", - "info": "", - "category": "", - "in": [], - "out": [], - "env": [], - "color": "#F3B567", - "icon": "node-red/bridge.svg" - }, - { - "id": "1aeca49c.10b893", + "id": "3b44178c.9bb6c", "type": "mqtt in", - "z": "246abd43.838a5a", + "z": "20bc0424.146724", "name": "", "topic": "receiver/#", "qos": "0", "datatype": "auto", - "broker": "84801dc0.193d88", - "x": 80, + "broker": "6e9cdee.ac3c2a", + "x": 60, "y": 40, "wires": [ [ - "be5de01e.45d56", - "613bee5b.042fe" + "3e32282.7051d58" ] ] }, { - "id": "be5de01e.45d56", + "id": "3e32282.7051d58", "type": "switch", - "z": "246abd43.838a5a", + "z": "20bc0424.146724", "name": "", "property": "topic", "propertyType": "msg", @@ -1281,27 +1795,27 @@ "checkall": "true", "repair": false, "outputs": 4, - "x": 230, + "x": 250, "y": 40, "wires": [ [ - "d39289fb.9f759" + "eb8571ec.dd894" ], [ - "e2ab3af3.e61a8" + "f3e7c870.e91ed" ], [ - "e43e94c.c297968" + "49534f95.047038" ], [ - "b06c80f3.f1642" + "48e4e2bb.9bb35c" ] ] }, { - "id": "d39289fb.9f759", + "id": "eb8571ec.dd894", "type": "switch", - "z": "246abd43.838a5a", + "z": "20bc0424.146724", "name": "", "property": "payload", "propertyType": "msg", @@ -1325,24 +1839,24 @@ "checkall": "true", "repair": false, "outputs": 3, - "x": 470, + "x": 410, "y": 40, "wires": [ [ - "267bd959.17b856" + "2981833a.c8f3f4" ], [ - "265e58c6.06de38" + "a9bc22d0.246c98" ], [ - "a433c901.2abd48" + "13f11422.180f9c" ] ] }, { - "id": "267bd959.17b856", + "id": "2981833a.c8f3f4", "type": "change", - "z": "246abd43.838a5a", + "z": "20bc0424.146724", "name": "The pump has started", "rules": [ { @@ -1362,14 +1876,14 @@ "y": 40, "wires": [ [ - "3b6b4fd4.8c3368" + "1b713e4c.48b6ca" ] ] }, { - "id": "265e58c6.06de38", + "id": "a9bc22d0.246c98", "type": "change", - "z": "246abd43.838a5a", + "z": "20bc0424.146724", "name": "The pump has finished.", "rules": [ { @@ -1389,14 +1903,14 @@ "y": 80, "wires": [ [ - "3b6b4fd4.8c3368" + "1b713e4c.48b6ca" ] ] }, { - "id": "a433c901.2abd48", + "id": "13f11422.180f9c", "type": "change", - "z": "246abd43.838a5a", + "z": "20bc0424.146724", "name": "The pump has been stopped.", "rules": [ { @@ -1416,14 +1930,14 @@ "y": 120, "wires": [ [ - "3b6b4fd4.8c3368" + "1b713e4c.48b6ca" ] ] }, { - "id": "e2ab3af3.e61a8", + "id": "f3e7c870.e91ed", "type": "switch", - "z": "246abd43.838a5a", + "z": "20bc0424.146724", "name": "", "property": "payload", "propertyType": "msg", @@ -1447,24 +1961,24 @@ "checkall": "true", "repair": false, "outputs": 3, - "x": 470, - "y": 200, + "x": 410, + "y": 100, "wires": [ [ - "bd89c468.5a4f4" + "d070dadb.1463a" ], [ - "762ab12c.cc7e88" + "4c014eb.3f18a3" ], [ - "ecb1efe6.7cb968" + "c31116f4.7e8488" ] ] }, { - "id": "bd89c468.5a4f4", + "id": "d070dadb.1463a", "type": "change", - "z": "246abd43.838a5a", + "z": "20bc0424.146724", "name": "The focus has started", "rules": [ { @@ -1481,17 +1995,17 @@ "to": "", "reg": false, "x": 920, - "y": 200, + "y": 180, "wires": [ [ - "3b6b4fd4.8c3368" + "1b713e4c.48b6ca" ] ] }, { - "id": "762ab12c.cc7e88", + "id": "4c014eb.3f18a3", "type": "change", - "z": "246abd43.838a5a", + "z": "20bc0424.146724", "name": "The focus has finished.", "rules": [ { @@ -1508,17 +2022,17 @@ "to": "", "reg": false, "x": 910, - "y": 240, + "y": 220, "wires": [ [ - "3b6b4fd4.8c3368" + "1b713e4c.48b6ca" ] ] }, { - "id": "ecb1efe6.7cb968", + "id": "c31116f4.7e8488", "type": "change", - "z": "246abd43.838a5a", + "z": "20bc0424.146724", "name": "The focus has been stopped.", "rules": [ { @@ -1535,17 +2049,17 @@ "to": "", "reg": false, "x": 900, - "y": 280, + "y": 260, "wires": [ [ - "3b6b4fd4.8c3368" + "1b713e4c.48b6ca" ] ] }, { - "id": "e43e94c.c297968", + "id": "49534f95.047038", "type": "switch", - "z": "246abd43.838a5a", + "z": "20bc0424.146724", "name": "", "property": "payload", "propertyType": "msg", @@ -1574,28 +2088,27 @@ "checkall": "true", "repair": false, "outputs": 4, - "x": 470, - "y": 360, + "x": 410, + "y": 160, "wires": [ [ - "87a2aa4d.3590c8" + "bf293c7.2c0f14" ], [ - "da9f9e9b.7c9f5" + "ef3bc36b.edc53" ], [ - "1143b916.5047b7" + "8404a654.b21db" ], [ - "fa7f2eaf.0e6f1", - "3b6b4fd4.8c3368" + "738a3754.b91708" ] ] }, { - "id": "30c9c4c9.d46e3c", + "id": "a555d3d.d63e83", "type": "switch", - "z": "246abd43.838a5a", + "z": "20bc0424.146724", "name": "", "property": "payload", "propertyType": "msg", @@ -1614,21 +2127,21 @@ "checkall": "true", "repair": false, "outputs": 2, - "x": 650, - "y": 560, + "x": 670, + "y": 520, "wires": [ [ - "23e5c77c.4f63f" + "8b4cf492.155ee" ], [ - "5491334a.93cbfc" + "31fa24f3.9545bc" ] ] }, { - "id": "da9f9e9b.7c9f5", + "id": "ef3bc36b.edc53", "type": "change", - "z": "246abd43.838a5a", + "z": "20bc0424.146724", "name": "The acquisition has finished.", "rules": [ { @@ -1645,17 +2158,17 @@ "to": "", "reg": false, "x": 900, - "y": 400, + "y": 360, "wires": [ [ - "3b6b4fd4.8c3368" + "1b713e4c.48b6ca" ] ] }, { - "id": "1143b916.5047b7", + "id": "8404a654.b21db", "type": "change", - "z": "246abd43.838a5a", + "z": "20bc0424.146724", "name": "The acquisition has been stopped.", "rules": [ { @@ -1672,17 +2185,17 @@ "to": "", "reg": false, "x": 880, - "y": 440, + "y": 400, "wires": [ [ - "3b6b4fd4.8c3368" + "1b713e4c.48b6ca" ] ] }, { - "id": "87a2aa4d.3590c8", + "id": "bf293c7.2c0f14", "type": "change", - "z": "246abd43.838a5a", + "z": "20bc0424.146724", "name": "The acquisition has started", "rules": [ { @@ -1699,53 +2212,53 @@ "to": "", "reg": false, "x": 900, - "y": 360, + "y": 320, "wires": [ [ - "3b6b4fd4.8c3368" + "1b713e4c.48b6ca" ] ] }, { - "id": "fa7f2eaf.0e6f1", + "id": "738a3754.b91708", "type": "function", - "z": "246abd43.838a5a", + "z": "20bc0424.146724", "name": "img_counter.js", "func": "img_counter=global.get('img_counter')\nimg_counter=img_counter+1\nglobal.set('img_counter',img_counter)\nmsg.payload = img_counter\nreturn msg;", "outputs": 1, "noerr": 0, "x": 780, - "y": 480, + "y": 440, "wires": [ [ - "582d7204.ec89fc" + "cec2bb6c.85ec3" ] ] }, { - "id": "498b3d58.58b1a4", + "id": "4aa5af79.20b3c8", "type": "function", - "z": "246abd43.838a5a", + "z": "20bc0424.146724", "name": "obj_counter.js", "func": "obj_counter=global.get('obj_counter')\nobj_counter=obj_counter+1\nglobal.set('obj_counter',obj_counter)\nmsg.payload = obj_counter\nreturn msg;", "outputs": 1, "noerr": 0, "x": 780, - "y": 640, + "y": 580, "wires": [ [ - "67618ae5.b74864" + "d21603af.53b258" ] ] }, { - "id": "582d7204.ec89fc", + "id": "cec2bb6c.85ec3", "type": "ui_chart", - "z": "246abd43.838a5a", + "z": "20bc0424.146724", "name": "img_counter", - "group": "eb610eb9.84fae8", - "order": 2, - "width": 23, + "group": "1f183a1c.7d2846", + "order": 1, + "width": 24, "height": 2, "label": "img_counter", "chartType": "horizontalBar", @@ -1775,15 +2288,15 @@ "useOldStyle": false, "outputs": 1, "x": 950, - "y": 480, + "y": 440, "wires": [ [] ] }, { - "id": "b06c80f3.f1642", + "id": "48e4e2bb.9bb35c", "type": "switch", - "z": "246abd43.838a5a", + "z": "20bc0424.146724", "name": "", "property": "topic", "propertyType": "msg", @@ -1793,6 +2306,11 @@ "v": "receiver/segmentation", "vt": "str" }, + { + "t": "eq", + "v": "receiver/segmentation/name", + "vt": "str" + }, { "t": "eq", "v": "receiver/segmentation/object_id", @@ -1806,25 +2324,28 @@ ], "checkall": "true", "repair": false, - "outputs": 3, - "x": 470, - "y": 560, + "outputs": 4, + "x": 450, + "y": 540, "wires": [ [ - "30c9c4c9.d46e3c" + "a555d3d.d63e83" ], [ - "498b3d58.58b1a4" + "dec9dc45.e0709" ], [ - "33094026.f6e8c" + "4aa5af79.20b3c8" + ], + [ + "d5a84642.dc7618" ] ] }, { - "id": "5491334a.93cbfc", + "id": "31fa24f3.9545bc", "type": "change", - "z": "246abd43.838a5a", + "z": "20bc0424.146724", "name": "The segmentation has finished.", "rules": [ { @@ -1841,17 +2362,17 @@ "to": "", "reg": false, "x": 890, - "y": 600, + "y": 540, "wires": [ [ - "3b6b4fd4.8c3368" + "1b713e4c.48b6ca" ] ] }, { - "id": "23e5c77c.4f63f", + "id": "8b4cf492.155ee", "type": "change", - "z": "246abd43.838a5a", + "z": "20bc0424.146724", "name": "The segmentation has started", "rules": [ { @@ -1868,21 +2389,21 @@ "to": "", "reg": false, "x": 890, - "y": 560, + "y": 500, "wires": [ [ - "3b6b4fd4.8c3368" + "1b713e4c.48b6ca" ] ] }, { - "id": "67618ae5.b74864", + "id": "d21603af.53b258", "type": "ui_chart", - "z": "246abd43.838a5a", + "z": "20bc0424.146724", "name": "obj_counter", - "group": "eb610eb9.84fae8", - "order": 5, - "width": 23, + "group": "1f183a1c.7d2846", + "order": 2, + "width": 24, "height": 2, "label": "obj_counter", "chartType": "horizontalBar", @@ -1912,135 +2433,71 @@ "useOldStyle": false, "outputs": 1, "x": 950, - "y": 640, + "y": 580, "wires": [ [] ] }, { - "id": "3c29eb4.e570414", + "id": "7f712083.ec5c78", "type": "function", - "z": "246abd43.838a5a", - "name": "", + "z": "20bc0424.146724", + "name": "ex : area", "func": "msg.payload=msg.payload.object_area\nmsg.topic=\"area\"\n\nreturn msg;", "outputs": 1, "noerr": 0, - "x": 810, - "y": 700, + "x": 820, + "y": 640, "wires": [ [ - "84dfe51a.0e9fd" + "65556e24.4e09c" ] ] }, { - "id": "33094026.f6e8c", + "id": "d5a84642.dc7618", "type": "json", - "z": "246abd43.838a5a", + "z": "20bc0424.146724", "name": "", "property": "payload", "action": "", "pretty": false, "x": 650, - "y": 700, + "y": 640, "wires": [ [ - "3c29eb4.e570414" + "7f712083.ec5c78" ] ] }, { - "id": "9b672325.568a18", - "type": "exec", - "z": "246abd43.838a5a", - "command": "free -m | grep \"Mem\" | awk -F ' ' '{print $3}'", - "addpay": false, - "append": "", - "useSpawn": "", - "timer": "", - "name": "Get memory used", - "x": 750, - "y": 780, - "wires": [ - [ - "76a7ddb6.fbde64" - ], - [], - [] - ] - }, - { - "id": "7c9eaef6.142a4", - "type": "inject", - "z": "246abd43.838a5a", - "name": "", + "id": "1b713e4c.48b6ca", + "type": "ui_toast", + "z": "20bc0424.146724", + "position": "top right", + "displayTime": "3", + "highlight": "", + "sendall": true, + "outputs": 0, + "ok": "OK", + "cancel": "", + "raw": false, "topic": "", - "payload": "", - "payloadType": "num", - "repeat": "1", - "crontab": "", - "once": false, - "onceDelay": "", - "x": 570, - "y": 780, - "wires": [ - [ - "9b672325.568a18" - ] - ] + "name": "", + "x": 1260, + "y": 260, + "wires": [] }, { - "id": "76a7ddb6.fbde64", + "id": "65556e24.4e09c", "type": "ui_chart", - "z": "246abd43.838a5a", - "name": "", - "group": "eb610eb9.84fae8", - "order": 1, - "width": 0, - "height": 0, - "label": "Memory load", - "chartType": "line", - "legend": "false", - "xformat": "auto", - "interpolate": "linear", - "nodata": "", - "dot": true, - "ymin": "", - "ymax": "", - "removeOlder": 1, - "removeOlderPoints": "200", - "removeOlderUnit": "3600", - "cutout": 0, - "useOneColor": false, - "colors": [ - "#1f77b4", - "#aec7e8", - "#ff7f0e", - "#2ca02c", - "#98df8a", - "#d62728", - "#ff9896", - "#9467bd", - "#c5b0d5" - ], - "useOldStyle": false, - "outputs": 1, - "x": 950, - "y": 760, - "wires": [ - [] - ] - }, - { - "id": "84dfe51a.0e9fd", - "type": "ui_chart", - "z": "246abd43.838a5a", - "name": "", - "group": "eb610eb9.84fae8", - "order": 8, - "width": 0, - "height": 0, - "label": "chart", + "z": "20bc0424.146724", + "name": "chart area", + "group": "1f183a1c.7d2846", + "order": 3, + "width": 24, + "height": 7, + "label": "chart area", "chartType": "line", "legend": "false", "xformat": "HH:mm:ss", @@ -2067,34 +2524,16 @@ ], "useOldStyle": false, "outputs": 1, - "x": 970, - "y": 700, + "x": 960, + "y": 640, "wires": [ [] ] }, { - "id": "3b6b4fd4.8c3368", - "type": "ui_toast", - "z": "246abd43.838a5a", - "position": "top right", - "displayTime": "3", - "highlight": "", - "sendall": true, - "outputs": 0, - "ok": "OK", - "cancel": "", - "raw": false, - "topic": "", - "name": "", - "x": 1220, - "y": 360, - "wires": [] - }, - { - "id": "613bee5b.042fe", + "id": "dec9dc45.e0709", "type": "debug", - "z": "246abd43.838a5a", + "z": "20bc0424.146724", "name": "", "active": true, "tosidebar": true, @@ -2102,64 +2541,19 @@ "tostatus": false, "complete": "true", "targetType": "full", - "x": 240, - "y": 140, + "x": 690, + "y": 720, "wires": [] }, { - "id": "84801dc0.193d88", - "type": "mqtt-broker", - "z": "", - "name": "", - "broker": "127.0.0.1", - "port": "1883", - "clientid": "test", - "usetls": false, - "compatmode": false, - "keepalive": "60", - "cleansession": true, - "birthTopic": "", - "birthQos": "0", - "birthPayload": "", - "closeTopic": "", - "closeQos": "0", - "closePayload": "", - "willTopic": "", - "willQos": "0", - "willPayload": "" - }, - { - "id": "eb610eb9.84fae8", - "type": "ui_group", - "z": "", - "name": "MQTT Plots", - "tab": "2b97fe34.a699fa", - "order": 11, - "disp": true, - "width": "24", - "collapse": false - }, - { - "id": "1273b673.4a35ea", - "type": "subflow", - "name": "System Commands", - "info": "", - "category": "", - "in": [], - "out": [], - "env": [], - "color": "#FFCC66", - "icon": "node-red-dashboard/ui_button.png" - }, - { - "id": "44a78834.e8f8b8", + "id": "2c9233f6.a62024", "type": "ui_button", - "z": "1273b673.4a35ea", + "z": "7aea7e49.4a3c88", "name": "", - "group": "82b3caaa.0518", + "group": "1f044bf8.be704c", "order": 1, - "width": 0, - "height": 0, + "width": 12, + "height": 1, "passthru": false, "label": "Reboot", "tooltip": "", @@ -2169,18 +2563,18 @@ "payload": "off", "payloadType": "str", "topic": "reboot", - "x": 220, + "x": 240, "y": 80, "wires": [ [ - "aba9aac1.c2d198" + "bb7e6003.313188" ] ] }, { - "id": "a32bfa65.bc6b9", + "id": "6e86ac0a.07e534", "type": "exec", - "z": "1273b673.4a35ea", + "z": "7aea7e49.4a3c88", "command": "sudo", "addpay": true, "append": "", @@ -2197,14 +2591,14 @@ ] }, { - "id": "825c8791.c0bfb", + "id": "2b27e400.5709ac", "type": "ui_button", - "z": "1273b673.4a35ea", + "z": "7aea7e49.4a3c88", "name": "", - "group": "82b3caaa.0518", + "group": "1f044bf8.be704c", "order": 2, - "width": 0, - "height": 0, + "width": 12, + "height": 1, "passthru": false, "label": "Shutdown", "tooltip": "", @@ -2214,18 +2608,18 @@ "payload": "off", "payloadType": "str", "topic": "shutdown", - "x": 220, + "x": 240, "y": 140, "wires": [ [ - "aba9aac1.c2d198" + "bb7e6003.313188" ] ] }, { - "id": "aba9aac1.c2d198", + "id": "bb7e6003.313188", "type": "python3-function", - "z": "1273b673.4a35ea", + "z": "7aea7e49.4a3c88", "name": "action", "func": "#!/usr/bin/python\nimport smbus\nimport time\nbus = smbus.SMBus(1)\ntime.sleep(1)\n#turn off fan RGB\nbus.write_byte_data(0x0d, 0x07, 0x00)\nbus.write_byte_data(0x0d, 0x07, 0x00)\n\nmsg[\"payload\"] = str(msg[\"topic\"])+' now'\nreturn msg", "outputs": 1, @@ -2233,15 +2627,15 @@ "y": 100, "wires": [ [ - "72b7368a.abad3", - "a32bfa65.bc6b9" + "91077c4d.e71e48", + "6e86ac0a.07e534" ] ] }, { - "id": "72b7368a.abad3", + "id": "91077c4d.e71e48", "type": "exec", - "z": "1273b673.4a35ea", + "z": "7aea7e49.4a3c88", "command": "i2cdetect -y 1", "addpay": false, "append": "", @@ -2258,80 +2652,13 @@ ] }, { - "id": "82b3caaa.0518", - "type": "ui_group", - "z": "", - "name": "Commands", - "tab": "2b97fe34.a699fa", - "order": 12, - "disp": true, - "width": 24, - "collapse": false - }, - { - "id": "506e9090.6e905", - "type": "subflow", - "name": "Object metadata", - "info": "", - "category": "", - "in": [ - { - "x": 40, - "y": 40, - "wires": [ - { - "id": "4ab4976c.eee488" - }, - { - "id": "581c8a23.83fa8c" - }, - { - "id": "52052007.b3d0e" - } - ] - } - ], - "out": [ - { - "x": 1060, - "y": 159, - "wires": [ - { - "id": "26b33a5c.0ef82e", - "port": 0 - }, - { - "id": "9ee0935a.415808", - "port": 0 - } - ] - }, - { - "x": 1060, - "y": 59, - "wires": [ - { - "id": "d3875217.e3b668", - "port": 0 - }, - { - "id": "82fef572.49b5f", - "port": 0 - } - ] - } - ], - "env": [], - "color": "#DDAA99" - }, - { - "id": "26b33a5c.0ef82e", + "id": "d7ac6b26.75e388", "type": "ui_numeric", - "z": "506e9090.6e905", + "z": "672ac548.1a9bac", "name": "object_depth_min", "label": "Minimum depth (m)", "tooltip": "", - "group": "f377d75b.32d27", + "group": "2f95b761.bd818", "order": 3, "width": 0, "height": 0, @@ -2349,13 +2676,13 @@ ] }, { - "id": "9ee0935a.415808", + "id": "70dcbf49.4b0e6", "type": "ui_numeric", - "z": "506e9090.6e905", + "z": "672ac548.1a9bac", "name": "object_depth_max", "label": "Maximum depth (m)", "tooltip": "", - "group": "f377d75b.32d27", + "group": "2f95b761.bd818", "order": 2, "width": 0, "height": 0, @@ -2373,9 +2700,9 @@ ] }, { - "id": "4ab4976c.eee488", + "id": "46ef98a.3d3e8e8", "type": "function", - "z": "506e9090.6e905", + "z": "672ac548.1a9bac", "name": "get object_depth_min", "func": "msg.payload = msg.payload.object_depth_min;\nreturn msg;", "outputs": 1, @@ -2384,14 +2711,14 @@ "y": 120, "wires": [ [ - "26b33a5c.0ef82e" + "d7ac6b26.75e388" ] ] }, { - "id": "581c8a23.83fa8c", + "id": "e6b2a290.7593c8", "type": "function", - "z": "506e9090.6e905", + "z": "672ac548.1a9bac", "name": "get object_depth_max", "func": "msg.payload = msg.payload.object_depth_max;\nreturn msg;", "outputs": 1, @@ -2400,14 +2727,14 @@ "y": 160, "wires": [ [ - "9ee0935a.415808" + "70dcbf49.4b0e6" ] ] }, { - "id": "472998cd.45f588", + "id": "8cfa2316.5a9788", "type": "gpsd", - "z": "506e9090.6e905", + "z": "672ac548.1a9bac", "name": "", "hostname": "localhost", "port": "2947", @@ -2421,17 +2748,16 @@ "y": 220, "wires": [ [ - "52052007.b3d0e", - "ab40705d.43a5d" + "61bc4942.96a3d" ] ] }, { - "id": "7d5701.1e1981", + "id": "7d5ce5c2.2cb0f4", "type": "ui_worldmap", - "z": "506e9090.6e905", + "z": "672ac548.1a9bac", "d": true, - "group": "f377d75b.32d27", + "group": "2f95b761.bd818", "order": 1, "width": 0, "height": 0, @@ -2456,9 +2782,9 @@ "wires": [] }, { - "id": "52052007.b3d0e", + "id": "61bc4942.96a3d", "type": "function", - "z": "506e9090.6e905", + "z": "672ac548.1a9bac", "name": "get object_lat & object_lon", "func": "\nreturn msg;", "outputs": 1, @@ -2467,162 +2793,42 @@ "y": 200, "wires": [ [ - "7d5701.1e1981" + "7d5ce5c2.2cb0f4" ] ] }, { - "id": "d3875217.e3b668", + "id": "415b9f0c.5f0b48", "type": "function", - "z": "506e9090.6e905", + "z": "672ac548.1a9bac", "name": "set object_time", "func": "var time = new Date(msg.payload);\n\nvar hour = time.getUTCHours();\nif (hour<10){hour = \"0\"+hour;}\nvar minute = time.getUTCMinutes();\nif (minute<10){minute = \"0\"+minute;}\n\nvar time_UTC = \"\"+hour+minute;\nglobal.set('object_time',time_UTC);\nreturn msg;", "outputs": 1, "noerr": 0, - "x": 804, + "x": 620, "y": 80, "wires": [ [] ] }, { - "id": "82fef572.49b5f", + "id": "3e9ae6e6.35b942", "type": "function", - "z": "506e9090.6e905", + "z": "672ac548.1a9bac", "name": "set object_date", "func": "var date = new Date(msg.payload);\n\nvar year = date.getUTCFullYear();\nvar month = date.getUTCMonth()+1;\nif (month<10){month = \"0\"+month;}\nvar day = date.getUTCDate();\nif (day<10){day = \"0\"+day;}\n\nvar date_UTC = \"\"+year+month+day;\nglobal.set('object_date',date_UTC);\n\nreturn msg;", "outputs": 1, "noerr": 0, - "x": 804, + "x": 620, "y": 40, "wires": [ [] ] }, { - "id": "ab40705d.43a5d", - "type": "debug", - "z": "506e9090.6e905", - "name": "", - "active": true, - "tosidebar": true, - "console": false, - "tostatus": false, - "complete": "true", - "targetType": "full", - "x": 280, - "y": 360, - "wires": [] - }, - { - "id": "f377d75b.32d27", - "type": "ui_group", - "z": "", - "name": "Object metadata", - "tab": "2b97fe34.a699fa", - "order": 6, - "disp": true, - "width": "24", - "collapse": false - }, - { - "id": "97d77aeb.75afd8", - "type": "subflow", - "name": "Acquisition metadata", - "info": "", - "category": "", - "in": [ - { - "x": 50, - "y": 30, - "wires": [ - { - "id": "282cae65.749e9a" - }, - { - "id": "cc899daf.a8d5d8" - }, - { - "id": "9873f1c8.6cb608" - }, - { - "id": "e53df171.eed68" - }, - { - "id": "5f728563.cf6214" - }, - { - "id": "c1a5eaf5.8691c" - }, - { - "id": "86c63d98.eb21" - }, - { - "id": "3707a612.b8619a" - }, - { - "id": "b2d20d5d.fd9e38" - } - ] - } - ], - "out": [ - { - "x": 740, - "y": 40, - "wires": [ - { - "id": "3b267291.1eee26", - "port": 0 - }, - { - "id": "435a2dcf.a1a60c", - "port": 0 - }, - { - "id": "cc6cb58d.b2dbe8", - "port": 0 - }, - { - "id": "8b306bbc.914", - "port": 0 - }, - { - "id": "2a5a2b7a.f218d4", - "port": 0 - }, - { - "id": "28df07d8.d71ba8", - "port": 0 - }, - { - "id": "6cf2c1ac.a0fea8", - "port": 0 - }, - { - "id": "e7c4132f.f4417", - "port": 0 - } - ] - }, - { - "x": 900, - "y": 360, - "wires": [ - { - "id": "1e688c91.1b805b", - "port": 0 - } - ] - } - ], - "env": [], - "color": "#DDAA99" - }, - { - "id": "1e688c91.1b805b", + "id": "79923da9.365d7c", "type": "function", - "z": "97d77aeb.75afd8", + "z": "5163a57b.0008b4", "name": "set optical config", "func": "global.set(msg.topic,msg.payload);\nvar acq_fnumber_objective = String(global.get(msg.topic));\n\nswitch(acq_fnumber_objective) {\n case \"25\":\n global.set(\"acq_magnification\",0.6);\n global.set(\"process_pixel\",1.86);\n global.set(\"sug_min\",60);\n global.set(\"sug_max\",670);\n global.set(\"sug_flowrate\",3);\n break;\n case \"16\":\n global.set(\"acq_magnification\",0.94);\n global.set(\"process_pixel\",1.19);\n global.set(\"sug_min\",40);\n global.set(\"sug_max\",430);\n global.set(\"sug_flowrate\",2.4);\n break;\n case \"12\":\n global.set(\"acq_magnification\",1.20);\n global.set(\"process_pixel\",0.94);\n global.set(\"sug_min\",30);\n global.set(\"sug_max\",340);\n global.set(\"sug_flowrate\",1.25);\n break;\n case \"8\":\n global.set(\"acq_magnification\",1.78);\n global.set(\"process_pixel\",0.63);\n global.set(\"sug_min\",20);\n global.set(\"sug_max\",230);\n global.set(\"sug_flowrate\",0.42);\n break;\n case \"6\":\n global.set(\"acq_magnification\",2.36);\n global.set(\"process_pixel\",0.48);\n global.set(\"sug_min\",15);\n global.set(\"sug_max\",170);\n global.set(\"sug_flowrate\",0.32);\n break;\n}\nreturn msg;", "outputs": 1, @@ -2634,14 +2840,14 @@ ] }, { - "id": "2877f2f.211cc8e", + "id": "cba1919b.aae78", "type": "ui_dropdown", - "z": "97d77aeb.75afd8", + "z": "5163a57b.0008b4", "name": "acq_fnumber_objective", "label": "M12 Lens*", "tooltip": "", "place": "Select option", - "group": "60b93a5.a032344", + "group": "14742691.56c8c1", "order": 3, "width": 0, "height": 0, @@ -2679,18 +2885,18 @@ "y": 360, "wires": [ [ - "1e688c91.1b805b" + "79923da9.365d7c" ] ] }, { - "id": "8b306bbc.914", + "id": "ebcf7cae.9e21c8", "type": "ui_numeric", - "z": "97d77aeb.75afd8", + "z": "5163a57b.0008b4", "name": "acq_minimum_mesh", "label": "Min fraction size (μm)", "tooltip": "", - "group": "60b93a5.a032344", + "group": "14742691.56c8c1", "order": 8, "width": 0, "height": 0, @@ -2708,13 +2914,13 @@ ] }, { - "id": "2a5a2b7a.f218d4", + "id": "7291a2a3.c9a974", "type": "ui_numeric", - "z": "97d77aeb.75afd8", + "z": "5163a57b.0008b4", "name": "acq_maximum_mesh", "label": "Max fraction size (μm)", "tooltip": "", - "group": "60b93a5.a032344", + "group": "14742691.56c8c1", "order": 4, "width": 0, "height": 0, @@ -2732,13 +2938,13 @@ ] }, { - "id": "3b267291.1eee26", + "id": "52374b71.714fd4", "type": "ui_text_input", - "z": "97d77aeb.75afd8", + "z": "5163a57b.0008b4", "name": "acq_id", "label": "Acquisition unique ID*", "tooltip": "", - "group": "60b93a5.a032344", + "group": "14742691.56c8c1", "order": 1, "width": 0, "height": 0, @@ -2753,14 +2959,14 @@ ] }, { - "id": "cc6cb58d.b2dbe8", + "id": "2cf276d8.880672", "type": "ui_dropdown", - "z": "97d77aeb.75afd8", + "z": "5163a57b.0008b4", "name": "acq_celltype", "label": "Thickness flowcell*", "tooltip": "", "place": "Select option", - "group": "60b93a5.a032344", + "group": "14742691.56c8c1", "order": 7, "width": 0, "height": 0, @@ -2796,13 +3002,13 @@ ] }, { - "id": "28df07d8.d71ba8", + "id": "25294db5.4fe722", "type": "ui_text_input", - "z": "97d77aeb.75afd8", + "z": "5163a57b.0008b4", "name": "acq_volume", "label": "Volume to pass (ml)", "tooltip": "", - "group": "60b93a5.a032344", + "group": "14742691.56c8c1", "order": 2, "width": 0, "height": 0, @@ -2817,13 +3023,13 @@ ] }, { - "id": "435a2dcf.a1a60c", + "id": "858ed565.0993b8", "type": "ui_text_input", - "z": "97d77aeb.75afd8", + "z": "5163a57b.0008b4", "name": "acq_instrument", "label": "Acquisition instrument", "tooltip": "PlanktonScope V2.1", - "group": "60b93a5.a032344", + "group": "14742691.56c8c1", "order": 6, "width": 0, "height": 0, @@ -2838,9 +3044,9 @@ ] }, { - "id": "282cae65.749e9a", + "id": "7c09012f.b50098", "type": "function", - "z": "97d77aeb.75afd8", + "z": "5163a57b.0008b4", "name": "get acq_id", "func": "msg.payload = msg.payload.acq_id+1;\nreturn msg;", "outputs": 1, @@ -2849,14 +3055,14 @@ "y": 40, "wires": [ [ - "3b267291.1eee26" + "52374b71.714fd4" ] ] }, { - "id": "cc899daf.a8d5d8", + "id": "3e3b0646.cf9a1a", "type": "function", - "z": "97d77aeb.75afd8", + "z": "5163a57b.0008b4", "name": "get acq_instrument", "func": "msg.payload = msg.payload.acq_instrument;\nreturn msg;", "outputs": 1, @@ -2865,14 +3071,14 @@ "y": 80, "wires": [ [ - "435a2dcf.a1a60c" + "858ed565.0993b8" ] ] }, { - "id": "9873f1c8.6cb608", + "id": "2b4282c2.8752ae", "type": "function", - "z": "97d77aeb.75afd8", + "z": "5163a57b.0008b4", "name": "get acq_celltype", "func": "msg.payload = msg.payload.acq_celltype;\nreturn msg;", "outputs": 1, @@ -2881,14 +3087,14 @@ "y": 120, "wires": [ [ - "cc6cb58d.b2dbe8" + "2cf276d8.880672" ] ] }, { - "id": "e53df171.eed68", + "id": "90439ce.e3524e", "type": "function", - "z": "97d77aeb.75afd8", + "z": "5163a57b.0008b4", "name": "get acq_minimum_mesh", "func": "msg.payload = msg.payload.acq_minimum_mesh;\nreturn msg;", "outputs": 1, @@ -2897,14 +3103,14 @@ "y": 160, "wires": [ [ - "8b306bbc.914" + "ebcf7cae.9e21c8" ] ] }, { - "id": "5f728563.cf6214", + "id": "7f710823.92974", "type": "function", - "z": "97d77aeb.75afd8", + "z": "5163a57b.0008b4", "name": "get acq_maximum_mesh", "func": "msg.payload = msg.payload.acq_maximum_mesh;\nreturn msg;", "outputs": 1, @@ -2913,14 +3119,14 @@ "y": 200, "wires": [ [ - "2a5a2b7a.f218d4" + "7291a2a3.c9a974" ] ] }, { - "id": "c1a5eaf5.8691c", + "id": "9355d580.a2338", "type": "function", - "z": "97d77aeb.75afd8", + "z": "5163a57b.0008b4", "name": "get acq_volume", "func": "msg.payload = msg.payload.acq_volume;\nreturn msg;", "outputs": 1, @@ -2929,14 +3135,14 @@ "y": 240, "wires": [ [ - "28df07d8.d71ba8" + "25294db5.4fe722" ] ] }, { - "id": "b2d20d5d.fd9e38", + "id": "218c020a.2b0566", "type": "function", - "z": "97d77aeb.75afd8", + "z": "5163a57b.0008b4", "name": "get acq_fnumber_objective", "func": "msg.payload = msg.payload.acq_fnumber_objective;\nreturn msg;", "outputs": 1, @@ -2945,18 +3151,18 @@ "y": 360, "wires": [ [ - "2877f2f.211cc8e" + "cba1919b.aae78" ] ] }, { - "id": "6cf2c1ac.a0fea8", + "id": "4cfd49e3.3db3c", "type": "ui_numeric", - "z": "97d77aeb.75afd8", + "z": "5163a57b.0008b4", "name": "acq_min_esd", "label": "Minimum size to segment (μm)", "tooltip": "", - "group": "60b93a5.a032344", + "group": "14742691.56c8c1", "order": 9, "width": 0, "height": 0, @@ -2974,13 +3180,13 @@ ] }, { - "id": "e7c4132f.f4417", + "id": "7dbb773.926b488", "type": "ui_numeric", - "z": "97d77aeb.75afd8", + "z": "5163a57b.0008b4", "name": "acq_max_esd", "label": "Maximum size to segment (μm)", "tooltip": "", - "group": "60b93a5.a032344", + "group": "14742691.56c8c1", "order": 5, "width": 0, "height": 0, @@ -2998,9 +3204,9 @@ ] }, { - "id": "86c63d98.eb21", + "id": "c8be3f91.8686e", "type": "function", - "z": "97d77aeb.75afd8", + "z": "5163a57b.0008b4", "name": "get acq_min_esd", "func": "msg.payload = msg.payload.acq_min_esd;\nreturn msg;", "outputs": 1, @@ -3009,14 +3215,14 @@ "y": 280, "wires": [ [ - "6cf2c1ac.a0fea8" + "4cfd49e3.3db3c" ] ] }, { - "id": "3707a612.b8619a", + "id": "98bb1c89.99c7b8", "type": "function", - "z": "97d77aeb.75afd8", + "z": "5163a57b.0008b4", "name": "get acq_max_esd", "func": "msg.payload = msg.payload.acq_max_esd;\nreturn msg;", "outputs": 1, @@ -3025,65 +3231,14 @@ "y": 320, "wires": [ [ - "e7c4132f.f4417" + "7dbb773.926b488" ] ] }, { - "id": "60b93a5.a032344", - "type": "ui_group", - "z": "", - "name": "Acquisition metadata", - "tab": "2b97fe34.a699fa", - "order": 7, - "disp": true, - "width": "24", - "collapse": false - }, - { - "id": "9a45991b.365bc8", - "type": "subflow", - "name": "Pump actuation", - "info": "", - "category": "", - "in": [ - { - "x": 40, - "y": 40, - "wires": [ - { - "id": "eb7c01ae.d00358" - }, - { - "id": "642ae1f3.cf7d28" - } - ] - } - ], - "out": [ - { - "x": 700, - "y": 40, - "wires": [ - { - "id": "4485759b.52ee74", - "port": 0 - }, - { - "id": "3283f063.31c548", - "port": 0 - } - ] - } - ], - "env": [], - "color": "#A6BBCF", - "icon": "font-awesome/fa-recycle" - }, - { - "id": "6246d9ef.156bd", + "id": "1796cf8d.f042", "type": "function", - "z": "9a45991b.365bc8", + "z": "b1edcbe7.366f7", "name": "pump.js", "func": "state = global.get(\"state\");\n\nif (state == null){state=\"free\"}\n\nvar manual_volume= global.get(\"pump_manual_volume\");\nvar flowrate= global.get(\"pump_flowrate\");\n\nif (manual_volume === undefined || manual_volume === \"\" || manual_volume === null) {\n msg.topic = \"Missing entry :\"\n msg.payload = \"Volume to pass\";\n \n}else if (flowrate === undefined || flowrate === \"\" || flowrate === null) {\n msg.topic = \"Missing entry :\"\n msg.payload = \"Flowrate\";\n \n}else {\n volume = global.get(\"pump_manual_volume\");\n nb_step=volume*507\n msg.volume = volume;\n flowrate = global.get(\"pump_flowrate\");\n duration=(volume*60)/flowrate\n delay=(duration/nb_step)-0.005\n msg.topic = \"actuator/pump\";\n \n if(msg.payload === \"FORWARD\" & state===\"free\"){\n msg.payload='FORWARD '+delay+' '+nb_step;\n }\n if(msg.payload === \"BACKWARD\" & state===\"free\"){\n msg.payload='BACKWARD '+delay+' '+nb_step;\n }\n}\nreturn msg;", "outputs": 1, @@ -3092,17 +3247,17 @@ "y": 140, "wires": [ [ - "53bef09a.8102e" + "3b3a975.caa1a68" ] ], "info": "### Focusing\n##### focus.py `nb_step` `orientation`\n\n- `nb_step` : **integer** (from 1 to 100000) - number of step to perform by the stage (about 31um/step)\n- `orientation` : **string** - orientation of the focus either `up` or `down`\n\nExample:\n\n python3.7 $HOME/PlanktonScope/scripts/focus.py 650 up\n" }, { - "id": "2374d55d.a3e3a2", + "id": "3b125ba5.2878ac", "type": "ui_button", - "z": "9a45991b.365bc8", + "z": "b1edcbe7.366f7", "name": "BACKWARD", - "group": "4153382f.45437", + "group": "517b2aa5.93722c", "order": 2, "width": 6, "height": 1, @@ -3119,16 +3274,16 @@ "y": 120, "wires": [ [ - "6246d9ef.156bd" + "1796cf8d.f042" ] ] }, { - "id": "c8aa9753.f51c08", + "id": "daa07581.f5474", "type": "ui_button", - "z": "9a45991b.365bc8", + "z": "b1edcbe7.366f7", "name": "FORWARD", - "group": "4153382f.45437", + "group": "517b2aa5.93722c", "order": 4, "width": 6, "height": 1, @@ -3145,14 +3300,14 @@ "y": 160, "wires": [ [ - "6246d9ef.156bd" + "1796cf8d.f042" ] ] }, { - "id": "53bef09a.8102e", + "id": "3b3a975.caa1a68", "type": "switch", - "z": "9a45991b.365bc8", + "z": "b1edcbe7.366f7", "name": "", "property": "topic", "propertyType": "msg", @@ -3175,17 +3330,17 @@ "y": 140, "wires": [ [ - "4d3bf3c2.6a380c" + "70b4938.deb706c" ], [ - "d943e58a.e85fc" + "67845166.ed2bd8" ] ] }, { - "id": "d943e58a.e85fc", + "id": "67845166.ed2bd8", "type": "ui_toast", - "z": "9a45991b.365bc8", + "z": "b1edcbe7.366f7", "position": "dialog", "displayTime": "3", "highlight": "", @@ -3203,11 +3358,11 @@ ] }, { - "id": "eaa22490.6843d", + "id": "3bbe77de.da4bc", "type": "ui_button", - "z": "9a45991b.365bc8", + "z": "b1edcbe7.366f7", "name": "stop pump", - "group": "4153382f.45437", + "group": "517b2aa5.93722c", "order": 5, "width": 4, "height": 1, @@ -3224,44 +3379,44 @@ "y": 200, "wires": [ [ - "9e71b7a5.28dff8" + "e441856c.84eb58" ] ] }, { - "id": "4d3bf3c2.6a380c", + "id": "70b4938.deb706c", "type": "mqtt out", - "z": "9a45991b.365bc8", + "z": "b1edcbe7.366f7", "name": "", "topic": "", "qos": "", "retain": "", - "broker": "e8ab36cc.74d77", + "broker": "e6efd12e.dedae8", "x": 910, "y": 120, "wires": [] }, { - "id": "9e71b7a5.28dff8", + "id": "e441856c.84eb58", "type": "mqtt out", - "z": "9a45991b.365bc8", + "z": "b1edcbe7.366f7", "name": "", "topic": "", "qos": "", "retain": "", - "broker": "e8ab36cc.74d77", + "broker": "e6efd12e.dedae8", "x": 610, "y": 200, "wires": [] }, { - "id": "3283f063.31c548", + "id": "8cab4571.004668", "type": "ui_text_input", - "z": "9a45991b.365bc8", + "z": "b1edcbe7.366f7", "name": "pump_manual_volume", "label": "Volume to pass (ml)", "tooltip": "", - "group": "4153382f.45437", + "group": "517b2aa5.93722c", "order": 3, "width": 8, "height": 1, @@ -3276,9 +3431,9 @@ ] }, { - "id": "642ae1f3.cf7d28", + "id": "e3472832.6c2cc8", "type": "function", - "z": "9a45991b.365bc8", + "z": "b1edcbe7.366f7", "name": "get pump_manual_volume", "func": "msg.payload = msg.payload.pump_manual_volume;\nreturn msg;", "outputs": 1, @@ -3287,18 +3442,18 @@ "y": 80, "wires": [ [ - "3283f063.31c548" + "8cab4571.004668" ] ] }, { - "id": "4485759b.52ee74", + "id": "1f1c2de7.b242f2", "type": "ui_slider", - "z": "9a45991b.365bc8", + "z": "b1edcbe7.366f7", "name": "pump_flowrate", "label": "Flowrate (ml/min)*", "tooltip": "", - "group": "4153382f.45437", + "group": "517b2aa5.93722c", "order": 1, "width": 0, "height": 0, @@ -3315,9 +3470,9 @@ ] }, { - "id": "eb7c01ae.d00358", + "id": "66f2533e.b3080c", "type": "function", - "z": "9a45991b.365bc8", + "z": "b1edcbe7.366f7", "name": "get pump_flowrate", "func": "msg.payload = msg.payload.pump_flowrate;\nreturn msg;", "outputs": 1, @@ -3326,62 +3481,18 @@ "y": 40, "wires": [ [ - "4485759b.52ee74" + "1f1c2de7.b242f2" ] ] }, { - "id": "4153382f.45437", - "type": "ui_group", - "z": "", - "name": "Pump actuation", - "tab": "2b97fe34.a699fa", - "order": 5, - "disp": true, - "width": "24", - "collapse": false - }, - { - "id": "ac806d39.1682a8", - "type": "subflow", - "name": "Focus actuation", - "info": "", - "category": "", - "in": [ - { - "x": 40, - "y": 40, - "wires": [ - { - "id": "c631467a.569ba" - } - ] - } - ], - "out": [ - { - "x": 800, - "y": 200, - "wires": [ - { - "id": "97bf666e.4d3ad", - "port": 0 - } - ] - } - ], - "env": [], - "color": "#A6BBCF", - "icon": "node-red/sort.svg" - }, - { - "id": "97bf666e.4d3ad", + "id": "3df51223.81e336", "type": "ui_text_input", - "z": "ac806d39.1682a8", + "z": "3df4e02.36602a", "name": "focus_nb_step", "label": "Number of step(s)", "tooltip": "", - "group": "69433259.f306fc", + "group": "88613aab.984d18", "order": 2, "width": 8, "height": 1, @@ -3396,9 +3507,9 @@ ] }, { - "id": "c631467a.569ba", + "id": "ba9fc5ee.19aee8", "type": "function", - "z": "ac806d39.1682a8", + "z": "3df4e02.36602a", "name": "get focus_nb_step", "func": "msg.payload = msg.payload.focus_nb_step;\nreturn msg;", "outputs": 1, @@ -3407,16 +3518,16 @@ "y": 40, "wires": [ [ - "97bf666e.4d3ad" + "3df51223.81e336" ] ] }, { - "id": "8346f4af.5c0978", + "id": "eea8d416.05154", "type": "ui_button", - "z": "ac806d39.1682a8", + "z": "3df4e02.36602a", "name": "DOWN", - "group": "69433259.f306fc", + "group": "88613aab.984d18", "order": 3, "width": 6, "height": 1, @@ -3433,16 +3544,16 @@ "y": 120, "wires": [ [ - "350c388d.12cd28" + "89b8374.e9624c8" ] ] }, { - "id": "7ee30e1c.691bd", + "id": "28579233.6aa0e6", "type": "ui_button", - "z": "ac806d39.1682a8", + "z": "3df4e02.36602a", "name": "UP", - "group": "69433259.f306fc", + "group": "88613aab.984d18", "order": 1, "width": 6, "height": 1, @@ -3459,14 +3570,14 @@ "y": 81, "wires": [ [ - "350c388d.12cd28" + "89b8374.e9624c8" ] ] }, { - "id": "a2f04fac.5a338", + "id": "43bc6030.03b3b8", "type": "switch", - "z": "ac806d39.1682a8", + "z": "3df4e02.36602a", "name": "", "property": "topic", "propertyType": "msg", @@ -3489,17 +3600,17 @@ "y": 100, "wires": [ [ - "9fd904e.d1cbcf8" + "77e14fc9.c1287" ], [ - "ccd4fa1e.152" + "735be178.b56c28" ] ] }, { - "id": "ccd4fa1e.152", + "id": "735be178.b56c28", "type": "ui_toast", - "z": "ac806d39.1682a8", + "z": "3df4e02.36602a", "position": "dialog", "displayTime": "3", "highlight": "", @@ -3517,9 +3628,9 @@ ] }, { - "id": "350c388d.12cd28", + "id": "89b8374.e9624c8", "type": "function", - "z": "ac806d39.1682a8", + "z": "3df4e02.36602a", "name": "focus.js", "func": "state = global.get(\"state\");\n\nif (state == null){state=\"free\"}\n\nvar nb_step= global.get(\"focus_nb_step\");\n\nif (nb_step === undefined || nb_step === \"\" || nb_step === null) {\n msg.topic = \"Missing entry :\"\n msg.payload = \"Number of steps\";\n \n}else {\n nb_step= global.get(\"focus_nb_step\");\n if(msg.payload === \"UP\" & state===\"free\"){\n msg.payload=\"FORWARD \"+nb_step;\n }\n if(msg.payload === \"DOWN\" & state===\"free\"){\n msg.payload=\"BACKWARD \"+nb_step;\n }\n}\nreturn msg;", "outputs": 1, @@ -3528,17 +3639,17 @@ "y": 100, "wires": [ [ - "a2f04fac.5a338" + "43bc6030.03b3b8" ] ], "info": "### Focusing\n##### focus.py `nb_step` `orientation`\n\n- `nb_step` : **integer** (from 1 to 100000) - number of step to perform by the stage (about 31um/step)\n- `orientation` : **string** - orientation of the focus either `up` or `down`\n\nExample:\n\n python3.7 $HOME/PlanktonScope/scripts/focus.py 650 up\n" }, { - "id": "da904b2b.4a1d68", + "id": "c96e9b7a.34961", "type": "ui_button", - "z": "ac806d39.1682a8", + "z": "3df4e02.36602a", "name": "stop focus", - "group": "69433259.f306fc", + "group": "88613aab.984d18", "order": 4, "width": 4, "height": 1, @@ -3555,137 +3666,44 @@ "y": 160, "wires": [ [ - "8bb9c09d.bc8178" + "f22aeb5d.5a0d2" ] ] }, { - "id": "9fd904e.d1cbcf8", + "id": "77e14fc9.c1287", "type": "mqtt out", - "z": "ac806d39.1682a8", + "z": "3df4e02.36602a", "name": "", "topic": "", "qos": "", "retain": "", - "broker": "e8ab36cc.74d77", + "broker": "e6efd12e.dedae8", "x": 950, "y": 80, "wires": [] }, { - "id": "8bb9c09d.bc8178", + "id": "f22aeb5d.5a0d2", "type": "mqtt out", - "z": "ac806d39.1682a8", + "z": "3df4e02.36602a", "name": "", "topic": "", "qos": "", "retain": "", - "broker": "e8ab36cc.74d77", + "broker": "e6efd12e.dedae8", "x": 650, "y": 160, "wires": [] }, { - "id": "69433259.f306fc", - "type": "ui_group", - "z": "", - "name": "Focus actuation", - "tab": "2b97fe34.a699fa", - "order": 4, - "disp": true, - "width": "24", - "collapse": false - }, - { - "id": "e8ab36cc.74d77", - "type": "mqtt-broker", - "z": "", - "name": "", - "broker": "0.0.0.0", - "port": "1883", - "clientid": "Client_node", - "usetls": false, - "compatmode": false, - "keepalive": "60", - "cleansession": true, - "birthTopic": "", - "birthQos": "0", - "birthPayload": "", - "closeTopic": "", - "closeQos": "0", - "closePayload": "", - "willTopic": "", - "willQos": "0", - "willPayload": "" - }, - { - "id": "5c6dd7ee.546fa8", - "type": "subflow", - "name": "Sample metadata", - "info": "", - "category": "", - "in": [ - { - "x": 40, - "y": 40, - "wires": [ - { - "id": "730e3aa0.75f6dc" - }, - { - "id": "b49441ee.07b358" - }, - { - "id": "77454044.f47e88" - }, - { - "id": "203e3416.6c480c" - }, - { - "id": "3555467a.6ba1ea" - } - ] - } - ], - "out": [ - { - "x": 840, - "y": 40, - "wires": [ - { - "id": "419967b7.b9b5f", - "port": 0 - }, - { - "id": "9b3f7b46.107718", - "port": 0 - }, - { - "id": "6f24740b.fbae5c", - "port": 0 - }, - { - "id": "bf7a47c8.a960b8", - "port": 0 - }, - { - "id": "327afe96.262122", - "port": 0 - } - ] - } - ], - "env": [], - "color": "#DDAA99" - }, - { - "id": "6f24740b.fbae5c", + "id": "ccb4ce9e.4f9108", "type": "ui_text_input", - "z": "5c6dd7ee.546fa8", + "z": "6bc47c75.93e24c", "name": "sample_ship", "label": "Name of the ship", "tooltip": "", - "group": "417f91c9.193ab", + "group": "bfdb5a44.4223", "order": 2, "width": 0, "height": 0, @@ -3694,20 +3712,20 @@ "delay": 300, "topic": "sample_ship", "x": 590, - "y": 120, + "y": 160, "wires": [ [] ] }, { - "id": "327afe96.262122", + "id": "50431d7c.cc673c", "type": "ui_dropdown", - "z": "5c6dd7ee.546fa8", + "z": "6bc47c75.93e24c", "name": "sample_sampling_gear", "label": "Sampling gear", "tooltip": "", "place": "Select", - "group": "417f91c9.193ab", + "group": "bfdb5a44.4223", "order": 4, "width": 0, "height": 0, @@ -3742,19 +3760,19 @@ "payload": "", "topic": "sample_sampling_gear", "x": 550, - "y": 200, + "y": 240, "wires": [ [] ] }, { - "id": "bf7a47c8.a960b8", + "id": "d76b1790.9ffc2", "type": "ui_text_input", - "z": "5c6dd7ee.546fa8", + "z": "6bc47c75.93e24c", "name": "sample_operator", "label": "Name of the operator", "tooltip": "", - "group": "417f91c9.193ab", + "group": "bfdb5a44.4223", "order": 3, "width": 0, "height": 0, @@ -3763,19 +3781,19 @@ "delay": 300, "topic": "sample_operator", "x": 570, - "y": 160, + "y": 200, "wires": [ [] ] }, { - "id": "419967b7.b9b5f", + "id": "412da17d.09c39", "type": "ui_text_input", - "z": "5c6dd7ee.546fa8", + "z": "6bc47c75.93e24c", "name": "sample_project", "label": "Name of the project*", "tooltip": "", - "group": "417f91c9.193ab", + "group": "bfdb5a44.4223", "order": 1, "width": 0, "height": 0, @@ -3784,19 +3802,19 @@ "delay": 300, "topic": "sample_project", "x": 580, - "y": 40, + "y": 80, "wires": [ [] ] }, { - "id": "9b3f7b46.107718", + "id": "236eeefd.7d50f2", "type": "ui_text_input", - "z": "5c6dd7ee.546fa8", + "z": "6bc47c75.93e24c", "name": "sample_id", "label": "ID of the station*", "tooltip": "", - "group": "417f91c9.193ab", + "group": "bfdb5a44.4223", "order": 5, "width": 0, "height": 0, @@ -3805,171 +3823,162 @@ "delay": 300, "topic": "sample_id", "x": 590, - "y": 80, + "y": 120, "wires": [ [] ] }, { - "id": "730e3aa0.75f6dc", + "id": "a4b7cb08.270d", "type": "function", - "z": "5c6dd7ee.546fa8", + "z": "6bc47c75.93e24c", "name": "get sample_projet", "func": "msg.payload = msg.payload.sample_project;\nreturn msg;", "outputs": 1, "noerr": 0, "x": 250, - "y": 40, + "y": 80, "wires": [ [ - "419967b7.b9b5f" + "412da17d.09c39" ] ] }, { - "id": "77454044.f47e88", + "id": "acfe2f.33fd31d", "type": "function", - "z": "5c6dd7ee.546fa8", + "z": "6bc47c75.93e24c", "name": "get sample_ship", "func": "msg.payload = msg.payload.sample_ship;\nreturn msg;", "outputs": 1, "noerr": 0, "x": 240, + "y": 160, + "wires": [ + [ + "ccb4ce9e.4f9108" + ] + ] + }, + { + "id": "d7cff063.331ff8", + "type": "function", + "z": "6bc47c75.93e24c", + "name": "get sample_id", + "func": "msg.payload = msg.payload.sample_id+1;\nreturn msg;", + "outputs": 1, + "noerr": 0, + "x": 240, "y": 120, "wires": [ [ - "6f24740b.fbae5c" + "236eeefd.7d50f2" ] ] }, { - "id": "b49441ee.07b358", + "id": "cfaa2598.c63ec", "type": "function", - "z": "5c6dd7ee.546fa8", - "name": "get sample_id", - "func": "msg.payload = msg.payload.sample_id+1;\nreturn msg;", - "outputs": 1, - "noerr": 0, - "x": 240, - "y": 80, - "wires": [ - [ - "9b3f7b46.107718" - ] - ] - }, - { - "id": "203e3416.6c480c", - "type": "function", - "z": "5c6dd7ee.546fa8", + "z": "6bc47c75.93e24c", "name": "get sample_operator", "func": "msg.payload = msg.payload.sample_operator;\nreturn msg;", "outputs": 1, "noerr": 0, "x": 260, - "y": 160, + "y": 200, "wires": [ [ - "bf7a47c8.a960b8" + "d76b1790.9ffc2" ] ] }, { - "id": "3555467a.6ba1ea", + "id": "25201379.163e3c", "type": "function", - "z": "5c6dd7ee.546fa8", + "z": "6bc47c75.93e24c", "name": "get sample_sampling_gear", "func": "msg.payload = msg.payload.sample_sampling_gear;\nreturn msg;", "outputs": 1, "noerr": 0, "x": 280, - "y": 200, + "y": 240, "wires": [ [ - "327afe96.262122" + "50431d7c.cc673c" ] ] }, { - "id": "417f91c9.193ab", - "type": "ui_group", - "z": "", - "name": "Sample metadata", - "tab": "2b97fe34.a699fa", - "order": 2, - "disp": true, + "id": "80851464.e5fcf", + "type": "ui_template", + "z": "6bc47c75.93e24c", + "group": "bfdb5a44.4223", + "name": "", + "order": 5, "width": "24", - "collapse": false + "height": "2", + "format": "
Fill the different inputs concerning the sample you would to image.
", + "storeOutMessages": true, + "fwdInMessages": true, + "templateScope": "local", + "x": 290, + "y": 40, + "wires": [ + [] + ] }, { - "id": "2b97fe34.a699fa", - "type": "ui_tab", - "z": "", - "name": "GUI", - "icon": "fa-eyedropper", - "order": 2, - "disabled": false, - "hidden": false - }, - { - "id": "bb8dbe68.7e20a", - "type": "tab", - "label": "Main", - "disabled": false, - "info": "" - }, - { - "id": "20340bb6.5f923c", + "id": "9ee31ce7.88d9c", "type": "function", - "z": "bb8dbe68.7e20a", + "z": "c4414305.176578", "name": "get global", "func": "msg.payload={\n \n \"sample_project\":global.get(\"sample_project\"),\n \"sample_id\":global.get(\"sample_id\"),\n \"sample_ship\":global.get(\"sample_ship\"),\n \"sample_operator\":global.get(\"sample_operator\"),\n \"sample_sampling_gear\":global.get(\"sample_sampling_gear\"),\n \n \"acq_id\":global.get(\"acq_id\"),\n \"acq_instrument\":global.get(\"acq_instrument\"),\n //\"acq_instrument_id\":global.get(\"acq_instrument_id\"),\n \"acq_celltype\":global.get(\"acq_celltype\"),\n \"acq_minimum_mesh\":global.get(\"acq_minimum_mesh\"),\n \"acq_maximum_mesh\":global.get(\"acq_maximum_mesh\"),\n \"acq_min_esd\":global.get(\"acq_min_esd\"),\n \"acq_max_esd\":global.get(\"acq_max_esd\"),\n \"acq_volume\":global.get(\"acq_volume\"),\n \"acq_magnification\":global.get(\"magnification\"),\n \"acq_fnumber_objective\":global.get(\"acq_fnumber_objective\"),\n \n \"acq_camera_name\":\"Pi Camera V2.1 - 8MP\",\n \n \"object_date\":global.get(\"object_date\"),\n \"object_time\":global.get(\"object_time\"),\n \"object_lat\":global.get(\"object_lat\"),\n \"object_lon\":global.get(\"object_lon\"),\n \"object_depth_min\":global.get(\"object_depth_min\"),\n \"object_depth_max\":global.get(\"object_depth_max\"),\n \n \"custom_nb_frame\":global.get(\"custom_nb_frame\"),\n \"custom_nb_step\":global.get(\"custom_nb_step\"),\n \"custom_segmentation\":global.get(\"custom_segmentation\"),\n \"custom_sleep_before\":global.get(\"custom_sleep_before\"),\n \"focus_nb_step\":global.get(\"focus_nb_step\"),\n \"pump_flowrate\":global.get(\"pump_flowrate\"),\n \"pump_manual_volume\":global.get(\"pump_manual_volume\"),\n \n \"process_pixel\":global.get(\"process_pixel\"),\n \"process_id\":global.get(\"process_id\")\n \n \n};\nreturn msg;", "outputs": 1, "noerr": 0, - "x": 1260, - "y": 160, + "x": 1240, + "y": 120, "wires": [ [ - "d69f0eb1.d514d" + "3e15ea9d.8a1186" ] ] }, { - "id": "aed82ae1.3a7558", + "id": "6b6db57d.0ac41c", "type": "file", - "z": "bb8dbe68.7e20a", + "z": "c4414305.176578", "name": "", "filename": "/home/pi/PlanktonScope/config.json", "appendNewline": true, "createDir": true, "overwriteFile": "true", "encoding": "none", - "x": 1640, - "y": 160, + "x": 1660, + "y": 120, "wires": [ [] ] }, { - "id": "d69f0eb1.d514d", + "id": "3e15ea9d.8a1186", "type": "json", - "z": "bb8dbe68.7e20a", + "z": "c4414305.176578", "name": "config.json", "property": "payload", "action": "str", "pretty": true, "x": 1410, - "y": 160, + "y": 120, "wires": [ [ - "aed82ae1.3a7558" + "6b6db57d.0ac41c" ] ] }, { - "id": "b57ab8b0.7bfc4", + "id": "92f32906.e7cb08", "type": "file in", - "z": "bb8dbe68.7e20a", + "z": "c4414305.176578", "name": "", "filename": "/home/pi/PlanktonScope/config.json", "format": "utf8", @@ -3980,39 +3989,38 @@ "y": 80, "wires": [ [ - "5b6059c3.8d4fa8" + "11e61823.32d9a8" ] ], "info": "# PlanktonScope Help\nThis Node will read the content of the file named **config.txt** containing all the input placeholders.\n" }, { - "id": "7880a269.4817ac", + "id": "233acfba.0fa74", "type": "inject", - "z": "bb8dbe68.7e20a", + "z": "c4414305.176578", "name": "on_load", - "topic": "", - "payload": "", - "payloadType": "date", "repeat": "", "crontab": "", "once": true, "onceDelay": 0.1, + "topic": "", + "payload": "", + "payloadType": "date", "x": 120, "y": 80, "wires": [ [ - "b57ab8b0.7bfc4", - "10d8393.60498c7", - "dba45961.85d67", - "8231cfcc.0c5dd8" + "92f32906.e7cb08", + "8d581456.eb62f8", + "43ea9a81.af94a4" ] ], "info": "# PlanktonScope Help\nWhen the **Pi** is booting, **Node-RED** will be initiated and this node will be activated once and execute the following nodes." }, { - "id": "5b6059c3.8d4fa8", + "id": "11e61823.32d9a8", "type": "json", - "z": "bb8dbe68.7e20a", + "z": "c4414305.176578", "name": "config.json", "property": "payload", "action": "", @@ -4021,36 +4029,36 @@ "y": 80, "wires": [ [ - "9b872b59.667ee", - "67bab5e1.2c7dcc", - "8e5a1fb0.dc878", - "bfc59fc4.be21a8", - "80434aac.22226", - "a3453d30.ca9a28", - "e25e094c.60fb1" + "f5241d95.8c94a8", + "f7d7ea16.bcd9d8", + "7f1ce067.e4ae9", + "5c0870d2.949358", + "3687179c.9ab2e8", + "129419c2.cd531e", + "eb940d39.f6b0d" ] ] }, { - "id": "1b45a311.c993ed", + "id": "d00f18b.a005468", "type": "function", - "z": "bb8dbe68.7e20a", + "z": "c4414305.176578", "name": "set global", "func": "var value = msg.payload;\nvar key = msg.topic;\n\nglobal.set(key,value);\nreturn msg;", "outputs": 1, "noerr": 0, - "x": 1080, + "x": 1240, "y": 80, "wires": [ [ - "20340bb6.5f923c" + "9ee31ce7.88d9c" ] ] }, { - "id": "1d54c0bf.fbcf07", + "id": "ab1f24d.d9492d8", "type": "rpi-gpio out", - "z": "bb8dbe68.7e20a", + "z": "c4414305.176578", "name": "", "pin": "40", "set": "", @@ -4058,239 +4066,308 @@ "freq": "", "out": "out", "x": 440, - "y": 120, + "y": 180, "wires": [] }, { - "id": "7da863d0.f7d41c", + "id": "3977f843.8914b8", "type": "ui_template", - "z": "bb8dbe68.7e20a", - "group": "dc721eb.9ef51e", + "z": "c4414305.176578", + "group": "6b2a8cdd.9f43cc", "name": "Stream Pi Camera", "order": 1, "width": 24, - "height": 11, - "format": "
", + "height": 19, + "format": "
", "storeOutMessages": true, "fwdInMessages": true, + "resendOnRefresh": false, "templateScope": "local", - "x": 830, - "y": 320, + "x": 930, + "y": 440, "wires": [ [] ] }, { - "id": "10d8393.60498c7", + "id": "8d581456.eb62f8", "type": "function", - "z": "bb8dbe68.7e20a", + "z": "c4414305.176578", "name": "init LED", "func": "msg.payload=1;\nreturn msg;", "outputs": 1, "noerr": 0, "x": 280, - "y": 120, + "y": 180, "wires": [ [ - "1d54c0bf.fbcf07" + "ab1f24d.d9492d8" ] ] }, { - "id": "9b872b59.667ee", - "type": "subflow:5c6dd7ee.546fa8", - "z": "bb8dbe68.7e20a", + "id": "f5241d95.8c94a8", + "type": "subflow:6bc47c75.93e24c", + "z": "c4414305.176578", "name": "", "env": [], - "x": 830, - "y": 80, + "x": 930, + "y": 140, "wires": [ [ - "1b45a311.c993ed" + "d00f18b.a005468" ] ] }, { - "id": "a3453d30.ca9a28", - "type": "subflow:ac806d39.1682a8", - "z": "bb8dbe68.7e20a", + "id": "129419c2.cd531e", + "type": "subflow:3df4e02.36602a", + "z": "c4414305.176578", "name": "", "env": [], - "x": 820, - "y": 240, - "wires": [ - [ - "1b45a311.c993ed" - ] - ] - }, - { - "id": "e25e094c.60fb1", - "type": "subflow:9a45991b.365bc8", - "z": "bb8dbe68.7e20a", - "name": "", - "env": [], - "x": 820, - "y": 280, - "wires": [ - [ - "1b45a311.c993ed" - ] - ] - }, - { - "id": "67bab5e1.2c7dcc", - "type": "subflow:97d77aeb.75afd8", - "z": "bb8dbe68.7e20a", - "name": "", - "env": [], - "x": 840, - "y": 120, - "wires": [ - [ - "1b45a311.c993ed" - ], - [ - "20340bb6.5f923c" - ] - ] - }, - { - "id": "8e5a1fb0.dc878", - "type": "subflow:506e9090.6e905", - "z": "bb8dbe68.7e20a", - "name": "", - "env": [], - "x": 820, - "y": 160, - "wires": [ - [ - "1b45a311.c993ed" - ], - [ - "20340bb6.5f923c" - ] - ] - }, - { - "id": "14b78383.7457bc", - "type": "subflow:1273b673.4a35ea", - "z": "bb8dbe68.7e20a", - "name": "System commands", - "env": [], - "x": 830, - "y": 480, - "wires": [] - }, - { - "id": "e6403eaf.54f7e", - "type": "subflow:246abd43.838a5a", - "z": "bb8dbe68.7e20a", - "name": "", - "env": [], - "x": 840, - "y": 400, - "wires": [] - }, - { - "id": "bfc59fc4.be21a8", - "type": "subflow:99798a85.e62408", - "z": "bb8dbe68.7e20a", - "name": "process metadata", - "env": [], - "x": 830, - "y": 200, - "wires": [ - [ - "1b45a311.c993ed" - ] - ] - }, - { - "id": "80434aac.22226", - "type": "subflow:a156df1e.d37178", - "z": "bb8dbe68.7e20a", - "name": "Acquisition inputs", - "env": [], - "x": 830, + "x": 920, "y": 360, "wires": [ [ - "1b45a311.c993ed" + "d00f18b.a005468" + ] + ] + }, + { + "id": "eb940d39.f6b0d", + "type": "subflow:b1edcbe7.366f7", + "z": "c4414305.176578", + "name": "", + "env": [], + "x": 920, + "y": 400, + "wires": [ + [ + "d00f18b.a005468" + ] + ] + }, + { + "id": "f7d7ea16.bcd9d8", + "type": "subflow:5163a57b.0008b4", + "z": "c4414305.176578", + "name": "", + "env": [], + "x": 940, + "y": 180, + "wires": [ + [ + "d00f18b.a005468" + ], + [ + "9ee31ce7.88d9c" + ] + ] + }, + { + "id": "7f1ce067.e4ae9", + "type": "subflow:672ac548.1a9bac", + "z": "c4414305.176578", + "name": "", + "env": [], + "x": 920, + "y": 220, + "wires": [ + [ + "d00f18b.a005468" + ], + [ + "9ee31ce7.88d9c" + ] + ] + }, + { + "id": "7dd20df2.204fa4", + "type": "subflow:7aea7e49.4a3c88", + "z": "c4414305.176578", + "name": "RPi commands", + "env": [], + "x": 920, + "y": 680, + "wires": [] + }, + { + "id": "d207c3d7.bb3c7", + "type": "subflow:20bc0424.146724", + "z": "c4414305.176578", + "name": "", + "env": [], + "x": 320, + "y": 320, + "wires": [] + }, + { + "id": "5c0870d2.949358", + "type": "subflow:4d3786dd.dd79f", + "z": "c4414305.176578", + "name": "Process metadata", + "env": [], + "x": 930, + "y": 260, + "wires": [ + [ + "d00f18b.a005468" + ] + ] + }, + { + "id": "3687179c.9ab2e8", + "type": "subflow:4273b9bf.bb07a8", + "z": "c4414305.176578", + "name": "Acquisition inputs", + "env": [], + "x": 930, + "y": 540, + "wires": [ + [ + "d00f18b.a005468" ] ], "icon": "node-red-dashboard/ui_switch.png" }, { - "id": "dba45961.85d67", - "type": "subflow:6384a5e.e34465c", - "z": "bb8dbe68.7e20a", + "id": "43ea9a81.af94a4", + "type": "subflow:435c6174.e0c8b", + "z": "c4414305.176578", "name": "", "env": [], - "x": 300, - "y": 200, + "x": 320, + "y": 280, "wires": [] }, { - "id": "8231cfcc.0c5dd8", - "type": "subflow:e8320d42.9a3ad8", - "z": "bb8dbe68.7e20a", + "id": "da33ab49.07225", + "type": "subflow:3f0fd072.06e2c8", + "z": "c4414305.176578", "name": "", "env": [], - "x": 290, + "x": 930, + "y": 580, + "wires": [] + }, + { + "id": "d4475439.1b745", + "type": "comment", + "z": "c4414305.176578", + "name": "Inject config.json in GUI inputs", + "info": "", + "x": 660, + "y": 40, + "wires": [] + }, + { + "id": "ad502db0.d19c3", + "type": "comment", + "z": "c4414305.176578", + "name": "Edit config.json on changes", + "info": "", + "x": 1300, + "y": 40, + "wires": [] + }, + { + "id": "40d4f54b.baf6d4", + "type": "subflow:aafb7d9f.f516f", + "z": "c4414305.176578", + "name": "", + "env": [], + "x": 920, + "y": 720, + "wires": [] + }, + { + "id": "3ab2666b.b74962", + "type": "comment", + "z": "c4414305.176578", + "name": "Create and run python code receiving MQTT queries", + "info": "", + "x": 410, "y": 240, "wires": [] }, { - "id": "557afe0d.33d97", - "type": "subflow:97600dff.93378", - "z": "bb8dbe68.7e20a", - "name": "", - "env": [], - "x": 830, - "y": 440, + "id": "5562e88a.9f16a", + "type": "comment", + "z": "c4414305.176578", + "name": "On Load", + "info": "", + "x": 120, + "y": 40, "wires": [] }, { - "id": "af4f780b.068368", - "type": "ui_switch", - "z": "bb8dbe68.7e20a", - "name": "", - "label": "LED", - "tooltip": "", - "group": "9c86b3b7.54841", - "order": 10, - "width": 0, - "height": 0, - "passthru": true, - "decouple": "false", - "topic": "", - "style": "", - "onvalue": "true", - "onvalueType": "bool", - "onicon": "", - "oncolor": "", - "offvalue": "false", - "offvalueType": "bool", - "officon": "", - "offcolor": "", - "x": 270, - "y": 160, - "wires": [ - [ - "1d54c0bf.fbcf07" - ] - ] + "id": "efcdeb9b.9d257", + "type": "comment", + "z": "c4414305.176578", + "name": "Get metadata from config.json", + "info": "", + "x": 340, + "y": 40, + "wires": [] }, { - "id": "dc721eb.9ef51e", - "type": "ui_group", - "z": "", - "name": "Streaming camera", - "tab": "2b97fe34.a699fa", - "order": 3, - "disp": true, - "width": 24, - "collapse": false + "id": "55f198c4.c121d8", + "type": "comment", + "z": "c4414305.176578", + "name": "Turn on the white LED", + "info": "", + "x": 320, + "y": 140, + "wires": [] + }, + { + "id": "29c52f09.54d1f8", + "type": "comment", + "z": "c4414305.176578", + "name": "Visible on the GUI", + "info": "", + "x": 930, + "y": 40, + "wires": [] + }, + { + "id": "3308bd4b.d469b2", + "type": "comment", + "z": "c4414305.176578", + "name": "RPi", + "info": "", + "x": 890, + "y": 640, + "wires": [] + }, + { + "id": "8b58c123.c1ea68", + "type": "comment", + "z": "c4414305.176578", + "name": "Metadata", + "info": "", + "x": 900, + "y": 100, + "wires": [] + }, + { + "id": "ee4608b3.725f", + "type": "comment", + "z": "c4414305.176578", + "name": "Actuation", + "info": "", + "x": 900, + "y": 320, + "wires": [] + }, + { + "id": "adcdfe58.613838", + "type": "comment", + "z": "c4414305.176578", + "name": "Acquisition", + "info": "", + "x": 900, + "y": 500, + "wires": [] } ]