diff --git a/flows/main.json b/flows/main.json index e0bc546..f4a9d71 100644 --- a/flows/main.json +++ b/flows/main.json @@ -1,90 +1,77 @@ [ { - "id": "e8d4d920.35344", + "id": "eaae323a.31b3", "type": "tab", - "label": "Main", + "label": "Home", "disabled": false, "info": "" }, { - "id": "21b3da63.2cef2e", - "type": "subflow", - "name": "RPi Monitoring", - "info": "", - "category": "", - "in": [], - "out": [], - "env": [], - "color": "#87A980", - "icon": "node-red/status.svg" + "id": "b771c342.49603", + "type": "tab", + "label": "Sample", + "disabled": false, + "info": "" }, { - "id": "130e0533.4f1813", - "type": "subflow", - "name": "Acquisition actuation", - "info": "", - "category": "", - "in": [], - "out": [], - "env": [], - "color": "#A6BBCF", - "icon": "font-awesome/fa-camera" + "id": "bccd1f23.87219", + "type": "tab", + "label": "Optic Configuration", + "disabled": false, + "info": "" }, { - "id": "1bc3f9f9.1ee996", - "type": "subflow", - "name": "Acquisition inputs", - "info": "", - "category": "", - "in": [], - "out": [ - { - "x": 740, - "y": 40, - "wires": [ - { - "id": "d3caa802.6f22d8", - "port": 0 - }, - { - "id": "3a773a31.a6caee", - "port": 0 - }, - { - "id": "5d4c755a.800b44", - "port": 0 - } - ] - } - ], - "env": [], - "color": "#A6BBCF", - "icon": "node-red-contrib-camerapi/photo.png" + "id": "baa1e3d9.cb29d", + "type": "tab", + "label": "Fluidic Acquisition", + "disabled": false, + "info": "" }, { - "id": "714bd4fe.163ab4", + "id": "cb95299c.2817c8", + "type": "tab", + "label": "Segmentation", + "disabled": false, + "info": "" + }, + { + "id": "c1660bc.e7ff7f8", + "type": "tab", + "label": "Gallery", + "disabled": false, + "info": "" + }, + { + "id": "1371dec5.76e671", + "type": "tab", + "label": "Settings", + "disabled": false, + "info": "" + }, + { + "id": "1c24ad9c.bebec2", "type": "subflow", - "name": "Process metadata", - "info": "", + "name": "Config", + "info": "An input to this subflow will get the configuration to be saved to disk.\n\nOn startup, this node outputs the loaded configuration", "category": "", "in": [ { - "x": 40, - "y": 80, + "x": 440, + "y": 860, "wires": [ { - "id": "706715a3.5ad1c4" + "id": "b584292a.24b08" } ] } ], "out": [ { - "x": 700, - "y": 80, + "x": 1240, + "y": 300, "wires": [ { - "id": "7cdadcd1.736f04", + "id": "ad541674.4791c8", "port": 0 } ] @@ -94,507 +81,121 @@ "color": "#DDAA99" }, { - "id": "bee3b478.ef4b88", - "type": "subflow", - "name": "MQTT Receive & Plot", - "info": "# MQTT Topics follows this architecture:\n\n - actuator : This topic adresses the stepper control thread\n No publication under this topic should happen from Python\n - actuator/pump : Control of the pump\n The message is something like \"FORWARD 10 1\"\n to move 10mL forward at 1mL/min\n Receive only\n - actuator/focus : Control of the focus stage\n The message is something like \"UP 10\"\n to move up 10mm\n Receive only\n - imager/image : This topic adresses the imaging thread\n Receive only\n - status : This topics sends feedback to Node-Red\n No publication or receive at this level\n - status/pump : State of the pump\n Is one of Start, Done, Interrupted\n Publish only\n - status/focus : State of the focus stage\n Is one of Start, Done, Interrupted\n Publish only\n - status/imager : State of the imager\n Is one of Start, Completed or 12_11_15_0.1.jpg has been imaged.\n Publish only\n - status/segmentation : Status of the segmentation\n - status/segmentation/name\n - status/segmentation/object_id\n - status/segmentation/metric\n", - "category": "", - "in": [], - "out": [], - "env": [], - "color": "#F3B567", - "icon": "node-red/bridge.svg" - }, - { - "id": "9c3e6ad4.7471a8", - "type": "subflow", - "name": "System Commands", - "info": "", - "category": "", - "in": [], - "out": [], - "env": [], - "color": "#FFCC66", - "icon": "node-red-dashboard/ui_button.png" - }, - { - "id": "1a447be0.198674", - "type": "subflow", - "name": "Object metadata", - "info": "", - "category": "", - "in": [ - { - "x": 60, - "y": 160, - "wires": [ - { - "id": "5cdbcd15.17ec94" - }, - { - "id": "c2ccc2e1.a697f8" - }, - { - "id": "b3e8d04.7c83d3" - } - ] - } - ], - "out": [ - { - "x": 1060, - "y": 159, - "wires": [ - { - "id": "f435f66d.26d73", - "port": 0 - }, - { - "id": "79026dc4.133a7c", - "port": 0 - } - ] - }, - { - "x": 1060, - "y": 59, - "wires": [ - { - "id": "9c08f843.b1e1b", - "port": 0 - }, - { - "id": "157ba5ca.c88a52", - "port": 0 - } - ] - } - ], - "env": [], - "color": "#DDAA99" - }, - { - "id": "758bc08f.c57318", - "type": "subflow", - "name": "Acquisition metadata", - "info": "", - "category": "", - "in": [ - { - "x": 50, - "y": 30, - "wires": [ - { - "id": "f3658d30.b8448" - }, - { - "id": "5acd51d4.4ab13" - }, - { - "id": "de2c90cf.b73b08" - }, - { - "id": "5e3dec55.881074" - }, - { - "id": "d3ca8847.4d1ae" - }, - { - "id": "1f133196.96564e" - }, - { - "id": "3414b477.4d711c" - }, - { - "id": "a52e7caf.6bde48" - }, - { - "id": "68fa1227.dbdd5c" - } - ] - } - ], - "out": [ - { - "x": 740, - "y": 40, - "wires": [ - { - "id": "98d1f331.a06938", - "port": 0 - }, - { - "id": "3b9700c4.b93ec", - "port": 0 - }, - { - "id": "42505cbd.f02b1c", - "port": 0 - }, - { - "id": "2f9ae002.b4c96", - "port": 0 - }, - { - "id": "c86d98d4.c56538", - "port": 0 - }, - { - "id": "13b51e1e.1f603a", - "port": 0 - }, - { - "id": "6c391d10.2f9744", - "port": 0 - }, - { - "id": "163df12e.f73f5f", - "port": 0 - } - ] - }, - { - "x": 900, - "y": 360, - "wires": [ - { - "id": "701120fd.c5516", - "port": 0 - } - ] - } - ], - "env": [], - "color": "#DDAA99" - }, - { - "id": "977131e7.c2e76", - "type": "subflow", - "name": "Pump actuation", - "info": "", - "category": "", - "in": [], - "out": [ - { - "x": 700, - "y": 40, - "wires": [ - { - "id": "b8bf2a9.be099d8", - "port": 0 - }, - { - "id": "f1b85f22.ac673", - "port": 0 - } - ] - } - ], - "env": [], - "color": "#A6BBCF", - "icon": "font-awesome/fa-recycle" - }, - { - "id": "a0f9bde.423644", - "type": "subflow", - "name": "Focus actuation", - "info": "", - "category": "", - "in": [], - "out": [ - { - "x": 1040, - "y": 100, - "wires": [ - { - "id": "b69e435f.b93558", - "port": 0 - }, - { - "id": "d9930546.489a58", - "port": 0 - } - ] - } - ], - "env": [], - "color": "#A6BBCF", - "icon": "node-red/sort.svg" - }, - { - "id": "81483277.2521e", - "type": "subflow", - "name": "Sample metadata", - "info": "", - "category": "", - "in": [ - { - "x": 40, - "y": 40, - "wires": [ - { - "id": "d027a6bf.7049e8" - }, - { - "id": "45911c98.2bd83c" - }, - { - "id": "5a811caf.0f3144" - }, - { - "id": "1e09a4ab.72996b" - }, - { - "id": "a3272681.f271c8" - } - ] - } - ], - "out": [ - { - "x": 840, - "y": 40, - "wires": [ - { - "id": "adaccbb2.320458", - "port": 0 - }, - { - "id": "a63c1b66.f9a77", - "port": 0 - }, - { - "id": "67fc8b3f.96c6cc", - "port": 0 - }, - { - "id": "8cc6c6f1.65bf28", - "port": 0 - }, - { - "id": "91a896c8.7c9fb8", - "port": 0 - } - ] - } - ], - "env": [], - "color": "#DDAA99" - }, - { - "id": "4b508eab.dccae8", - "type": "subflow", - "name": "Segmentation control", - "info": "", - "category": "", - "in": [], - "out": [], - "env": [], - "color": "#D7D7A0", - "icon": "node-red/db.svg" - }, - { - "id": "674362b7.9b6574", - "type": "subflow", - "name": "Camera settings", - "info": "", - "category": "", - "in": [], - "out": [], - "env": [], - "color": "#3FADB5", - "icon": "font-awesome/fa-camera" - }, - { - "id": "d95291dc.83b0b8", - "type": "subflow", - "name": "Python Startup", - "info": "", - "category": "", - "in": [ - { - "x": 160, - "y": 40, - "wires": [ - { - "id": "afa9f4b.2e77988" - }, - { - "id": "35ea3cf0.a398ac" - }, - { - "id": "a776b9fc.d542e8" - } - ] - } - ], - "out": [], - "env": [], - "color": "#DDAA99" - }, - { - "id": "779606c9.19d2b8", + "id": "da2c279f.cbe318", "type": "ui_group", - "z": "", - "name": "Monitor RPi", - "tab": "a3de84cd.c01b6", - "order": 3, + "name": "Controller", + "tab": null, + "order": 6, "disp": true, - "width": "24", + "width": 6, "collapse": false }, { - "id": "75a5ce1f.728d", + "id": "833bc5bb.217ba8", "type": "ui_group", - "z": "", - "name": "Acquisition actuation", - "tab": "d10d9d99.00f4b8", - "order": 11, - "disp": true, - "width": 24, - "collapse": false - }, - { - "id": "758f41b8.1680c8", - "type": "ui_group", - "z": "", - "name": "Acquisition inputs", - "tab": "d10d9d99.00f4b8", - "order": 10, - "disp": true, - "width": "24", - "collapse": false - }, - { - "id": "eef6f881.7b3b38", - "type": "ui_group", - "z": "", - "name": "Process metadata", - "tab": "d10d9d99.00f4b8", - "order": 9, - "disp": true, - "width": 24, - "collapse": false - }, - { - "id": "6d1af0ab.7b4a18", - "type": "ui_group", - "z": "", - "name": "MQTT Plots", - "tab": "d10d9d99.00f4b8", - "order": 14, - "disp": true, - "width": "24", - "collapse": false - }, - { - "id": "ab1d06d6.bf9898", - "type": "ui_group", - "z": "", - "name": "Object metadata", - "tab": "d10d9d99.00f4b8", - "order": 2, - "disp": true, - "width": "24", - "collapse": true - }, - { - "id": "4361c3b6.e2b7a4", - "type": "ui_group", - "z": "", - "name": "Acquisition metadata", - "tab": "d10d9d99.00f4b8", - "order": 3, - "disp": true, - "width": "24", - "collapse": true - }, - { - "id": "34f03c4a.abdf94", - "type": "ui_group", - "z": "", - "name": "Pump actuation", - "tab": "d10d9d99.00f4b8", - "order": 8, - "disp": true, - "width": "24", - "collapse": false - }, - { - "id": "de7c8e82.7faa98", - "type": "ui_group", - "z": "", - "name": "Focus actuation", - "tab": "d10d9d99.00f4b8", - "order": 7, - "disp": true, - "width": "24", - "collapse": false - }, - { - "id": "8dc3722c.06efa8", - "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": "71c63dd4.311c44", - "type": "ui_group", - "z": "", - "name": "Sample Metadata", - "tab": "d10d9d99.00f4b8", + "name": "Preview", + "tab": "181bb236.1e94be", "order": 1, "disp": true, - "width": "24", - "collapse": true + "width": 14, + "collapse": false }, { - "id": "d10d9d99.00f4b8", + "id": "3a6bb13f.c9703e", "type": "ui_tab", - "z": "", - "name": "Acquisition", - "icon": "fa-eyedropper", + "name": "Home", + "icon": "home", "order": 1, "disabled": false, "hidden": false }, { - "id": "59434d8d.70ed94", - "type": "ui_group", - "z": "", - "name": "Streaming camera", - "tab": "d10d9d99.00f4b8", + "id": "181bb236.1e94be", + "type": "ui_tab", + "name": "Optic Configuration", + "icon": "fa-eye", + "order": 3, + "disabled": false, + "hidden": false + }, + { + "id": "c9194f02.9d5e9", + "type": "ui_tab", + "name": "Fluidic Acquisition", + "icon": "fa-flask", + "order": 4, + "disabled": false, + "hidden": false + }, + { + "id": "8d16beb8.9b3fb", + "type": "ui_tab", + "name": "Segmentation", + "icon": "fa-crop", "order": 5, + "disabled": false, + "hidden": false + }, + { + "id": "d9cd733b.ab73d", + "type": "ui_tab", + "name": "Settings", + "icon": "fa-cogs", + "order": 7, + "disabled": false, + "hidden": false + }, + { + "id": "4248342d.e55fac", + "type": "ui_group", + "name": "Optic Characterization", + "tab": "181bb236.1e94be", + "order": 2, "disp": true, - "width": "24", + "width": 10, "collapse": false }, { - "id": "9b06d49f.aa144", + "id": "858a0e3c.987fe", + "type": "ui_group", + "name": "Preview", + "tab": "c9194f02.9d5e9", + "order": 1, + "disp": true, + "width": "14", + "collapse": false + }, + { + "id": "64903b47.4034e4", + "type": "ui_group", + "z": "", + "name": "Navigation", + "tab": "8d16beb8.9b3fb", + "order": 2, + "disp": false, + "width": "6", + "collapse": false + }, + { + "id": "3da7da8f.179606", + "type": "ui_group", + "name": "Processor", + "tab": "d9cd733b.ab73d", + "order": 1, + "disp": true, + "width": "6", + "collapse": false + }, + { + "id": "cc8bc4eb.651868", "type": "ui_base", "theme": { "name": "theme-dark", "lightTheme": { "default": "#0094CE", - "baseColor": "#0094CE", + "baseColor": "#5900ce", "baseFont": "-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif", - "edited": true, + "edited": false, "reset": false }, "darkTheme": { @@ -614,7 +215,7 @@ "base-color": { "default": "#097479", "value": "#097479", - "edited": false + "edited": true }, "page-titlebar-backgroundColor": { "value": "#097479", @@ -664,28 +265,316 @@ } }, "site": { - "name": "PlanktoScope Dashboard", + "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 + "sx": 56, + "sy": 56, + "gx": 5, + "gy": 5, + "cx": 5, + "cy": 5, + "px": 5, + "py": 5 } } }, + { + "id": "36739a35.7cce36", + "type": "ui_tab", + "name": "Gallery", + "icon": "fa fa-file-image-o", + "order": 6, + "disabled": false, + "hidden": false + }, + { + "id": "c0ebfc57.42527", + "type": "ui_group", + "name": "Group 1", + "tab": "36739a35.7cce36", + "order": 1, + "disp": true, + "width": 6 + }, + { + "id": "737ec584.2eea2c", + "type": "ui_tab", + "name": "Sample", + "icon": "fa-eyedropper", + "order": 2, + "disabled": false, + "hidden": false + }, + { + "id": "6f97e7ae.270c48", + "type": "ui_group", + "name": "Group 1", + "tab": "3a6bb13f.c9703e", + "order": 1, + "disp": false, + "width": "4", + "collapse": false + }, + { + "id": "3e1ba03d.f01d8", + "type": "ui_group", + "name": "Sample Identification", + "tab": "737ec584.2eea2c", + "order": 1, + "disp": true, + "width": 24, + "collapse": false + }, + { + "id": "4e0cd5ea.17e59c", + "type": "ui_group", + "name": "Group 2", + "tab": "3a6bb13f.c9703e", + "order": 2, + "disp": false, + "width": "4", + "collapse": false + }, + { + "id": "ef590206.24f6", + "type": "ui_group", + "name": "Group 3", + "tab": "3a6bb13f.c9703e", + "order": 3, + "disp": false, + "width": "4", + "collapse": false + }, + { + "id": "ae8f6620.073358", + "type": "ui_group", + "name": "Group 4", + "tab": "3a6bb13f.c9703e", + "order": 4, + "disp": false, + "width": "4", + "collapse": false + }, + { + "id": "196518b2.4d53b7", + "type": "ui_group", + "name": "Group 5", + "tab": "3a6bb13f.c9703e", + "order": 5, + "disp": false, + "width": "4", + "collapse": false + }, + { + "id": "777a7c33.fcd804", + "type": "ui_group", + "name": "Group 6", + "tab": "3a6bb13f.c9703e", + "order": 6, + "disp": false, + "width": "4", + "collapse": false + }, + { + "id": "cef1e703.bcf3c8", + "type": "ui_group", + "name": "Net throw", + "tab": "737ec584.2eea2c", + "order": 2, + "disp": true, + "width": "24", + "collapse": false + }, + { + "id": "5517c651.b2f668", + "type": "ui_group", + "name": "Validation", + "tab": "737ec584.2eea2c", + "order": 4, + "disp": false, + "width": 24, + "collapse": false + }, + { + "id": "fbd92986.1028c8", + "type": "ui_group", + "name": "Focus Adjustment", + "tab": "181bb236.1e94be", + "order": 3, + "disp": true, + "width": 10, + "collapse": false + }, + { + "id": "707d9797.c8e798", + "type": "ui_group", + "name": "Fluidic Manual Manipulation", + "tab": "181bb236.1e94be", + "order": 4, + "disp": true, + "width": 14, + "collapse": false + }, + { + "id": "7a0b4877.a5d268", + "type": "ui_group", + "name": "Validation", + "tab": "181bb236.1e94be", + "order": 5, + "disp": false, + "width": "10", + "collapse": false + }, + { + "id": "567a49a4.244cb8", + "type": "ui_group", + "name": "Generic Information", + "tab": "c9194f02.9d5e9", + "order": 3, + "disp": true, + "width": 10, + "collapse": false + }, + { + "id": "404c301a.19c4e", + "type": "ui_group", + "name": "Fraction size", + "tab": "c9194f02.9d5e9", + "order": 2, + "disp": true, + "width": "10", + "collapse": false + }, + { + "id": "4322c187.e73e5", + "type": "ui_group", + "name": "Acquisition", + "tab": "c9194f02.9d5e9", + "order": 4, + "disp": true, + "width": 10, + "collapse": false + }, + { + "id": "b7919ae2.c01788", + "type": "ui_group", + "name": "Navigation", + "tab": "c9194f02.9d5e9", + "order": 6, + "disp": false, + "width": 10, + "collapse": false + }, + { + "id": "b5d61bc7.54fe48", + "type": "ui_group", + "name": "Config", + "tab": "c9194f02.9d5e9", + "order": 5, + "disp": false, + "width": "10", + "collapse": false + }, + { + "id": "1be83144.4fe4bf", + "type": "ui_group", + "name": "Danger Zone (DO NOT TOUCH HERE UNLESS YOU KNOW WHAT YOU ARE DOING)", + "tab": "d9cd733b.ab73d", + "order": 5, + "disp": true, + "width": 24, + "collapse": false + }, + { + "id": "3ca00bf9.e5cac4", + "type": "ui_group", + "z": "", + "name": "Navigation", + "tab": "d9cd733b.ab73d", + "order": 7, + "disp": false, + "width": "24", + "collapse": false + }, + { + "id": "b5ba3f26.2e722", + "type": "ui_group", + "name": "CPU Temperature", + "tab": "d9cd733b.ab73d", + "order": 2, + "disp": true, + "width": "6", + "collapse": false + }, + { + "id": "806d69c8.67fc58", + "type": "ui_group", + "name": "Memory", + "tab": "d9cd733b.ab73d", + "order": 3, + "disp": true, + "width": "6", + "collapse": false + }, + { + "id": "405183bc.d8991c", + "type": "ui_group", + "name": "Disk Usage", + "tab": "d9cd733b.ab73d", + "order": 4, + "disp": true, + "width": "6", + "collapse": false + }, + { + "id": "8dc3722c.06efa8", + "type": "mqtt-broker", + "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": "c669e9d3.b5cfd", + "type": "ui_spacer", + "name": "spacer", + "group": "4248342d.e55fac", + "order": 7, + "width": 10, + "height": 1 + }, + { + "id": "abeb6dad.635a2", + "type": "ui_group", + "z": "", + "name": "Control", + "tab": "8d16beb8.9b3fb", + "order": 1, + "disp": true, + "width": 12, + "collapse": false + }, { "id": "a3de84cd.c01b6", "type": "ui_tab", - "z": "", "name": "Management", "icon": "dashboard", "order": 2, @@ -693,239 +582,301 @@ "hidden": false }, { - "id": "adcd0ef7.81a7f8", - "type": "ui_group", - "z": "", - "name": "RPi commands (DANGER ZONE)", - "tab": "a3de84cd.c01b6", - "order": 2, - "disp": true, - "width": "24", - "collapse": false - }, - { - "id": "566dcd6a.03db74", - "type": "ui_group", - "z": "", - "name": "Segmentation control", - "tab": "d10d9d99.00f4b8", - "order": 12, - "disp": true, - "width": "24", - "collapse": false - }, - { - "id": "e8b67968.dea6", - "type": "ui_group", - "z": "", - "name": "Camera settings", - "tab": "d10d9d99.00f4b8", - "order": 6, - "disp": true, - "width": "24", - "collapse": true - }, - { - "id": "7b7849e8.363288", - "type": "ui_group", - "z": "1a447be0.198674", - "name": "GPS", - "tab": "d10d9d99.00f4b8", + "id": "6d0a997.393d868", + "type": "ui_spacer", + "name": "spacer", + "group": "567a49a4.244cb8", "order": 4, - "disp": true, - "width": "24", - "collapse": false - }, - { - "id": "91acd434.6205", - "type": "ui_group", - "z": "bee3b478.ef4b88", - "name": "Status", - "tab": "d10d9d99.00f4b8", - "order": 13, - "disp": true, - "width": "24", - "collapse": true - }, - { - "id": "75af537.47398ac", - "type": "ui_spacer", - "name": "spacer", - "group": "de7c8e82.7faa98", - "order": 7, - "width": 6, - "height": 1 - }, - { - "id": "3ba80beb.b6b564", - "type": "ui_spacer", - "name": "spacer", - "group": "de7c8e82.7faa98", - "order": 9, "width": 10, "height": 1 }, { - "id": "411742cf.3abb8c", + "id": "f03eb9bf.839b88", + "type": "ui_spacer", + "name": "spacer", + "group": "4322c187.e73e5", + "order": 3, + "width": 10, + "height": 1 + }, + { + "id": "ba8b3166.35cf5", + "type": "ui_spacer", + "name": "spacer", + "group": "4322c187.e73e5", + "order": 5, + "width": 1, + "height": 1 + }, + { + "id": "e86b3059.c9a53", + "type": "ui_spacer", + "name": "spacer", + "group": "4322c187.e73e5", + "order": 7, + "width": 10, + "height": 1 + }, + { + "id": "9e9d9991.80e7e8", + "type": "ui_spacer", + "name": "spacer", + "group": "b7919ae2.c01788", + "order": 2, + "width": 5, + "height": 1 + }, + { + "id": "cf5d9f0e.d57e7", "type": "ui_group", - "z": "", - "name": "Machine Name", - "tab": "a3de84cd.c01b6", - "order": 1, + "name": "Net retrieval", + "tab": "737ec584.2eea2c", + "order": 3, "disp": true, "width": "24", "collapse": false }, { - "id": "fa24782f.abed2", + "id": "5a0e69ac.725268", "type": "ui_spacer", "name": "spacer", - "group": "adcd0ef7.81a7f8", + "group": "3ca00bf9.e5cac4", "order": 2, - "width": 24, + "width": 1, "height": 1 }, { - "id": "f36716e2.a9898", + "id": "ca7a56b3.89805", "type": "ui_spacer", "name": "spacer", - "group": "adcd0ef7.81a7f8", + "group": "3ca00bf9.e5cac4", + "order": 5, + "width": 1, + "height": 1 + }, + { + "id": "aab3b337.985c98", + "type": "ui_spacer", + "name": "spacer", + "group": "1be83144.4fe4bf", + "order": 2, + "width": 9, + "height": 1 + }, + { + "id": "5324b3d4.72d6d4", + "type": "ui_spacer", + "name": "spacer", + "group": "1be83144.4fe4bf", "order": 4, "width": 9, "height": 1 }, { - "id": "98b8d88c.dc5d", - "type": "exec", - "z": "21b3da63.2cef2e", - "command": "free -m | grep \"Mem\" | awk -F ' ' '{print $3}'", - "addpay": false, - "append": "", - "useSpawn": "", - "timer": "", - "name": "Get memory used", - "x": 430, - "y": 100, + "id": "8780f7f3.52ee5", + "type": "ui_spacer", + "name": "spacer", + "group": "1be83144.4fe4bf", + "order": 5, + "width": 9, + "height": 1 + }, + { + "id": "5e847442.3e340c", + "type": "ui_spacer", + "name": "spacer", + "group": "1be83144.4fe4bf", + "order": 7, + "width": 9, + "height": 1 + }, + { + "id": "cc4fe53d.f4dc4", + "type": "ui_spacer", + "name": "spacer", + "group": "1be83144.4fe4bf", + "order": 9, + "width": 10, + "height": 1 + }, + { + "id": "ce9e278.781eed8", + "type": "ui_group", + "name": "Information", + "tab": "d9cd733b.ab73d", + "order": 6, + "disp": true, + "width": "6", + "collapse": false + }, + { + "id": "2ccfcb49.5e95cc", + "type": "ui_group", + "name": "Object metadata", + "tab": "a2259300.ec17d", + "order": 2, + "disp": true, + "width": "24", + "collapse": true + }, + { + "id": "a2259300.ec17d", + "type": "ui_tab", + "name": "Acquisition", + "icon": "fa-eyedropper", + "order": 1, + "disabled": false, + "hidden": false + }, + { + "id": "4e78af2d.90be7", + "type": "ui_ui_control", + "z": "eaae323a.31b3", + "name": "", + "events": "change", + "x": 520, + "y": 60, "wires": [ - [ - "ddf0e242.88258", - "f1a7a389.2cc528" - ], - [], [] ] }, { - "id": "34130a77.042d46", - "type": "inject", - "z": "21b3da63.2cef2e", - "name": "", - "props": [ - { - "p": "payload", - "v": "", - "vt": "num" - }, - { - "p": "topic", - "v": "", - "vt": "string" - } - ], - "repeat": "1", - "crontab": "", - "once": false, - "onceDelay": "", - "topic": "", - "payload": "", - "payloadType": "num", - "x": 210, - "y": 100, + "id": "2a65c3ec.49a6bc", + "type": "function", + "z": "eaae323a.31b3", + "name": "swtich tab", + "func": "\nmsg.payload={\"tab\":msg.payload};\nreturn msg;", + "outputs": 1, + "noerr": 0, + "x": 360, + "y": 60, "wires": [ [ - "98b8d88c.dc5d" + "4e78af2d.90be7" ] ] }, { - "id": "ddf0e242.88258", - "type": "ui_chart", - "z": "21b3da63.2cef2e", - "name": "Memory Load Chart", - "group": "779606c9.19d2b8", - "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": 650, - "y": 120, + "id": "9d6abe67.6bb3d", + "type": "ui_button", + "z": "cb95299c.2817c8", + "name": "", + "group": "64903b47.4034e4", + "order": 1, + "width": 0, + "height": 0, + "passthru": false, + "label": "Home", + "tooltip": "", + "color": "", + "bgcolor": "", + "icon": "home", + "payload": "", + "payloadType": "str", + "topic": "Home", + "x": 410, + "y": 460, + "wires": [ + [ + "7be6422d.73949c" + ] + ] + }, + { + "id": "f0fb77cf.8f1c28", + "type": "ui_ui_control", + "z": "cb95299c.2817c8", + "name": "", + "events": "change", + "x": 720, + "y": 460, "wires": [ [] ] }, { - "id": "f1a7a389.2cc528", - "type": "ui_gauge", - "z": "21b3da63.2cef2e", - "name": "Memory Load Donut", - "group": "779606c9.19d2b8", - "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": "7be6422d.73949c", + "type": "function", + "z": "cb95299c.2817c8", + "name": "change tab", + "func": "\nmsg.payload={\"tab\":msg.topic};\nreturn msg;", + "outputs": 1, + "noerr": 0, + "x": 560, + "y": 460, + "wires": [ + [ + "f0fb77cf.8f1c28" + ] + ] }, { - "id": "30fcb8f6.12fe", - "type": "ui_gauge", - "z": "21b3da63.2cef2e", - "name": "CPU Temp Donut", - "group": "779606c9.19d2b8", + "id": "a66e925b.4155c", + "type": "ui_button", + "z": "1371dec5.76e671", + "name": "", + "group": "3ca00bf9.e5cac4", "order": 1, - "width": 5, - "height": 4, - "gtype": "donut", - "title": "CPU Temp Donut", + "width": 4, + "height": 1, + "passthru": false, + "label": "Home", + "tooltip": "", + "color": "", + "bgcolor": "", + "icon": "home", + "payload": "", + "payloadType": "str", + "topic": "Home", + "x": 130, + "y": 1120, + "wires": [ + [ + "75975366.93d6cc" + ] + ] + }, + { + "id": "60fd157b.8a5aac", + "type": "ui_ui_control", + "z": "1371dec5.76e671", + "name": "", + "events": "change", + "x": 440, + "y": 1120, + "wires": [ + [] + ] + }, + { + "id": "75975366.93d6cc", + "type": "function", + "z": "1371dec5.76e671", + "name": "change tab", + "func": "\nmsg.payload={\"tab\":msg.topic};\nreturn msg;", + "outputs": 1, + "noerr": 0, + "initialize": "", + "finalize": "", + "x": 280, + "y": 1120, + "wires": [ + [ + "60fd157b.8a5aac" + ] + ] + }, + { + "id": "2c8c45ab.610c0a", + "type": "ui_gauge", + "z": "1371dec5.76e671", + "name": "", + "group": "b5ba3f26.2e722", + "order": 1, + "width": 0, + "height": 0, + "gtype": "gage", + "title": "CPU Temperature", "label": "C", "format": "{{value}}", "min": "35", @@ -937,42 +888,42 @@ ], "seg1": "", "seg2": "", - "x": 650, - "y": 160, + "x": 610, + "y": 100, "wires": [] }, { - "id": "81105630.ed06e8", + "id": "ddcbbfa5.cd158", "type": "exec", - "z": "21b3da63.2cef2e", + "z": "1371dec5.76e671", "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, + "x": 310, + "y": 120, "wires": [ [ - "59fe3900.da6c8", - "30fcb8f6.12fe", - "d70d3e88.eaca48" + "bc503fa5.f46dd", + "2c8c45ab.610c0a", + "cef370c7.1f7a" ], [], [] ] }, { - "id": "d70d3e88.eaca48", + "id": "cef370c7.1f7a", "type": "ui_chart", - "z": "21b3da63.2cef2e", - "name": "CPU Temp Chart", - "group": "779606c9.19d2b8", + "z": "1371dec5.76e671", + "name": "", + "group": "b5ba3f26.2e722", "order": 2, - "width": 19, - "height": 4, - "label": "CPU Temp Chart", + "width": 0, + "height": 0, + "label": "", "chartType": "line", "legend": "false", "xformat": "HH:mm:ss", @@ -999,29 +950,470 @@ ], "useOldStyle": true, "outputs": 1, - "x": 650, - "y": 200, - "wires": [ - [] - ] - }, - { - "id": "6e383122.133d5", - "type": "python3-function", - "z": "21b3da63.2cef2e", - "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, + "x": 570, "y": 140, "wires": [ [] ] }, { - "id": "59fe3900.da6c8", + "id": "55749fd8.3aca5", + "type": "exec", + "z": "1371dec5.76e671", + "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": 310, + "y": 200, + "wires": [ + [ + "e046247c.c466e8", + "4b2b9a70.6a9af4" + ], + [], + [] + ] + }, + { + "id": "c2b8d8b.0d90328", + "type": "exec", + "z": "1371dec5.76e671", + "command": "free | grep Mem | awk '{print 100*($3)/$2}' | awk -F \".\" '{print $1}' | tr -d \"\\n\"", + "addpay": false, + "append": "", + "useSpawn": "", + "timer": "", + "name": "Free Memory", + "x": 310, + "y": 300, + "wires": [ + [ + "e84f6e08.5d147", + "c7c8d192.3df27" + ], + [], + [] + ] + }, + { + "id": "e046247c.c466e8", + "type": "ui_gauge", + "z": "1371dec5.76e671", + "name": "", + "group": "3da7da8f.179606", + "order": 1, + "width": 0, + "height": 0, + "gtype": "gage", + "title": "Processor", + "label": "CPU", + "format": "{{value}}", + "min": 0, + "max": "100", + "colors": [ + "#00b500", + "#e6e600", + "#ca3838" + ], + "seg1": "", + "seg2": "", + "x": 520, + "y": 180, + "wires": [] + }, + { + "id": "e84f6e08.5d147", + "type": "ui_gauge", + "z": "1371dec5.76e671", + "name": "", + "group": "806d69c8.67fc58", + "order": 1, + "width": 0, + "height": 0, + "gtype": "gage", + "title": "Memory", + "label": "RAM", + "format": "{{value}}", + "min": 0, + "max": "100", + "colors": [ + "#00b500", + "#e6e600", + "#ca3838" + ], + "seg1": "", + "seg2": "", + "x": 520, + "y": 280, + "wires": [] + }, + { + "id": "3910d662.fa1f7a", + "type": "exec", + "z": "1371dec5.76e671", + "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": 310, + "y": 400, + "wires": [ + [ + "45e1912a.36a23", + "84ac8611.1a6ac8" + ], + [], + [] + ] + }, + { + "id": "45e1912a.36a23", + "type": "ui_gauge", + "z": "1371dec5.76e671", + "name": "", + "group": "405183bc.d8991c", + "order": 1, + "width": 0, + "height": 0, + "gtype": "gage", + "title": "Disk", + "label": "Go", + "format": "{{value}}", + "min": 0, + "max": "256", + "colors": [ + "#00b500", + "#e6e600", + "#ca3838" + ], + "seg1": "", + "seg2": "", + "x": 510, + "y": 380, + "wires": [] + }, + { + "id": "4b2b9a70.6a9af4", + "type": "ui_chart", + "z": "1371dec5.76e671", + "name": "", + "group": "3da7da8f.179606", + "order": 2, + "width": 0, + "height": 0, + "label": "", + "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": 510, + "y": 220, + "wires": [ + [] + ] + }, + { + "id": "c7c8d192.3df27", + "type": "ui_chart", + "z": "1371dec5.76e671", + "name": "", + "group": "806d69c8.67fc58", + "order": 2, + "width": 0, + "height": 0, + "label": "", + "chartType": "line", + "legend": "false", + "xformat": "HH:mm:ss", + "interpolate": "linear", + "nodata": "", + "dot": false, + "ymin": "0", + "ymax": "100", + "removeOlder": "20", + "removeOlderPoints": "", + "removeOlderUnit": "60", + "cutout": 0, + "useOneColor": false, + "useUTC": false, + "colors": [ + "#1f77b4", + "#aec7e8", + "#ff7f0e", + "#2ca02c", + "#98df8a", + "#d62728", + "#ff9896", + "#9467bd", + "#c5b0d5" + ], + "useOldStyle": true, + "outputs": 1, + "x": 510, + "y": 320, + "wires": [ + [] + ] + }, + { + "id": "84ac8611.1a6ac8", + "type": "ui_chart", + "z": "1371dec5.76e671", + "name": "", + "group": "405183bc.d8991c", + "order": 2, + "width": 0, + "height": 0, + "label": "", + "chartType": "line", + "legend": "false", + "xformat": "HH:mm:ss", + "interpolate": "linear", + "nodata": "", + "dot": false, + "ymin": "", + "ymax": "", + "removeOlder": "4", + "removeOlderPoints": "", + "removeOlderUnit": "3600", + "cutout": 0, + "useOneColor": false, + "useUTC": false, + "colors": [ + "#1f77b4", + "#aec7e8", + "#ff7f0e", + "#2ca02c", + "#98df8a", + "#d62728", + "#ff9896", + "#9467bd", + "#c5b0d5" + ], + "useOldStyle": true, + "outputs": 1, + "x": 510, + "y": 420, + "wires": [ + [] + ] + }, + { + "id": "1cd5b4c0.46af9b", + "type": "inject", + "z": "1371dec5.76e671", + "name": "", + "props": [ + { + "p": "payload", + "v": "", + "vt": "date" + }, + { + "p": "topic", + "v": "", + "vt": "string" + } + ], + "repeat": "60", + "crontab": "", + "once": false, + "onceDelay": "", + "topic": "", + "payload": "", + "payloadType": "date", + "x": 90, + "y": 260, + "wires": [ + [ + "3910d662.fa1f7a", + "c2b8d8b.0d90328", + "55749fd8.3aca5", + "ddcbbfa5.cd158" + ] + ] + }, + { + "id": "8485d05.444903", + "type": "ui_switch", + "z": "1371dec5.76e671", + "name": "fan_state", + "label": "Fan", + "tooltip": "", + "group": "3ca00bf9.e5cac4", + "order": 6, + "width": 3, + "height": 1, + "passthru": true, + "decouple": "false", + "topic": "", + "style": "", + "onvalue": "on", + "onvalueType": "str", + "onicon": "", + "oncolor": "", + "offvalue": "off", + "offvalueType": "str", + "officon": "", + "offcolor": "", + "x": 940, + "y": 40, + "wires": [ + [ + "2549f778.4eb828" + ] + ] + }, + { + "id": "2549f778.4eb828", + "type": "python3-function", + "z": "1371dec5.76e671", + "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": 1090, + "y": 40, + "wires": [ + [] + ] + }, + { + "id": "a113b518.830008", + "type": "ui_button", + "z": "1371dec5.76e671", + "name": "", + "group": "1be83144.4fe4bf", + "order": 10, + "width": 7, + "height": 1, + "passthru": false, + "label": "Reboot", + "tooltip": "", + "color": "", + "bgcolor": "#AD1625", + "icon": "refresh", + "payload": "reboot", + "payloadType": "str", + "topic": "reboot", + "x": 800, + "y": 260, + "wires": [ + [ + "ee57d11c.ed1dd" + ] + ] + }, + { + "id": "d9a924bc.0ca078", + "type": "exec", + "z": "1371dec5.76e671", + "command": "sudo", + "addpay": true, + "append": "now", + "useSpawn": "false", + "timer": "2", + "oldrc": false, + "name": "cmd", + "x": 1190, + "y": 260, + "wires": [ + [], + [], + [] + ] + }, + { + "id": "552d8bbb.cc4ca4", + "type": "ui_button", + "z": "1371dec5.76e671", + "name": "", + "group": "1be83144.4fe4bf", + "order": 8, + "width": 7, + "height": 1, + "passthru": false, + "label": "Shutdown", + "tooltip": "", + "color": "", + "bgcolor": "#AD1625", + "icon": "standby", + "payload": "shutdown", + "payloadType": "str", + "topic": "shutdown", + "x": 800, + "y": 340, + "wires": [ + [ + "ee57d11c.ed1dd" + ] + ] + }, + { + "id": "ee57d11c.ed1dd", + "type": "python3-function", + "z": "1371dec5.76e671", + "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\n#msg[\"payload\"] = str(msg[\"topic\"])+' now'\nreturn msg", + "outputs": 1, + "x": 1010, + "y": 300, + "wires": [ + [ + "b7ab1ada.1f4158", + "d9a924bc.0ca078" + ] + ] + }, + { + "id": "b7ab1ada.1f4158", + "type": "exec", + "z": "1371dec5.76e671", + "command": "i2cdetect -y 1", + "addpay": false, + "append": "", + "useSpawn": "false", + "timer": "1", + "oldrc": false, + "name": "i2c update", + "x": 1200, + "y": 340, + "wires": [ + [], + [], + [] + ] + }, + { + "id": "bc503fa5.f46dd", "type": "switch", - "z": "21b3da63.2cef2e", + "z": "1371dec5.76e671", "name": "", "property": "payload", "propertyType": "msg", @@ -1040,21 +1432,21 @@ "checkall": "true", "repair": false, "outputs": 2, - "x": 950, - "y": 140, + "x": 570, + "y": 40, "wires": [ [ - "1d11bfc1.ad4788" + "a25d6486.e1ce28" ], [ - "5aeccc80.5e9c54" + "5d4f3e71.1bad4" ] ] }, { - "id": "5aeccc80.5e9c54", + "id": "5d4f3e71.1bad4", "type": "change", - "z": "21b3da63.2cef2e", + "z": "1371dec5.76e671", "name": "", "rules": [ { @@ -1070,327 +1462,18 @@ "from": "", "to": "", "reg": false, - "x": 1120, - "y": 160, + "x": 740, + "y": 60, "wires": [ [ - "6e383122.133d5" + "8485d05.444903" ] ] }, { - "id": "8338294b.8082d", - "type": "inject", - "z": "21b3da63.2cef2e", - "name": "", - "repeat": "5", - "crontab": "", - "once": false, - "onceDelay": "", - "topic": "", - "payload": "", - "payloadType": "date", - "x": 190, - "y": 260, - "wires": [ - [ - "e7fe62ae.efb4f", - "eba0a98a.e4d56", - "81105630.ed06e8" - ] - ] - }, - { - "id": "e7fe62ae.efb4f", - "type": "exec", - "z": "21b3da63.2cef2e", - "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": [ - [ - "aa4065d2.14a66", - "a9aef217.f0aae" - ], - [], - [] - ] - }, - { - "id": "eba0a98a.e4d56", - "type": "exec", - "z": "21b3da63.2cef2e", - "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": [ - [ - "539c69d4.618bd8", - "96ceb8d7.0ed66" - ], - [], - [] - ] - }, - { - "id": "aa4065d2.14a66", - "type": "ui_gauge", - "z": "21b3da63.2cef2e", - "name": "CPU Load Donut", - "group": "779606c9.19d2b8", - "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": "539c69d4.618bd8", - "type": "ui_gauge", - "z": "21b3da63.2cef2e", - "name": "Free memory Donut", - "group": "779606c9.19d2b8", - "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": 650, - "y": 320, - "wires": [] - }, - { - "id": "9031b9ea.483fa8", - "type": "exec", - "z": "21b3da63.2cef2e", - "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": [ - [ - "32eded3f.f3b42a", - "49c71440.02a25c" - ], - [], - [] - ] - }, - { - "id": "32eded3f.f3b42a", - "type": "ui_gauge", - "z": "21b3da63.2cef2e", - "name": "Disk Usage Donut", - "group": "779606c9.19d2b8", - "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": "a9aef217.f0aae", - "type": "ui_chart", - "z": "21b3da63.2cef2e", - "name": "CPU Load Chart", - "group": "779606c9.19d2b8", - "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": "96ceb8d7.0ed66", - "type": "ui_chart", - "z": "21b3da63.2cef2e", - "name": "Free memory Chart", - "group": "779606c9.19d2b8", - "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": "fb614565.7a2108", - "type": "inject", - "z": "21b3da63.2cef2e", - "name": "", - "repeat": "60", - "crontab": "", - "once": false, - "onceDelay": "", - "topic": "", - "payload": "", - "payloadType": "date", - "x": 190, - "y": 420, - "wires": [ - [ - "9031b9ea.483fa8" - ] - ] - }, - { - "id": "49c71440.02a25c", - "type": "ui_chart", - "z": "21b3da63.2cef2e", - "name": "Disk Usage Chart", - "group": "779606c9.19d2b8", - "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": "1d11bfc1.ad4788", + "id": "a25d6486.e1ce28", "type": "change", - "z": "21b3da63.2cef2e", + "z": "1371dec5.76e671", "name": "", "rules": [ { @@ -1406,71 +1489,682 @@ "from": "", "to": "", "reg": false, - "x": 1120, - "y": 120, + "x": 740, + "y": 20, "wires": [ [ - "6e383122.133d5" + "8485d05.444903" ] ] }, { - "id": "4b489713.ccde5", - "type": "ui_button", - "z": "130e0533.4f1813", - "name": "", - "group": "75a5ce1f.728d", + "id": "6a84252a.d52a0c", + "type": "ui_template", + "z": "bccd1f23.87219", + "group": "833bc5bb.217ba8", + "name": "Stream Pi Camera", "order": 1, - "width": 16, - "height": 1, - "passthru": false, - "label": "Start Acquisition", - "tooltip": "", - "color": "", - "bgcolor": "", - "icon": "", - "payload": "", - "payloadType": "str", - "topic": "imager/image", - "x": 200, + "width": 14, + "height": 9, + "format": "
\n \n
", + "storeOutMessages": true, + "fwdInMessages": true, + "resendOnRefresh": false, + "templateScope": "local", + "x": 110, "y": 100, "wires": [ - [ - "52ea7d01.711034", - "40c12463.a1f84c" - ] + [] ] }, { - "id": "c9f510c0.7d1328", + "id": "dc48dc42.98d18", "type": "function", - "z": "130e0533.4f1813", - "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\");\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 msg.payload={\"action\":\"image\", \n \"sleep\":sleep_before,\n \"volume\":nb_step,\n \"nb_frame\":nb_frame,\n }\n}\n\nreturn msg;", + "z": "bccd1f23.87219", + "name": "set global", + "func": "global.set(msg.topic,msg.payload);", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", - "x": 560, + "x": 880, + "y": 340, + "wires": [ + [] + ] + }, + { + "id": "f59a2f0d.5e9af", + "type": "ui_numeric", + "z": "baa1e3d9.cb29d", + "name": "acq_minimum_mesh", + "label": "Min fraction size (μm)", + "tooltip": "", + "group": "404c301a.19c4e", + "order": 2, + "width": 5, + "height": 1, + "wrap": false, + "passthru": true, + "topic": "acq_minimum_mesh", + "format": "{{value}}", + "min": 0, + "max": "300", + "step": "10", + "x": 600, + "y": 120, + "wires": [ + [ + "fb887036.12429" + ] + ] + }, + { + "id": "6008a8bb.259f08", + "type": "ui_numeric", + "z": "baa1e3d9.cb29d", + "name": "acq_maximum_mesh", + "label": "Max fraction size (μm)", + "tooltip": "", + "group": "404c301a.19c4e", + "order": 3, + "width": 5, + "height": 1, + "wrap": false, + "passthru": true, + "topic": "acq_maximum_mesh", + "format": "{{value}}", + "min": "200", + "max": "2000", + "step": "100", + "x": 600, + "y": 160, + "wires": [ + [ + "fb887036.12429" + ] + ] + }, + { + "id": "6b34c456.83178c", + "type": "ui_text_input", + "z": "baa1e3d9.cb29d", + "name": "acq_id", + "label": "Acquisition unique ID*", + "tooltip": "", + "group": "4322c187.e73e5", + "order": 2, + "width": 5, + "height": 1, + "passthru": true, + "mode": "text", + "delay": 300, + "topic": "acq_id", + "x": 650, + "y": 240, + "wires": [ + [ + "fb887036.12429" + ] + ] + }, + { + "id": "7789839d.69b48c", + "type": "ui_template", + "z": "eaae323a.31b3", + "group": "4e0cd5ea.17e59c", + "name": "Optic Configuration", + "order": 1, + "width": 4, + "height": 4, + "format": "\n \n
Optic Configuration
\n
", + "storeOutMessages": true, + "fwdInMessages": true, + "templateScope": "local", + "x": 130, "y": 100, "wires": [ [ - "d6ebaa2.ea21d58" + "2a65c3ec.49a6bc" ] - ], - "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": "d6ebaa2.ea21d58", + "id": "6ea6c306.f9c12c", + "type": "ui_template", + "z": "eaae323a.31b3", + "group": "ef590206.24f6", + "name": "Fluidic Acquisition", + "order": 1, + "width": 4, + "height": 4, + "format": "\n \n
Fluidic Acquisition
\n
", + "storeOutMessages": true, + "fwdInMessages": true, + "templateScope": "local", + "x": 130, + "y": 140, + "wires": [ + [ + "2a65c3ec.49a6bc" + ] + ] + }, + { + "id": "bb9eb153.9e36c", + "type": "ui_template", + "z": "eaae323a.31b3", + "group": "ae8f6620.073358", + "name": "Segmentation", + "order": 1, + "width": 4, + "height": 4, + "format": "\n \n
Segmentation
\n
", + "storeOutMessages": true, + "fwdInMessages": true, + "templateScope": "local", + "x": 140, + "y": 180, + "wires": [ + [ + "2a65c3ec.49a6bc" + ] + ] + }, + { + "id": "eaf8ee7f.96f44", + "type": "ui_template", + "z": "eaae323a.31b3", + "group": "196518b2.4d53b7", + "name": "Gallery", + "order": 1, + "width": 4, + "height": 4, + "format": "\n \n
Gallery
\n
", + "storeOutMessages": true, + "fwdInMessages": true, + "templateScope": "local", + "x": 160, + "y": 220, + "wires": [ + [ + "2a65c3ec.49a6bc" + ] + ] + }, + { + "id": "811cd88c.daf528", + "type": "ui_button", + "z": "bccd1f23.87219", + "name": "down", + "group": "fbd92986.1028c8", + "order": 5, + "width": 0, + "height": 0, + "passthru": true, + "label": "", + "tooltip": "", + "color": "", + "bgcolor": "", + "icon": "arrow_downward", + "payload": "DOWN", + "payloadType": "str", + "topic": "actuator/focus", + "x": 190, + "y": 640, + "wires": [ + [ + "65ad39d.b6d4d48" + ] + ] + }, + { + "id": "edda4df4.76de2", + "type": "ui_button", + "z": "bccd1f23.87219", + "name": "up", + "group": "fbd92986.1028c8", + "order": 1, + "width": 0, + "height": 0, + "passthru": false, + "label": "", + "tooltip": "", + "color": "", + "bgcolor": "", + "icon": "arrow_upwards", + "payload": "UP", + "payloadType": "str", + "topic": "actuator/focus", + "x": 190, + "y": 600, + "wires": [ + [ + "65ad39d.b6d4d48" + ] + ] + }, + { + "id": "68962547.34a67c", + "type": "ui_text_input", + "z": "bccd1f23.87219", + "name": "pump_manual_volume", + "label": "Volume to pass (ml)", + "tooltip": "", + "group": "707d9797.c8e798", + "order": 3, + "width": 4, + "height": 1, + "passthru": true, + "mode": "number", + "delay": 300, + "topic": "pump_manual_volume", + "x": 320, + "y": 340, + "wires": [ + [ + "dc48dc42.98d18" + ] + ] + }, + { + "id": "34c81624.df1cea", + "type": "ui_slider", + "z": "bccd1f23.87219", + "name": "pump_flowrate", + "label": "Flowrate (ml/min)*", + "tooltip": "", + "group": "707d9797.c8e798", + "order": 1, + "width": 0, + "height": 0, + "passthru": true, + "outs": "end", + "topic": "pump_flowrate", + "min": 0, + "max": "20", + "step": "0.1", + "x": 340, + "y": 300, + "wires": [ + [ + "dc48dc42.98d18" + ] + ] + }, + { + "id": "c1b1469.9650eb8", + "type": "ui_template", + "z": "eaae323a.31b3", + "group": "777a7c33.fcd804", + "name": "Settings", + "order": 1, + "width": 4, + "height": 4, + "format": "\n \n
Settings
\n
", + "storeOutMessages": true, + "fwdInMessages": true, + "templateScope": "local", + "x": 160, + "y": 260, + "wires": [ + [ + "2a65c3ec.49a6bc" + ] + ] + }, + { + "id": "18afe75e.288219", + "type": "ui_gauge", + "z": "c1660bc.e7ff7f8", + "name": "", + "group": "c0ebfc57.42527", + "order": 1, + "width": 0, + "height": 0, + "gtype": "gage", + "title": "gauge", + "label": "units", + "format": "{{value}}", + "min": 0, + "max": 10, + "colors": [ + "#00b500", + "#e6e600", + "#ca3838" + ], + "seg1": "", + "seg2": "", + "x": 720, + "y": 280, + "wires": [] + }, + { + "id": "abafd6e6.04a5f8", + "type": "ui_template", + "z": "eaae323a.31b3", + "group": "6f97e7ae.270c48", + "name": "Sample", + "order": 1, + "width": 4, + "height": 4, + "format": "\n \n
Sample
\n
\n In doubt? Start Here!\n
", + "storeOutMessages": true, + "fwdInMessages": true, + "resendOnRefresh": false, + "templateScope": "local", + "x": 160, + "y": 60, + "wires": [ + [ + "2a65c3ec.49a6bc" + ] + ] + }, + { + "id": "4557d689.a4fa88", + "type": "ui_text_input", + "z": "b771c342.49603", + "name": "sample_ship", + "label": "Name of the ship", + "tooltip": "", + "group": "3e1ba03d.f01d8", + "order": 2, + "width": 0, + "height": 0, + "passthru": true, + "mode": "text", + "delay": 300, + "topic": "sample_ship", + "x": 650, + "y": 340, + "wires": [ + [ + "9f501f49.45645" + ] + ] + }, + { + "id": "fcfc31ae.af3af", + "type": "ui_dropdown", + "z": "b771c342.49603", + "name": "sample_sampling_gear", + "label": "Sampling gear", + "tooltip": "", + "place": "Select", + "group": "3e1ba03d.f01d8", + "order": 5, + "width": 0, + "height": 0, + "passthru": true, + "options": [ + { + "label": "Plankton net", + "value": "net", + "type": "str" + }, + { + "label": "Niskin bottle 12L", + "value": "niskin_12L", + "type": "str" + }, + { + "label": "Niskin bottle 24L", + "value": "niskin_24L", + "type": "str" + }, + { + "label": "Pass Hull", + "value": "pass_hull", + "type": "str" + } + ], + "payload": "", + "topic": "sample_sampling_gear", + "x": 620, + "y": 460, + "wires": [ + [ + "9f501f49.45645" + ] + ] + }, + { + "id": "82c5fc77.59c97", + "type": "ui_text_input", + "z": "b771c342.49603", + "name": "sample_operator", + "label": "Name of the operator", + "tooltip": "", + "group": "3e1ba03d.f01d8", + "order": 4, + "width": 0, + "height": 0, + "passthru": true, + "mode": "text", + "delay": 300, + "topic": "sample_operator", + "x": 640, + "y": 420, + "wires": [ + [ + "9f501f49.45645" + ] + ] + }, + { + "id": "9c882b37.fde668", + "type": "ui_text_input", + "z": "b771c342.49603", + "name": "sample_project", + "label": "Name of the project*", + "tooltip": "", + "group": "3e1ba03d.f01d8", + "order": 1, + "width": 0, + "height": 0, + "passthru": true, + "mode": "text", + "delay": 300, + "topic": "sample_project", + "x": 640, + "y": 300, + "wires": [ + [ + "9f501f49.45645" + ] + ] + }, + { + "id": "94eb4221.9b92c", + "type": "ui_text_input", + "z": "b771c342.49603", + "name": "sample_id", + "label": "ID of the station*", + "tooltip": "", + "group": "3e1ba03d.f01d8", + "order": 3, + "width": 0, + "height": 0, + "passthru": true, + "mode": "text", + "delay": 300, + "topic": "sample_id", + "x": 660, + "y": 380, + "wires": [ + [ + "9f501f49.45645" + ] + ] + }, + { + "id": "9f501f49.45645", + "type": "function", + "z": "b771c342.49603", + "name": "set global", + "func": "var value = msg.payload;\nvar key = msg.topic;\n\nglobal.set(key,value);", + "outputs": 1, + "noerr": 0, + "initialize": "", + "finalize": "", + "x": 960, + "y": 520, + "wires": [ + [] + ] + }, + { + "id": "cc0ca68b.4263a8", + "type": "ui_dropdown", + "z": "baa1e3d9.cb29d", + "name": "acq_celltype", + "label": "Thickness flowcell*", + "tooltip": "", + "place": "Select option", + "group": "404c301a.19c4e", + "order": 1, + "width": 0, + "height": 0, + "passthru": true, + "options": [ + { + "label": "200 μm µ-Slide I Luer", + "value": 200, + "type": "num" + }, + { + "label": "400 μm µ-Slide I Luer", + "value": 400, + "type": "num" + }, + { + "label": "600 μm µ-Slide I Luer", + "value": 600, + "type": "num" + }, + { + "label": "800 μm µ-Slide I Luer", + "value": 800, + "type": "num" + } + ], + "payload": "", + "topic": "acq_celltype", + "x": 630, + "y": 80, + "wires": [ + [ + "fb887036.12429" + ] + ] + }, + { + "id": "fb887036.12429", + "type": "function", + "z": "baa1e3d9.cb29d", + "name": "set global", + "func": "var value = msg.payload;\nvar key = msg.topic;\n\nglobal.set(key,value);", + "outputs": 1, + "noerr": 0, + "initialize": "", + "finalize": "", + "x": 840, + "y": 180, + "wires": [ + [] + ] + }, + { + "id": "222c851d.5d0a3a", + "type": "ui_ui_control", + "z": "b771c342.49603", + "name": "", + "events": "change", + "x": 420, + "y": 1000, + "wires": [ + [] + ] + }, + { + "id": "52f6b103.1efb6", + "type": "ui_toast", + "z": "b771c342.49603", + "position": "dialog", + "displayTime": "3", + "highlight": "", + "sendall": true, + "outputs": 1, + "ok": "OK", + "cancel": "", + "raw": false, + "topic": "", + "name": "", + "x": 850, + "y": 1120, + "wires": [ + [] + ] + }, + { + "id": "986d960a.c75908", + "type": "function", + "z": "b771c342.49603", + "name": "Check form", + "func": "var sample_project= global.get(\"sample_project\");\nvar sample_ship= global.get(\"sample_ship\");\nvar sample_id= global.get(\"sample_id\");\nvar sample_operator= global.get(\"sample_operator\");\nvar sample_sampling_gear= global.get(\"sample_sampling_gear\");\nvar object_lat= global.get(\"object_lat\");\nvar object_lon= global.get(\"object_lon\");\nvar sample_day= global.get(\"sample_day\");\nvar sample_hour= global.get(\"sample_hour\");\n\nif (sample_project === undefined || sample_project === \"\") {\n msg.topic = \"Missing entry :\"\n msg.payload = \"Sample project\"\n}\n\nelse if (sample_ship === undefined || sample_ship === \"\") {\n msg.topic = \"Missing entry :\"\n msg.payload = \"Sample ship\"\n}\n\nelse if (sample_id === undefined || sample_id === \"\") {\n msg.topic = \"Missing entry :\"\n msg.payload = \"Sample ID\"\n}\n\nelse if (sample_operator === undefined || sample_operator === \"\") {\n msg.topic = \"Missing entry :\"\n msg.payload = \"Sample operator\"\n}\n\nelse if (sample_sampling_gear === undefined || sample_sampling_gear === \"\") {\n msg.topic = \"Missing entry :\"\n msg.payload = \"Sample sampling gear\"\n}\n\nelse if (object_lat === undefined || object_lat === null) {\n msg.topic = \"Missing entry :\"\n msg.payload = \"Sample latitude\"\n}\n\nelse if (object_lon === undefined || object_lon === null) {\n msg.topic = \"Missing entry :\"\n msg.payload = \"Sample longitude\"\n}\n\nelse if (sample_day === undefined || sample_day === \"\") {\n msg.topic = \"Missing entry :\"\n msg.payload = \"Date\"\n}\n\nelse if (sample_hour === undefined || sample_hour === \"\") {\n msg.topic = \"Missing entry :\"\n msg.payload = \"Time\"\n}\n\nelse {\n msg.topic = \"Change Tab\"\n msg.payload={\"tab\":\"Optic Configuration\"};\n}\nreturn msg;\n", + "outputs": 1, + "noerr": 0, + "x": 430, + "y": 1060, + "wires": [ + [ + "f5e66a2f.0d09d8" + ] + ] + }, + { + "id": "18f44504.cac66b", + "type": "gpsd", + "z": "b771c342.49603", + "name": "", + "hostname": "localhost", + "port": "2947", + "tpv": true, + "sky": false, + "info": false, + "device": false, + "gst": false, + "att": false, + "x": 290, + "y": 1240, + "wires": [ + [] + ] + }, + { + "id": "726a7822.cd6298", + "type": "ui_ui_control", + "z": "b771c342.49603", + "name": "", + "events": "change", + "x": 840, + "y": 1040, + "wires": [ + [] + ] + }, + { + "id": "f5e66a2f.0d09d8", "type": "switch", - "z": "130e0533.4f1813", + "z": "b771c342.49603", "name": "", "property": "topic", "propertyType": "msg", "rules": [ { "t": "eq", - "v": "imager/image", + "v": "Change Tab", "vt": "str" }, { @@ -1482,21 +2176,123 @@ "checkall": "true", "repair": false, "outputs": 2, - "x": 710, - "y": 100, + "x": 610, + "y": 1060, "wires": [ [ - "c3e50240.82aa58" + "726a7822.cd6298", + "e2b277c1.07283" ], [ - "20e0a8c8.edbeb" + "52f6b103.1efb6" ] ] }, { - "id": "20e0a8c8.edbeb", + "id": "2d128018.6a809", + "type": "ui_text_input", + "z": "b771c342.49603", + "name": "object_lat", + "label": "Latitude of throw", + "tooltip": "In decimal degrees", + "group": "cef1e703.bcf3c8", + "order": 1, + "width": 12, + "height": 1, + "passthru": true, + "mode": "number", + "delay": 300, + "topic": "object_lat", + "x": 660, + "y": 520, + "wires": [ + [ + "9f501f49.45645" + ] + ] + }, + { + "id": "4626c0da.e0dd5", + "type": "ui_text_input", + "z": "b771c342.49603", + "name": "object_lon", + "label": "Longitude of throw", + "tooltip": "", + "group": "cef1e703.bcf3c8", + "order": 2, + "width": 12, + "height": 1, + "passthru": true, + "mode": "number", + "delay": 300, + "topic": "object_lon", + "x": 660, + "y": 560, + "wires": [ + [ + "9f501f49.45645" + ] + ] + }, + { + "id": "f00f321f.77d76", + "type": "ui_date_picker", + "z": "b771c342.49603", + "name": "object_date", + "label": "Date", + "group": "cef1e703.bcf3c8", + "order": 3, + "width": 12, + "height": 1, + "passthru": true, + "topic": "object_date", + "x": 650, + "y": 600, + "wires": [ + [ + "29f2b365.4327ec" + ] + ] + }, + { + "id": "207fbdbb.2fe2a2", + "type": "ui_text_input", + "z": "b771c342.49603", + "name": "object_time", + "label": "Time :", + "tooltip": "", + "group": "cef1e703.bcf3c8", + "order": 4, + "width": 12, + "height": 1, + "passthru": true, + "mode": "time", + "delay": 300, + "topic": "object_time", + "x": 650, + "y": 640, + "wires": [ + [ + "1a945afa.d60aad" + ] + ] + }, + { + "id": "6c792043.b6ff9", + "type": "ui_ui_control", + "z": "bccd1f23.87219", + "name": "", + "events": "change", + "x": 840, + "y": 1000, + "wires": [ + [] + ] + }, + { + "id": "902429eb.ceacb8", "type": "ui_toast", - "z": "130e0533.4f1813", + "z": "bccd1f23.87219", "position": "dialog", "displayTime": "3", "highlight": "", @@ -1507,896 +2303,167 @@ "raw": false, "topic": "", "name": "", - "x": 870, - "y": 140, + "x": 1070, + "y": 1100, "wires": [ [] ] }, { - "id": "c3e50240.82aa58", - "type": "mqtt out", - "z": "130e0533.4f1813", + "id": "fe840e05.b46f3", + "type": "function", + "z": "bccd1f23.87219", + "name": "Check form", + "func": "var acq_fnumber_objective= global.get(\"acq_fnumber_objective\");\n\nif (acq_fnumber_objective === undefined || acq_fnumber_objective === \"\") {\n msg.topic = \"Missing entry :\"\n msg.payload = \"Focal Length of the objective\"\n}\n\nelse {\n msg.topic = \"Change Tab\"\n msg.payload={\"tab\":\"Fluidic Acquisition\"};\n}\nreturn msg;\n", + "outputs": 1, + "noerr": 0, + "x": 670, + "y": 1060, + "wires": [ + [ + "652d812a.7d808" + ] + ] + }, + { + "id": "f58a0c4.e207df", + "type": "ui_ui_control", + "z": "bccd1f23.87219", "name": "", - "topic": "", - "qos": "", - "retain": "", - "broker": "8dc3722c.06efa8", - "x": 850, - "y": 60, - "wires": [] - }, - { - "id": "3a4450b1.4459a8", - "type": "ui_button", - "z": "130e0533.4f1813", - "name": "Stop Acquisition", - "group": "75a5ce1f.728d", - "order": 2, - "width": 8, - "height": 1, - "passthru": true, - "label": "STOP ACQUISITION", - "tooltip": "", - "color": "", - "bgcolor": "#AD1625", - "icon": "", - "payload": "{\"action\":\"stop\"}", - "payloadType": "json", - "topic": "imager/image", - "x": 200, - "y": 140, - "wires": [ - [ - "d74210ef.edc15" - ] - ] - }, - { - "id": "d74210ef.edc15", - "type": "mqtt out", - "z": "130e0533.4f1813", - "name": "", - "topic": "", - "qos": "", - "retain": "", - "broker": "8dc3722c.06efa8", - "x": 390, - "y": 140, - "wires": [] - }, - { - "id": "d3caa802.6f22d8", - "type": "ui_text_input", - "z": "1bc3f9f9.1ee996", - "name": "custom_nb_step", - "label": "Volume in mL between two images", - "tooltip": "TODO This should be in mm ?", - "group": "758f41b8.1680c8", - "order": 2, - "width": 0, - "height": 0, - "passthru": true, - "mode": "number", - "delay": 300, - "topic": "custom_nb_step", - "x": 540, - "y": 80, + "events": "change", + "x": 1060, + "y": 1040, "wires": [ [] ] }, { - "id": "5d4c755a.800b44", - "type": "ui_text_input", - "z": "1bc3f9f9.1ee996", - "name": "custom_nb_frame", - "label": "Number of images per acquisition", - "tooltip": "", - "group": "758f41b8.1680c8", - "order": 3, - "width": 0, - "height": 0, - "passthru": true, - "mode": "number", - "delay": 300, - "topic": "custom_nb_frame", - "x": 530, - "y": 120, - "wires": [ - [] - ] - }, - { - "id": "8887f3e7.e79b5", - "type": "function", - "z": "1bc3f9f9.1ee996", - "name": "get custom_nb_step", - "func": "msg.payload = msg.payload.custom_nb_step;\nreturn msg;", - "outputs": 1, - "noerr": 0, - "initialize": "", - "finalize": "", - "x": 220, - "y": 80, - "wires": [ - [ - "d3caa802.6f22d8" - ] - ] - }, - { - "id": "600c2b46.83db14", - "type": "function", - "z": "1bc3f9f9.1ee996", - "name": "get custom_nb_frame", - "func": "msg.payload = msg.payload.custom_nb_frame;\nreturn msg;", - "outputs": 1, - "noerr": 0, - "x": 220, - "y": 120, - "wires": [ - [ - "5d4c755a.800b44" - ] - ] - }, - { - "id": "14be4afa.2ba67d", - "type": "function", - "z": "1bc3f9f9.1ee996", - "name": "get custom_sleep_before", - "func": "msg.payload = msg.payload.custom_sleep_before;\nreturn msg;", - "outputs": 1, - "noerr": 0, - "x": 230, - "y": 40, - "wires": [ - [ - "3a773a31.a6caee" - ] - ] - }, - { - "id": "3a773a31.a6caee", - "type": "ui_text_input", - "z": "1bc3f9f9.1ee996", - "name": "custom_sleep_before", - "label": "Duration before the acquisition (s)", - "tooltip": "", - "group": "758f41b8.1680c8", - "order": 1, - "width": 0, - "height": 0, - "passthru": true, - "mode": "number", - "delay": 300, - "topic": "custom_sleep_before", - "x": 520, - "y": 40, - "wires": [ - [] - ] - }, - { - "id": "7cdadcd1.736f04", - "type": "ui_text_input", - "z": "714bd4fe.163ab4", - "name": "process_id", - "label": "Id of the process", - "tooltip": "", - "group": "eef6f881.7b3b38", - "order": 1, - "width": 0, - "height": 0, - "passthru": true, - "mode": "number", - "delay": 300, - "topic": "process_id", - "x": 550, - "y": 80, - "wires": [ - [] - ] - }, - { - "id": "706715a3.5ad1c4", - "type": "function", - "z": "714bd4fe.163ab4", - "name": "get process_id", - "func": "msg.payload = msg.payload.process_id+1;\nreturn msg;", - "outputs": 1, - "noerr": 0, - "x": 200, - "y": 80, - "wires": [ - [ - "7cdadcd1.736f04" - ] - ] - }, - { - "id": "8cb80d95.13d2e8", - "type": "mqtt in", - "z": "bee3b478.ef4b88", - "name": "", - "topic": "status/#", - "qos": "0", - "datatype": "json", - "broker": "8dc3722c.06efa8", - "x": 70, - "y": 300, - "wires": [ - [ - "2aa5b118.d75f2e" - ] - ] - }, - { - "id": "ecedbda4.fed15", + "id": "652d812a.7d808", "type": "switch", - "z": "bee3b478.ef4b88", - "name": "topic filter", + "z": "bccd1f23.87219", + "name": "", "property": "topic", "propertyType": "msg", "rules": [ { "t": "eq", - "v": "status/pump", + "v": "Change Tab", "vt": "str" }, { "t": "eq", - "v": "status/focus", + "v": "Missing entry :", "vt": "str" - }, - { - "t": "eq", - "v": "status/imager", - "vt": "str" - }, - { - "t": "cont", - "v": "status/segmenter", - "vt": "str" - } - ], - "checkall": "true", - "repair": false, - "outputs": 4, - "x": 360, - "y": 300, - "wires": [ - [ - "117aad13.53e11b", - "d700c8a1.2d1f48" - ], - [ - "117aad13.53e11b", - "dc72e121.0aacd" - ], - [ - "af9a1d81.c21fa8", - "5a159d39.3bdca4" - ], - [ - "30a9de16.d55cda" - ] - ] - }, - { - "id": "af9a1d81.c21fa8", - "type": "switch", - "z": "bee3b478.ef4b88", - "name": "Imaging state", - "property": "payload", - "propertyType": "msg", - "rules": [ - { - "t": "else" - }, - { - "t": "jsonata_exp", - "v": "$contains(msg.payload.status, \"jpg\")\t", - "vt": "jsonata" } ], "checkall": "true", "repair": false, "outputs": 2, - "x": 640, - "y": 340, + "x": 830, + "y": 1060, "wires": [ [ - "117aad13.53e11b" + "f58a0c4.e207df" ], [ - "a636cac5.e28448" + "902429eb.ceacb8" ] ] }, { - "id": "a636cac5.e28448", - "type": "function", - "z": "bee3b478.ef4b88", - "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, - "initialize": "", - "finalize": "", - "x": 900, - "y": 380, - "wires": [ - [ - "abd84e73.aefc9", - "e2913641.ea203" - ] - ] - }, - { - "id": "f71d0cda.0a4f88", - "type": "function", - "z": "bee3b478.ef4b88", - "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, - "initialize": "", - "finalize": "", - "x": 900, - "y": 500, - "wires": [ - [ - "d0d14f00.e2ff88", - "b3f6e410.547fc" - ] - ] - }, - { - "id": "abd84e73.aefc9", - "type": "ui_chart", - "z": "bee3b478.ef4b88", - "name": "img_counter", - "group": "6d1af0ab.7b4a18", - "order": 1, - "width": 21, - "height": 2, - "label": "image counter", - "chartType": "horizontalBar", - "legend": "false", - "xformat": "HH:mm:ss", - "interpolate": "linear", - "nodata": "Images count will be shown here once the imaging is started", - "dot": false, - "ymin": "", - "ymax": "", - "removeOlder": 1, - "removeOlderPoints": "", - "removeOlderUnit": "3600", - "cutout": 0, - "useOneColor": false, - "useUTC": false, - "colors": [ - "#1f77b4", - "#aec7e8", - "#ff7f0e", - "#2ca02c", - "#98df8a", - "#d62728", - "#ff9896", - "#9467bd", - "#c5b0d5" - ], - "useOldStyle": false, - "outputs": 1, - "x": 1370, - "y": 400, - "wires": [ - [] - ] - }, - { - "id": "30a9de16.d55cda", - "type": "switch", - "z": "bee3b478.ef4b88", - "name": "Segmenter", - "property": "topic", - "propertyType": "msg", - "rules": [ - { - "t": "eq", - "v": "status/segmenter", - "vt": "str" - }, - { - "t": "eq", - "v": "status/segmenter/name", - "vt": "str" - }, - { - "t": "eq", - "v": "status/segmenter/object_id", - "vt": "str" - }, - { - "t": "eq", - "v": "status/segmenter/metric", - "vt": "str" - } - ], - "checkall": "true", - "repair": false, - "outputs": 4, - "x": 630, - "y": 480, - "wires": [ - [ - "117aad13.53e11b", - "89058790.909e7" - ], - [ - "c2d35803.b5024" - ], - [ - "f71d0cda.0a4f88" - ], - [ - "d7944cf2.1ddb18" - ] - ] - }, - { - "id": "d0d14f00.e2ff88", - "type": "ui_chart", - "z": "bee3b478.ef4b88", - "name": "obj_counter", - "group": "6d1af0ab.7b4a18", - "order": 3, - "width": 21, - "height": 2, - "label": "obj_counter", - "chartType": "horizontalBar", - "legend": "false", - "xformat": "HH:mm:ss", - "interpolate": "linear", - "nodata": "Objects count will be shown here once the segmentation is started", - "dot": false, - "ymin": "", - "ymax": "", - "removeOlder": 1, - "removeOlderPoints": "", - "removeOlderUnit": "3600", - "cutout": 0, - "useOneColor": true, - "useUTC": false, - "colors": [ - "#1f77b4", - "#aec7e8", - "#ff7f0e", - "#2ca02c", - "#98df8a", - "#d62728", - "#ff9896", - "#9467bd", - "#c5b0d5" - ], - "useOldStyle": false, - "outputs": 1, - "x": 1370, - "y": 500, - "wires": [ - [] - ] - }, - { - "id": "d7944cf2.1ddb18", - "type": "function", - "z": "bee3b478.ef4b88", - "name": "ex : area", - "func": "msg.payload=msg.payload.object_area\nmsg.topic=\"area\"\n\nreturn msg;", - "outputs": 1, - "noerr": 0, - "initialize": "", - "finalize": "", - "x": 880, - "y": 540, - "wires": [ - [ - "6f64625f.243fd4" - ] - ] - }, - { - "id": "1403e1a4.528926", - "type": "ui_toast", - "z": "bee3b478.ef4b88", - "position": "top right", - "displayTime": "5", - "highlight": "", - "sendall": true, - "outputs": 0, - "ok": "OK", - "cancel": "", - "raw": false, - "topic": "", - "name": "", - "x": 1390, - "y": 280, - "wires": [] - }, - { - "id": "6f64625f.243fd4", - "type": "ui_chart", - "z": "bee3b478.ef4b88", - "name": "chart area", - "group": "6d1af0ab.7b4a18", - "order": 5, - "width": 24, - "height": 7, - "label": "chart area", - "chartType": "line", - "legend": "false", - "xformat": "HH:mm:ss", - "interpolate": "linear", - "nodata": "Objects area will be shown here once the segmentation is started", - "dot": true, - "ymin": "", - "ymax": "", - "removeOlder": 1, - "removeOlderPoints": "1000", - "removeOlderUnit": "3600", - "cutout": 0, - "useOneColor": false, - "useUTC": true, - "colors": [ - "#1f77b4", - "#aec7e8", - "#ff7f0e", - "#2ca02c", - "#98df8a", - "#d62728", - "#ff9896", - "#9467bd", - "#c5b0d5" - ], - "useOldStyle": false, - "outputs": 1, - "x": 1370, - "y": 540, - "wires": [ - [] - ] - }, - { - "id": "c2d35803.b5024", - "type": "debug", - "z": "bee3b478.ef4b88", - "name": "segmentation name", - "active": true, - "tosidebar": true, - "console": false, - "tostatus": false, - "complete": "true", - "targetType": "full", - "statusVal": "", - "statusType": "auto", - "x": 920, - "y": 460, - "wires": [] - }, - { - "id": "ce12cb65.115838", + "id": "5846b1d4.7971b", "type": "ui_button", - "z": "9c3e6ad4.7471a8", - "name": "", - "group": "adcd0ef7.81a7f8", - "order": 5, - "width": 7, - "height": 1, - "passthru": false, - "label": "Reboot", - "tooltip": "", - "color": "", - "bgcolor": "#AD1625", - "icon": "", - "payload": "reboot", - "payloadType": "str", - "topic": "reboot", - "x": 240, - "y": 80, - "wires": [ - [ - "677f762b.43c648" - ] - ] - }, - { - "id": "690ed112.f50c3", - "type": "exec", - "z": "9c3e6ad4.7471a8", - "command": "sudo", - "addpay": true, - "append": "now", - "useSpawn": "false", - "timer": "2", - "oldrc": false, - "name": "cmd", - "x": 550, - "y": 80, - "wires": [ - [], - [], - [] - ] - }, - { - "id": "4a608a65.1882ec", - "type": "ui_button", - "z": "9c3e6ad4.7471a8", - "name": "", - "group": "adcd0ef7.81a7f8", - "order": 3, - "width": 8, - "height": 1, - "passthru": false, - "label": "Shutdown", - "tooltip": "", - "color": "", - "bgcolor": "#AD1625", - "icon": "", - "payload": "shutdown", - "payloadType": "str", - "topic": "shutdown", - "x": 240, - "y": 160, - "wires": [ - [ - "677f762b.43c648" - ] - ] - }, - { - "id": "677f762b.43c648", - "type": "python3-function", - "z": "9c3e6ad4.7471a8", - "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\n#msg[\"payload\"] = str(msg[\"topic\"])+' now'\nreturn msg", - "outputs": 1, - "x": 390, - "y": 120, - "wires": [ - [ - "50d1becd.7b5f", - "690ed112.f50c3" - ] - ] - }, - { - "id": "50d1becd.7b5f", - "type": "exec", - "z": "9c3e6ad4.7471a8", - "command": "i2cdetect -y 1", - "addpay": false, - "append": "", - "useSpawn": "false", - "timer": "1", - "oldrc": false, - "name": "i2c update", - "x": 560, - "y": 160, - "wires": [ - [], - [], - [] - ] - }, - { - "id": "f435f66d.26d73", - "type": "ui_numeric", - "z": "1a447be0.198674", - "name": "object_depth_min", - "label": "Minimum depth (m)", - "tooltip": "", - "group": "ab1d06d6.bf9898", + "z": "bccd1f23.87219", + "name": "Backward", + "group": "707d9797.c8e798", "order": 2, - "width": 0, - "height": 0, - "wrap": false, - "passthru": true, - "topic": "object_depth_min", - "format": "{{value}}", - "min": "0", - "max": "2000", - "step": "1", - "x": 610, - "y": 120, - "wires": [ - [] - ] - }, - { - "id": "79026dc4.133a7c", - "type": "ui_numeric", - "z": "1a447be0.198674", - "name": "object_depth_max", - "label": "Maximum depth (m)", + "width": 5, + "height": 1, + "passthru": false, + "label": "", "tooltip": "", - "group": "ab1d06d6.bf9898", - "order": 1, - "width": 0, - "height": 0, - "wrap": false, - "passthru": true, - "topic": "object_depth_max", - "format": "{{value}}", - "min": "0", - "max": "2000", - "step": "1", - "x": 610, - "y": 160, - "wires": [ - [] - ] - }, - { - "id": "5cdbcd15.17ec94", - "type": "function", - "z": "1a447be0.198674", - "name": "get object_depth_min", - "func": "msg.payload = msg.payload.object_depth_min;\nreturn msg;", - "outputs": 1, - "noerr": 0, - "x": 360, - "y": 120, - "wires": [ - [ - "f435f66d.26d73" - ] - ] - }, - { - "id": "c2ccc2e1.a697f8", - "type": "function", - "z": "1a447be0.198674", - "name": "get object_depth_max", - "func": "msg.payload = msg.payload.object_depth_max;\nreturn msg;", - "outputs": 1, - "noerr": 0, - "x": 360, - "y": 160, - "wires": [ - [ - "79026dc4.133a7c" - ] - ] - }, - { - "id": "cb77803f.357f88", - "type": "gpsd", - "z": "1a447be0.198674", - "name": "", - "hostname": "localhost", - "port": "2947", - "tpv": true, - "sky": false, - "info": false, - "device": false, - "gst": false, - "att": false, - "x": 90, + "color": "", + "bgcolor": "", + "icon": "arrow_back", + "payload": "BACKWARD", + "payloadType": "str", + "topic": "actuator/pump", + "x": 180, "y": 220, "wires": [ [ - "b3e8d04.7c83d3", - "3f718ceb.5e9f34", - "74554b33.14ab6c" + "3cb96380.e575ec" ] ] }, { - "id": "f7ae988c.184598", - "type": "ui_worldmap", - "z": "1a447be0.198674", - "d": true, - "group": "7b7849e8.363288", + "id": "2cab680b.baf888", + "type": "ui_button", + "z": "bccd1f23.87219", + "name": "Forward", + "group": "707d9797.c8e798", + "order": 4, + "width": 5, + "height": 1, + "passthru": true, + "label": "", + "tooltip": "", + "color": "", + "bgcolor": "", + "icon": "arrow_forward", + "payload": "FORWARD", + "payloadType": "str", + "topic": "actuator/pump", + "x": 180, + "y": 260, + "wires": [ + [ + "3cb96380.e575ec" + ] + ] + }, + { + "id": "961d27e7.da65c8", + "type": "ui_switch", + "z": "bccd1f23.87219", + "name": "light_state", + "label": "Light", + "tooltip": "", + "group": "4248342d.e55fac", "order": 1, "width": 0, "height": 0, - "name": "", - "lat": "", - "lon": "", - "zoom": "7", - "layer": "Nat Geo", - "cluster": "1", - "maxage": "", - "usermenu": "hide", - "layers": "hide", - "panit": "false", - "panlock": "false", - "zoomlock": "false", - "hiderightclick": "true", - "coords": "deg", - "showgrid": "false", - "path": "/worldmap", - "x": 640, - "y": 200, - "wires": [] - }, - { - "id": "b3e8d04.7c83d3", - "type": "function", - "z": "1a447be0.198674", - "name": "get object_lat & object_lon", - "func": "error = Math.sqrt(msg.payload.epx**2+msg.payload.epy**2)\n\nmsg.payload = {\n \"name\":\"sailboat\",\n \"lat\":msg.payload.lat,\n \"lon\":msg.payload.lon,\n \"speed\":msg.payload.speed,\n \"bearing\":msg.payload.track,\n \"icon\":\"ship\",\n \"accuracy\":error,\n \"command\": { \"lat\":msg.payload.lat, \"lon\":msg.payload.lon,\n grid : {showgrid: true,\n opt: { showLabel:true, dashArray:[5, 5], fontColor:\"#900\" }\n }\n }\n};\n\nreturn msg;", - "outputs": 1, - "noerr": 0, - "initialize": "", - "finalize": "", - "x": 350, - "y": 200, - "wires": [ - [ - "f7ae988c.184598" - ] - ] - }, - { - "id": "9c08f843.b1e1b", - "type": "function", - "z": "1a447be0.198674", - "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, - "initialize": "", - "finalize": "", - "x": 620, - "y": 80, - "wires": [ - [] - ] - }, - { - "id": "157ba5ca.c88a52", - "type": "function", - "z": "1a447be0.198674", - "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, - "initialize": "", - "finalize": "", - "x": 620, + "passthru": true, + "decouple": "false", + "topic": "", + "style": "", + "onvalue": "true", + "onvalueType": "bool", + "onicon": "", + "oncolor": "", + "offvalue": "false", + "offvalueType": "bool", + "officon": "", + "offcolor": "", + "x": 280, "y": 40, "wires": [ - [] - ] + [ + "cbb8afed.0a026" + ] + ], + "icon": "font-awesome/fa-lightbulb-o" }, { - "id": "701120fd.c5516", - "type": "function", - "z": "758bc08f.c57318", - "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, - "noerr": 0, - "x": 750, - "y": 360, - "wires": [ - [] - ] - }, - { - "id": "2554ff8e.8cf1a8", + "id": "cc966678.da8d08", "type": "ui_dropdown", - "z": "758bc08f.c57318", + "z": "bccd1f23.87219", "name": "acq_fnumber_objective", "label": "M12 Lens*", "tooltip": "", "place": "Select option", - "group": "4361c3b6.e2b7a4", - "order": 3, + "group": "4248342d.e55fac", + "order": 2, "width": 0, "height": 0, "passthru": true, @@ -2429,374 +2496,1221 @@ ], "payload": "", "topic": "acq_fnumber_objective", - "x": 526, - "y": 360, + "x": 1080, + "y": 100, "wires": [ [ - "701120fd.c5516" + "8038414a.34461" ] ] }, { - "id": "2f9ae002.b4c96", - "type": "ui_numeric", - "z": "758bc08f.c57318", - "name": "acq_minimum_mesh", - "label": "Min fraction size (μm)", - "tooltip": "", - "group": "4361c3b6.e2b7a4", - "order": 8, + "id": "9b515beb.4aea48", + "type": "ui_template", + "z": "bccd1f23.87219", + "group": "4248342d.e55fac", + "name": "Magnification", + "order": 3, "width": 0, "height": 0, - "wrap": false, - "passthru": true, - "topic": "acq_minimum_mesh", - "format": "{{value}}", - "min": 0, - "max": "300", - "step": "10", - "x": 536, - "y": 160, + "format": "
\n Magnification : X\n \n \n
", + "storeOutMessages": true, + "fwdInMessages": true, + "templateScope": "local", + "x": 1670, + "y": 100, "wires": [ [] ] }, { - "id": "c86d98d4.c56538", - "type": "ui_numeric", - "z": "758bc08f.c57318", - "name": "acq_maximum_mesh", - "label": "Max fraction size (μm)", - "tooltip": "", - "group": "4361c3b6.e2b7a4", + "id": "8038414a.34461", + "type": "function", + "z": "bccd1f23.87219", + "name": "calculate", + "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(\"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(\"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(\"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(\"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(\"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, + "noerr": 0, + "initialize": "", + "finalize": "", + "x": 1280, + "y": 100, + "wires": [ + [ + "ad87820f.b1d1e", + "d68a52ee.82e8e", + "238f26b1.e2089a", + "6e0f6d36.a6b854" + ] + ] + }, + { + "id": "3d2360ad.e41e7", + "type": "ui_template", + "z": "bccd1f23.87219", + "group": "4248342d.e55fac", + "name": "process_pixel", "order": 4, "width": 0, "height": 0, - "wrap": false, - "passthru": true, - "topic": "acq_maximum_mesh", - "format": "{{value}}", - "min": "200", - "max": "2000", - "step": "100", - "x": 536, - "y": 200, + "format": "
\n Pixel resolution :\n \n μm\n
", + "storeOutMessages": true, + "fwdInMessages": true, + "resendOnRefresh": false, + "templateScope": "local", + "x": 1680, + "y": 140, "wires": [ [] ] }, { - "id": "98d1f331.a06938", - "type": "ui_text_input", - "z": "758bc08f.c57318", - "name": "acq_id", - "label": "Acquisition unique ID*", - "tooltip": "", - "group": "4361c3b6.e2b7a4", - "order": 1, + "id": "8e66977b.9166a8", + "type": "ui_template", + "z": "bccd1f23.87219", + "group": "4248342d.e55fac", + "name": "min_size", + "order": 5, "width": 0, "height": 0, - "passthru": true, - "mode": "number", - "delay": 300, - "topic": "acq_id", - "x": 586, + "format": "
\n Smallest cells to explore :\n \n μm\n
", + "storeOutMessages": true, + "fwdInMessages": true, + "templateScope": "local", + "x": 1660, + "y": 180, + "wires": [ + [] + ] + }, + { + "id": "26b32f2c.c64fc", + "type": "ui_template", + "z": "bccd1f23.87219", + "group": "4248342d.e55fac", + "name": "max_size", + "order": 6, + "width": 0, + "height": 0, + "format": "
\n Biggest cells to explore :\n \n μm\n
", + "storeOutMessages": true, + "fwdInMessages": true, + "templateScope": "local", + "x": 1660, + "y": 220, + "wires": [ + [] + ] + }, + { + "id": "ad87820f.b1d1e", + "type": "function", + "z": "bccd1f23.87219", + "name": "get magnification", + "func": "var magnification = global.get(\"magnification\");\nmsg.payload = magnification;\nreturn msg;", + "outputs": 1, + "noerr": 0, + "x": 1490, + "y": 100, + "wires": [ + [ + "9b515beb.4aea48" + ] + ] + }, + { + "id": "d68a52ee.82e8e", + "type": "function", + "z": "bccd1f23.87219", + "name": "get process_pixel", + "func": "var process_pixel = global.get(\"process_pixel\");\nmsg.payload = process_pixel;\nreturn msg;", + "outputs": 1, + "noerr": 0, + "initialize": "", + "finalize": "", + "x": 1490, + "y": 140, + "wires": [ + [ + "3d2360ad.e41e7" + ] + ] + }, + { + "id": "238f26b1.e2089a", + "type": "function", + "z": "bccd1f23.87219", + "name": "get sug_min", + "func": "var sug_min = global.get(\"sug_min\");\nmsg.payload = sug_min;\nreturn msg;", + "outputs": 1, + "noerr": 0, + "x": 1470, + "y": 180, + "wires": [ + [ + "8e66977b.9166a8" + ] + ] + }, + { + "id": "6e0f6d36.a6b854", + "type": "function", + "z": "bccd1f23.87219", + "name": "get sug_max", + "func": "var sug_max = global.get(\"sug_max\");\nmsg.payload = sug_max;\nreturn msg;", + "outputs": 1, + "noerr": 0, + "x": 1470, + "y": 220, + "wires": [ + [ + "26b32f2c.c64fc" + ] + ] + }, + { + "id": "bb2bb7ce.1d1458", + "type": "ui_template", + "z": "baa1e3d9.cb29d", + "group": "858a0e3c.987fe", + "name": "Stream Pi Camera", + "order": 1, + "width": 14, + "height": 11, + "format": "
\n \n
", + "storeOutMessages": true, + "fwdInMessages": true, + "resendOnRefresh": false, + "templateScope": "local", + "x": 910, "y": 40, "wires": [ [] ] }, { - "id": "42505cbd.f02b1c", - "type": "ui_dropdown", - "z": "758bc08f.c57318", - "name": "acq_celltype", - "label": "Thickness flowcell*", - "tooltip": "", - "place": "Select option", - "group": "4361c3b6.e2b7a4", - "order": 7, - "width": 0, - "height": 0, - "passthru": true, - "options": [ - { - "label": "200 μm µ-Slide I Luer", - "value": 200, - "type": "num" - }, - { - "label": "400 μm µ-Slide I Luer", - "value": 400, - "type": "num" - }, - { - "label": "600 μm µ-Slide I Luer", - "value": 600, - "type": "num" - }, - { - "label": "800 μm µ-Slide I Luer", - "value": 800, - "type": "num" - } - ], - "payload": "", - "topic": "acq_celltype", - "x": 566, - "y": 120, + "id": "d0c5b57d.590818", + "type": "ui_ui_control", + "z": "baa1e3d9.cb29d", + "name": "", + "events": "change", + "x": 1020, + "y": 80, "wires": [ [] ] }, { - "id": "13b51e1e.1f603a", + "id": "16de754c.cc969b", + "type": "ui_button", + "z": "b771c342.49603", + "name": "", + "group": "5517c651.b2f668", + "order": 1, + "width": 12, + "height": 1, + "passthru": false, + "label": "Previous", + "tooltip": "", + "color": "#097479", + "bgcolor": "white", + "icon": "keyboard_return", + "payload": "{\"tab\":\"Home\"}", + "payloadType": "json", + "topic": "", + "x": 280, + "y": 1000, + "wires": [ + [ + "222c851d.5d0a3a" + ] + ] + }, + { + "id": "84f3d040.5f7ea", + "type": "ui_button", + "z": "b771c342.49603", + "name": "", + "group": "5517c651.b2f668", + "order": 2, + "width": 12, + "height": 1, + "passthru": false, + "label": "Continue", + "tooltip": "", + "color": "#097479", + "bgcolor": "white", + "icon": "keyboard_tab", + "payload": "{\"tab\":\"Home\"}", + "payloadType": "json", + "topic": "", + "x": 280, + "y": 1060, + "wires": [ + [ + "986d960a.c75908" + ] + ] + }, + { + "id": "f61aaed5.1e64", + "type": "ui_button", + "z": "bccd1f23.87219", + "name": "", + "group": "7a0b4877.a5d268", + "order": 1, + "width": 5, + "height": 1, + "passthru": false, + "label": "Previous", + "tooltip": "", + "color": "#097479", + "bgcolor": "white", + "icon": "keyboard_return", + "payload": "{\"tab\":\"Sample\"}", + "payloadType": "json", + "topic": "", + "x": 500, + "y": 1000, + "wires": [ + [ + "6c792043.b6ff9" + ] + ] + }, + { + "id": "9ba6ec0a.22c96", + "type": "ui_button", + "z": "bccd1f23.87219", + "name": "", + "group": "7a0b4877.a5d268", + "order": 2, + "width": 5, + "height": 1, + "passthru": false, + "label": "Continue", + "tooltip": "", + "color": "#097479", + "bgcolor": "white", + "icon": "keyboard_tab", + "payload": "{\"tab\":\"Home\"}", + "payloadType": "json", + "topic": "", + "x": 500, + "y": 1060, + "wires": [ + [ + "fe840e05.b46f3" + ] + ] + }, + { + "id": "c72f8fae.23bd4", + "type": "ui_button", + "z": "baa1e3d9.cb29d", + "name": "", + "group": "b7919ae2.c01788", + "order": 1, + "width": 5, + "height": 1, + "passthru": false, + "label": "Previous", + "tooltip": "", + "color": "#097479", + "bgcolor": "white", + "icon": "keyboard_return", + "payload": "{\"tab\":\"Optic Configuration\"}", + "payloadType": "json", + "topic": "", + "x": 880, + "y": 80, + "wires": [ + [ + "d0c5b57d.590818" + ] + ] + }, + { + "id": "389bef3.d94c61", "type": "ui_text_input", - "z": "758bc08f.c57318", + "z": "baa1e3d9.cb29d", "name": "acq_volume", "label": "Volume to pass (ml)", "tooltip": "", - "group": "4361c3b6.e2b7a4", - "order": 2, - "width": 0, - "height": 0, + "group": "4322c187.e73e5", + "order": 1, + "width": 5, + "height": 1, "passthru": true, "mode": "number", "delay": 300, "topic": "acq_volume", - "x": 566, - "y": 240, + "x": 630, + "y": 200, + "wires": [ + [ + "fb887036.12429" + ] + ] + }, + { + "id": "b4d324de.a2bd28", + "type": "ui_worldmap", + "z": "b771c342.49603", + "d": true, + "group": "da2c279f.cbe318", + "order": 6, + "width": 0, + "height": 0, + "name": "", + "lat": "1.5", + "lon": "1.5", + "zoom": "4", + "layer": "OSM grey", + "cluster": "1", + "maxage": "", + "usermenu": "hide", + "layers": "hide", + "panit": "false", + "panlock": "false", + "zoomlock": "false", + "hiderightclick": "true", + "coords": "deg", + "showgrid": "false", + "path": "/worldmap", + "x": 840, + "y": 920, + "wires": [] + }, + { + "id": "cf3e1477.25af68", + "type": "function", + "z": "b771c342.49603", + "d": true, + "name": "set point", + "func": "var sample_id= global.get(\"sample_id\");\nvar object_lat= global.get(\"object_lat\");\nvar object_lon= global.get(\"object_lon\");\n\nif (sample_id === undefined || sample_id === \"\") {\n msg.topic = \"Missing entry :\"\n msg.payload = \"Sample ID\"\n}\nelse if (object_lat === undefined || object_lat === null) {\n msg.topic = \"Missing entry :\"\n msg.payload = \"Sample latitude\"\n}\n\nelse if (object_lon === undefined || object_lon === null) {\n msg.topic = \"Missing entry :\"\n msg.payload = \"Sample longitude\"\n}\n\nelse {\n msg.topic = \"Place\"\n msg.payload={\"name\":sample_id, \"lat\":object_lat, \"lon\":object_lon}\n}\nreturn msg;\n", + "outputs": 1, + "noerr": 0, + "x": 420, + "y": 960, + "wires": [ + [ + "105e9b1b.725865" + ] + ] + }, + { + "id": "d7a44df2.0fb29", + "type": "ui_button", + "z": "b771c342.49603", + "d": true, + "name": "", + "group": "da2c279f.cbe318", + "order": 5, + "width": 5, + "height": 1, + "passthru": false, + "label": "Place", + "tooltip": "", + "color": "#333333", + "bgcolor": "white", + "icon": "", + "payload": "", + "payloadType": "str", + "topic": "", + "x": 270, + "y": 960, + "wires": [ + [ + "cf3e1477.25af68" + ] + ] + }, + { + "id": "105e9b1b.725865", + "type": "switch", + "z": "b771c342.49603", + "d": true, + "name": "", + "property": "topic", + "propertyType": "msg", + "rules": [ + { + "t": "eq", + "v": "Place", + "vt": "str" + }, + { + "t": "eq", + "v": "Missing entry :", + "vt": "str" + } + ], + "checkall": "true", + "repair": false, + "outputs": 2, + "x": 610, + "y": 960, + "wires": [ + [ + "b4d324de.a2bd28" + ], + [ + "10c9c12a.feae6f" + ] + ] + }, + { + "id": "10c9c12a.feae6f", + "type": "ui_toast", + "z": "b771c342.49603", + "d": true, + "position": "dialog", + "displayTime": "3", + "highlight": "", + "sendall": true, + "outputs": 1, + "ok": "OK", + "cancel": "", + "raw": false, + "topic": "", + "name": "", + "x": 850, + "y": 980, "wires": [ [] ] }, { - "id": "3b9700c4.b93ec", + "id": "f07dec1d.147ce", "type": "ui_text_input", - "z": "758bc08f.c57318", - "name": "acq_instrument", - "label": "Acquisition instrument", - "tooltip": "PlanktonScope V2.1", - "group": "4361c3b6.e2b7a4", - "order": 6, + "z": "baa1e3d9.cb29d", + "name": "comment", + "label": "Comment", + "tooltip": "", + "group": "567a49a4.244cb8", + "order": 5, "width": 0, "height": 0, "passthru": true, "mode": "text", "delay": 300, - "topic": "acq_instrument", - "x": 556, - "y": 80, + "topic": "comment", + "x": 640, + "y": 280, + "wires": [ + [ + "fb887036.12429" + ] + ] + }, + { + "id": "8bd55b54.8e3938", + "type": "file", + "z": "baa1e3d9.cb29d", + "name": "logs.json", + "filename": "/var/www/logs.json", + "appendNewline": false, + "createDir": false, + "overwriteFile": "false", + "encoding": "none", + "x": 2000, + "y": 1340, + "wires": [ + [ + "20a2d27e.7ccafe" + ] + ] + }, + { + "id": "99fd2803.0843a8", + "type": "function", + "z": "baa1e3d9.cb29d", + "name": "get global", + "func": "msg.payload = {\n \"comment\":global.get(\"comment\"),\n \"sample_project\":global.get(\"sample_project\"),\n \"sample_ship\":global.get(\"sample_ship\"),\n \"sample_operator\":global.get(\"sample_operator\"),\n \"sample_id\":global.get(\"sample_id\"),\n \"sample_sampling_gear\":global.get(\"sample_sampling_gear\"),\n \n \"sample_hour\":global.get(\"sample_hour\"),\n \"sample_minute\":global.get(\"sample_minute\"),\n \"sample_day\":global.get(\"sample_day\"),\n \"sample_month\":global.get(\"sample_month\"),\n \"sample_year\":global.get(\"sample_year\"),\n \n \"object_lat\":global.get(\"object_lat\"),\n \"object_lon\":global.get(\"object_lon\"),\n \n \"acq_id\":global.get(\"acq_id\"),\n \"acq_fnumber_objective\":global.get(\"acq_fnumber_objective\"),\n \"acq_celltype\":global.get(\"acq_celltype\"),\n \"acq_maximum_mesh\":global.get(\"acq_maximum_mesh\"),\n \"acq_minimum_mesh\":global.get(\"acq_minimum_mesh\"),\n \"process_pixel\":global.get(\"process_pixel\"),\n \n \"acq_camera\":global.get(\"acq_camera\"),\n \"acq_instrument\":global.get(\"acq_instrument\"),\n \"acq_software\":global.get(\"acq_software\"),\n \"acq_instrument_ID\":global.get(\"acq_instrument_ID\"),\n \"acq_volume\":global.get(\"acq_volume\"),\n \"acq_flowrate\":global.get(\"sug_flowrate\")\n }\n\nreturn msg;", + "outputs": 1, + "noerr": 0, + "x": 1820, + "y": 1340, + "wires": [ + [ + "8bd55b54.8e3938" + ] + ] + }, + { + "id": "ae692178.d44d1", + "type": "python3-function", + "z": "baa1e3d9.cb29d", + "name": "pump.py", + "func": "from adafruit_motor import stepper\nfrom adafruit_motorkit import MotorKit\nfrom time import sleep\n\nkit = MotorKit()\npump_stepper = kit.stepper1\npump_stepper.release()\n\nstate = str(msg[\"state\"])\nvolume = int(msg[\"volume\"])\norientation = str(msg[\"orientation\"])\nflowrate = float(msg[\"flowrate\"])\n\n\nif(state==\"free\"):\n #35000steps will pass 69ml if sleep(0.05) in between 2 steps\n #1ml is about 35000/69=507steps\n nb_step=volume*507 \n #nb_step=vol*460 if sleep(0) in between 2 steps\n \n duration=(volume*60)/flowrate\n \n delay=(duration/nb_step)-0.005\n \nif(state==\"canceled\"):\n nb_step=0\n \nfor i in range(nb_step):\n pump_stepper.onestep(direction=stepper.BACKWARD, style=stepper.DOUBLE)\n sleep(delay)\n \nsleep(1)\npump_stepper.release()\n\nmsg[\"topic\"] = \"pump\"\nmsg[\"payload\"] = \"done\"\n\nreturn msg", + "outputs": 1, + "x": 1240, + "y": 1260, + "wires": [ + [ + "783209c7.51c5a8" + ] + ] + }, + { + "id": "a3fd6b29.2ef5f8", + "type": "function", + "z": "baa1e3d9.cb29d", + "name": "pump.js", + "func": "state = global.get(\"state\");\n\nif (state == null){\n state=\"free\"\n}\n\nif(state===\"free\"||state===\"canceled\"){\n volume = global.get(\"acq_volume\");\n flowrate = global.get(\"sug_flowrate\");\n duration=(((volume*60)/flowrate)-2)*1000\n global.set(\"duration\",duration);\n \n msg.volume = volume;\n msg.orientation = \"forward\";\n msg.flowrate = flowrate;\n msg.rgb = {r:0, g:255, b:255}\n msg.state = state\n \n return msg;\n \n \n}", + "outputs": 1, + "noerr": 0, + "x": 1040, + "y": 1360, + "wires": [ + [ + "ae692178.d44d1", + "e0f9efda.fa4ce" + ] + ], + "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": "e0f9efda.fa4ce", + "type": "python3-function", + "z": "baa1e3d9.cb29d", + "name": "actuate RGB", + "func": "import smbus\nfrom time import sleep\n\nbus = smbus.SMBus(1)\n\nrgb=msg['rgb']\nbus.write_byte_data(0x0d, 0x00, 0)\nbus.write_byte_data(0x0d, 0x01, rgb[\"r\"])\nbus.write_byte_data(0x0d, 0x02, rgb[\"g\"])\nbus.write_byte_data(0x0d, 0x03, rgb[\"b\"])\nbus.write_byte_data(0x0d, 0x00, 1)\nbus.write_byte_data(0x0d, 0x01, rgb[\"r\"])\nbus.write_byte_data(0x0d, 0x02, rgb[\"g\"])\nbus.write_byte_data(0x0d, 0x03, rgb[\"b\"])\nbus.write_byte_data(0x0d, 0x00, 2)\nbus.write_byte_data(0x0d, 0x01, rgb[\"r\"])\nbus.write_byte_data(0x0d, 0x02, rgb[\"g\"])\nbus.write_byte_data(0x0d, 0x03, rgb[\"b\"])\nreturn msg;", + "outputs": 1, + "x": 1250, + "y": 1200, + "wires": [ + [ + "3b498e72.6e6292" + ] + ] + }, + { + "id": "7baf5071.dc3b2", + "type": "exec", + "z": "baa1e3d9.cb29d", + "command": "i2cdetect -y 1", + "addpay": false, + "append": "", + "useSpawn": "false", + "timer": "1", + "oldrc": false, + "name": "i2c update", + "x": 1570, + "y": 1200, + "wires": [ + [], + [], + [] + ] + }, + { + "id": "783209c7.51c5a8", + "type": "link out", + "z": "baa1e3d9.cb29d", + "name": "", + "links": [ + "e1354861.0bb648", + "2bc762dd.1115ce", + "a50134c.ed45ac8", + "f0ef065a.362028" + ], + "x": 1335, + "y": 1260, + "wires": [] + }, + { + "id": "3b498e72.6e6292", + "type": "function", + "z": "baa1e3d9.cb29d", + "name": "set busy", + "func": "global.set(\"state\",\"busy\");\nreturn msg;", + "outputs": 1, + "noerr": 0, + "x": 1420, + "y": 1200, + "wires": [ + [ + "7baf5071.dc3b2" + ] + ] + }, + { + "id": "cd56bb1c.8ce378", + "type": "ui_toast", + "z": "baa1e3d9.cb29d", + "position": "dialog", + "displayTime": "3", + "highlight": "", + "sendall": true, + "outputs": 1, + "ok": "OK", + "cancel": "", + "raw": false, + "topic": "", + "name": "", + "x": 1010, + "y": 1200, "wires": [ [] ] }, { - "id": "f3658d30.b8448", - "type": "function", - "z": "758bc08f.c57318", - "name": "get acq_id", - "func": "msg.payload = msg.payload.acq_id+1;\nreturn msg;", - "outputs": 1, - "noerr": 0, - "x": 200, - "y": 40, + "id": "c82e467c.99e208", + "type": "switch", + "z": "baa1e3d9.cb29d", + "name": "", + "property": "topic", + "propertyType": "msg", + "rules": [ + { + "t": "eq", + "v": "Missing entry :", + "vt": "str" + }, + { + "t": "eq", + "v": "Start", + "vt": "str" + } + ], + "checkall": "true", + "repair": false, + "outputs": 2, + "x": 850, + "y": 1220, "wires": [ [ - "98d1f331.a06938" + "cd56bb1c.8ce378" + ], + [ + "a3fd6b29.2ef5f8", + "a642fc0b.b6dd7" ] ] }, { - "id": "5acd51d4.4ab13", + "id": "c6bd5987.c48f78", + "type": "http request", + "z": "baa1e3d9.cb29d", + "name": "Start timelapse", + "method": "GET", + "ret": "txt", + "paytoqs": false, + "url": "http://127.0.0.1/html/cmd_pipe.php?cmd=tl%201", + "tls": "", + "persist": false, + "proxy": "", + "authType": "", + "x": 1100, + "y": 1600, + "wires": [ + [] + ] + }, + { + "id": "8c15fd05.81b5", "type": "function", - "z": "758bc08f.c57318", - "name": "get acq_instrument", - "func": "msg.payload = msg.payload.acq_instrument;\nreturn msg;", + "z": "baa1e3d9.cb29d", + "name": "get duration acquisition", + "func": "msg.delay = global.get(\"duration\");\n\nreturn msg;", "outputs": 1, "noerr": 0, - "x": 230, - "y": 80, + "x": 1290, + "y": 1360, "wires": [ [ - "3b9700c4.b93ec" + "2ff9c0cb.7288b", + "34929df1.bfe602" ] ] }, { - "id": "de2c90cf.b73b08", - "type": "function", - "z": "758bc08f.c57318", - "name": "get acq_celltype", - "func": "msg.payload = msg.payload.acq_celltype;\nreturn msg;", - "outputs": 1, - "noerr": 0, - "x": 220, - "y": 120, + "id": "2ff9c0cb.7288b", + "type": "delay", + "z": "baa1e3d9.cb29d", + "name": "wait duration", + "pauseType": "delayv", + "timeout": "1", + "timeoutUnits": "seconds", + "rate": "1", + "nbRateUnits": "1", + "rateUnits": "second", + "randomFirst": "1", + "randomLast": "5", + "randomUnits": "seconds", + "drop": false, + "x": 1510, + "y": 1360, "wires": [ [ - "42505cbd.f02b1c" + "99fd2803.0843a8", + "3475ecd5.6655f4", + "8f991d2e.6e8f3", + "e6a12f33.c7768" ] ] }, { - "id": "5e3dec55.881074", - "type": "function", - "z": "758bc08f.c57318", - "name": "get acq_minimum_mesh", - "func": "msg.payload = msg.payload.acq_minimum_mesh;\nreturn msg;", - "outputs": 1, - "noerr": 0, - "x": 250, - "y": 160, + "id": "a642fc0b.b6dd7", + "type": "delay", + "z": "baa1e3d9.cb29d", + "name": "", + "pauseType": "delay", + "timeout": "500", + "timeoutUnits": "milliseconds", + "rate": "1", + "nbRateUnits": "1", + "rateUnits": "second", + "randomFirst": "1", + "randomLast": "5", + "randomUnits": "seconds", + "drop": false, + "x": 810, + "y": 1540, "wires": [ [ - "2f9ae002.b4c96" + "c6bd5987.c48f78", + "8c15fd05.81b5" ] ] }, { - "id": "d3ca8847.4d1ae", - "type": "function", - "z": "758bc08f.c57318", - "name": "get acq_maximum_mesh", - "func": "msg.payload = msg.payload.acq_maximum_mesh;\nreturn msg;", + "id": "6aaa3bc6.b7dda4", + "type": "ui_gauge", + "z": "baa1e3d9.cb29d", + "name": "", + "group": "b5d61bc7.54fe48", + "order": 1, + "width": 10, + "height": 2, + "gtype": "donut", + "title": "", + "label": "%", + "format": "{{value}}", + "min": 0, + "max": "100", + "colors": [ + "#ffffff", + "#ffffff", + "#097479" + ], + "seg1": "", + "seg2": "", + "x": 2250, + "y": 1500, + "wires": [] + }, + { + "id": "34929df1.bfe602", + "type": "trigger", + "z": "baa1e3d9.cb29d", + "name": "", + "op1": "1", + "op2": "0", + "op1type": "str", + "op2type": "str", + "duration": "-1", + "extend": false, + "units": "s", + "reset": "done", + "bytopic": "all", "outputs": 1, - "noerr": 0, - "x": 250, - "y": 200, + "x": 1960, + "y": 1600, "wires": [ [ - "c86d98d4.c56538" + "e98903d2.f35c1" ] ] }, { - "id": "1f133196.96564e", + "id": "3475ecd5.6655f4", "type": "function", - "z": "758bc08f.c57318", - "name": "get acq_volume", - "func": "msg.payload = msg.payload.acq_volume;\nreturn msg;", + "z": "baa1e3d9.cb29d", + "name": "stop", + "func": "global.set(\"time_to_wait\",0);\nmsg.payload=\"done\";\nreturn msg;", "outputs": 1, "noerr": 0, - "x": 220, - "y": 240, + "x": 1810, + "y": 1500, "wires": [ [ - "13b51e1e.1f603a" + "34929df1.bfe602", + "6aaa3bc6.b7dda4" ] ] }, { - "id": "68fa1227.dbdd5c", + "id": "e98903d2.f35c1", "type": "function", - "z": "758bc08f.c57318", - "name": "get acq_fnumber_objective", - "func": "msg.payload = msg.payload.acq_fnumber_objective;\nreturn msg;", + "z": "baa1e3d9.cb29d", + "name": "pulse", + "func": "var time_to_wait= global.get(\"time_to_wait\");\n\nif (time_to_wait === undefined || time_to_wait === \"\"|| time_to_wait == NaN) {\n time_to_wait=0\n global.set(\"time_to_wait\",time_to_wait);\n}else {\n time_to_wait++;\n global.set(\"time_to_wait\",time_to_wait);\n duration=global.get(\"duration\")/1000;\n percent=(100* time_to_wait/duration).toFixed(0)\n msg.payload=percent;\n return msg;\n \n}", + "outputs": 1, + "noerr": 0, + "x": 2110, + "y": 1600, + "wires": [ + [ + "6aaa3bc6.b7dda4" + ] + ] + }, + { + "id": "f0ef065a.362028", + "type": "link in", + "z": "baa1e3d9.cb29d", + "name": "", + "links": [ + "a61d4164.135dd", + "783209c7.51c5a8", + "260e60f3.878ad", + "c5ee25c5.3c1848" + ], + "x": 1635, + "y": 1560, + "wires": [ + [ + "3475ecd5.6655f4" + ] + ] + }, + { + "id": "8f991d2e.6e8f3", + "type": "exec", + "z": "baa1e3d9.cb29d", + "command": "ls -l /var/www/html/media | grep \"th\" | tail -1 | awk -F \" \" '{print $9}' | awk -F \"_\" '{print $1\"_\"$2}'| tr -d \"\\n\"", + "addpay": false, + "append": "", + "useSpawn": "false", + "timer": "", + "oldrc": false, + "name": "get thumbail name", + "x": 1850, + "y": 1280, + "wires": [ + [ + "9dcdbf1f.4aa21" + ], + [], + [] + ] + }, + { + "id": "e6a12f33.c7768", + "type": "function", + "z": "baa1e3d9.cb29d", + "name": "mkdir", + "func": "acq_id=global.get(\"acq_id\")\nmsg.payload=\"/var/www/\"+acq_id\nreturn msg;", + "outputs": 1, + "noerr": 0, + "x": 1770, + "y": 1140, + "wires": [ + [ + "43c69256.b9633c" + ] + ] + }, + { + "id": "43c69256.b9633c", + "type": "exec", + "z": "baa1e3d9.cb29d", + "command": "mkdir", + "addpay": true, + "append": "", + "useSpawn": "false", + "timer": "", + "oldrc": false, + "name": "mkdir acq_id", + "x": 1910, + "y": 1140, + "wires": [ + [], + [], + [] + ] + }, + { + "id": "517f13e8.e0793c", + "type": "function", + "z": "baa1e3d9.cb29d", + "name": "move", + "func": "file_prefix=msg.payload;\nacq_id=global.get(\"acq_id\")\nmsg.payload=\"/var/www/html/media/\"+file_prefix+\"* /var/www/\"+acq_id+\"/\";\nreturn msg;", + "outputs": 1, + "noerr": 0, + "x": 2330, + "y": 1240, + "wires": [ + [ + "83a1d49e.a29a48" + ] + ] + }, + { + "id": "9dcdbf1f.4aa21", + "type": "delay", + "z": "baa1e3d9.cb29d", + "name": "", + "pauseType": "delay", + "timeout": "200", + "timeoutUnits": "milliseconds", + "rate": "1", + "nbRateUnits": "1", + "rateUnits": "second", + "randomFirst": "1", + "randomLast": "5", + "randomUnits": "seconds", + "drop": false, + "x": 2090, + "y": 1260, + "wires": [ + [ + "517f13e8.e0793c" + ] + ] + }, + { + "id": "83a1d49e.a29a48", + "type": "exec", + "z": "baa1e3d9.cb29d", + "command": "mv", + "addpay": true, + "append": "", + "useSpawn": "false", + "timer": "", + "oldrc": false, + "name": "", + "x": 2480, + "y": 1260, + "wires": [ + [], + [], + [] + ] + }, + { + "id": "20a2d27e.7ccafe", + "type": "function", + "z": "baa1e3d9.cb29d", + "name": "move", + "func": "file_prefix=msg.payload;\nacq_id=global.get(\"acq_id\")\nmsg.payload=\"/var/www/logs.json /var/www/\"+acq_id+\"/\";\nreturn msg;", + "outputs": 1, + "noerr": 0, + "x": 2330, + "y": 1320, + "wires": [ + [ + "87cff57.f6d3708" + ] + ] + }, + { + "id": "87cff57.f6d3708", + "type": "exec", + "z": "baa1e3d9.cb29d", + "command": "mv", + "addpay": true, + "append": "", + "useSpawn": "false", + "timer": "", + "oldrc": false, + "name": "", + "x": 2480, + "y": 1340, + "wires": [ + [], + [], + [] + ] + }, + { + "id": "7c974057.4d3f", + "type": "function", + "z": "baa1e3d9.cb29d", + "name": "get duration acquisition", + "func": "msg.delay = global.get(\"duration\");\n\nreturn msg;", + "outputs": 1, + "noerr": 0, + "x": 1430, + "y": 620, + "wires": [ + [] + ] + }, + { + "id": "29be525e.0c87fe", + "type": "ui_template", + "z": "baa1e3d9.cb29d", + "group": "b5d61bc7.54fe48", + "name": "show global", + "order": 2, + "width": 0, + "height": 0, + "format": "
\n \n
", + "storeOutMessages": true, + "fwdInMessages": true, + "resendOnRefresh": false, + "templateScope": "local", + "x": 950, + "y": 340, + "wires": [ + [] + ] + }, + { + "id": "e2919164.70927", + "type": "function", + "z": "baa1e3d9.cb29d", + "name": "get global", + "func": "msg.payload = {\n \"comment\":global.get(\"comment\"),\n \"sample_project\":global.get(\"sample_project\"),\n \"sample_ship\":global.get(\"sample_ship\"),\n \"sample_operator\":global.get(\"sample_operator\"),\n \"sample_id\":global.get(\"sample_id\"),\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(\"machine_name\"),\n \"acq_camera\":global.get(\"camera_name\"),\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 \"acq_software\":global.get(\"acq_software\"),\n \"acq_flowrate\":global.get(\"sug_flowrate\"),\n \n \"object_lat\":global.get(\"object_lat\"),\n \"object_lon\":global.get(\"object_lon\"),\n \"object_lat_end\":global.get(\"object_lat_end\"),\n \"object_lon_end\":global.get(\"object_lon_end\"),\n \"object_date\":global.get(\"object_date\"),\n \"object_time\":global.get(\"object_time\"),\n \"object_date_end\":global.get(\"object_date_end\"),\n \"object_time_end\":global.get(\"object_time_end\"),\n \"object_depth_min\":global.get(\"object_depth_min\"),\n \"object_depth_max\":global.get(\"object_depth_max\"),\n \n \"process_pixel\":global.get(\"process_pixel\"),\n \"process_id\":global.get(\"process_id\")\n \n }\n\nreturn msg;", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", - "x": 260, - "y": 360, + "x": 720, + "y": 380, "wires": [ [ - "2554ff8e.8cf1a8" + "29be525e.0c87fe", + "295bd912.8d2556" ] ] }, { - "id": "6c391d10.2f9744", - "type": "ui_numeric", - "z": "758bc08f.c57318", - "name": "acq_min_esd", - "label": "Minimum size to segment (μm)", - "tooltip": "", - "group": "4361c3b6.e2b7a4", - "order": 9, - "width": 0, - "height": 0, - "wrap": false, - "passthru": true, - "topic": "acq_min_esd", - "format": "{{value}}", - "min": 0, - "max": "300", - "step": "5", - "x": 566, - "y": 280, - "wires": [ - [] - ] + "id": "295bd912.8d2556", + "type": "debug", + "z": "baa1e3d9.cb29d", + "name": "", + "active": true, + "tosidebar": true, + "console": false, + "tostatus": false, + "complete": "payload", + "targetType": "msg", + "statusVal": "", + "statusType": "auto", + "x": 950, + "y": 380, + "wires": [] }, { - "id": "163df12e.f73f5f", - "type": "ui_numeric", - "z": "758bc08f.c57318", - "name": "acq_max_esd", - "label": "Maximum size to segment (μm)", - "tooltip": "", - "group": "4361c3b6.e2b7a4", - "order": 5, - "width": 0, - "height": 0, - "wrap": false, - "passthru": true, - "topic": "acq_max_esd", - "format": "{{value}}", - "min": "100", - "max": "2000", - "step": "5", - "x": 556, - "y": 320, - "wires": [ - [] - ] - }, - { - "id": "3414b477.4d711c", - "type": "function", - "z": "758bc08f.c57318", - "name": "get acq_min_esd", - "func": "msg.payload = msg.payload.acq_min_esd;\nreturn msg;", - "outputs": 1, - "noerr": 0, - "x": 230, - "y": 280, + "id": "7ca7754c.0f731c", + "type": "inject", + "z": "eaae323a.31b3", + "name": "", + "repeat": "", + "crontab": "", + "once": false, + "onceDelay": 0.1, + "topic": "", + "payload": "", + "payloadType": "date", + "x": 120, + "y": 420, "wires": [ [ - "6c391d10.2f9744" + "4c6d21e3.0173c" ] ] }, { - "id": "a52e7caf.6bde48", + "id": "cbb8afed.0a026", + "type": "rpi-gpio out", + "z": "bccd1f23.87219", + "name": "LED Output", + "pin": "40", + "set": true, + "level": "0", + "freq": "", + "out": "out", + "x": 450, + "y": 40, + "wires": [] + }, + { + "id": "4c6d21e3.0173c", "type": "function", - "z": "758bc08f.c57318", - "name": "get acq_max_esd", - "func": "msg.payload = msg.payload.acq_max_esd;\nreturn msg;", + "z": "eaae323a.31b3", + "name": "", + "func": "var d = new Date();\nvar t = d.getTime();\npayload={\"time\":\"message\",\"timestamp\":msg.payload}\nmsg.payload=payload;\nreturn msg;", "outputs": 1, "noerr": 0, - "x": 230, - "y": 320, + "x": 280, + "y": 420, "wires": [ [ - "163df12e.f73f5f" + "c82b48ad.8b5478" + ] + ] + }, + { + "id": "a256071b.25a008", + "type": "file", + "z": "eaae323a.31b3", + "name": "", + "filename": "/home/pi/Desktop/log/test.log", + "appendNewline": true, + "createDir": true, + "overwriteFile": "false", + "encoding": "none", + "x": 640, + "y": 420, + "wires": [ + [ + "3cd4bf1e.11ae3" + ] + ] + }, + { + "id": "3cd4bf1e.11ae3", + "type": "debug", + "z": "eaae323a.31b3", + "name": "", + "active": true, + "tosidebar": true, + "console": false, + "tostatus": false, + "complete": "false", + "x": 870, + "y": 420, + "wires": [] + }, + { + "id": "c82b48ad.8b5478", + "type": "csv", + "z": "eaae323a.31b3", + "name": "", + "sep": ",", + "hdrin": true, + "hdrout": "", + "multi": "one", + "ret": "\\n", + "temp": "timestamp,time", + "skip": "0", + "strings": true, + "x": 430, + "y": 420, + "wires": [ + [ + "a256071b.25a008" ] ] }, { "id": "3cb96380.e575ec", "type": "function", - "z": "977131e7.c2e76", + "z": "bccd1f23.87219", "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 msg.volume = volume;\n flowrate = global.get(\"pump_flowrate\");\n msg.topic = \"actuator/pump\";\n \n if(state===\"free\"){\n // msg.payload is FORWARD or BACKWARD here\n msg.payload={\"action\":\"move\", \n \"direction\":msg.payload,\n \"volume\":volume,\n \"flowrate\":flowrate};\n }\n}\nreturn msg;", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", - "x": 640, - "y": 140, + "x": 360, + "y": 240, "wires": [ [ "43fa762d.35bcb" @@ -2804,62 +3718,10 @@ ], "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": "517efd7f.811f44", - "type": "ui_button", - "z": "977131e7.c2e76", - "name": "BACKWARD", - "group": "34f03c4a.abdf94", - "order": 2, - "width": 6, - "height": 1, - "passthru": false, - "label": "", - "tooltip": "", - "color": "", - "bgcolor": "", - "icon": "arrow_back", - "payload": "BACKWARD", - "payloadType": "str", - "topic": "actuator/pump", - "x": 470, - "y": 120, - "wires": [ - [ - "3cb96380.e575ec" - ] - ] - }, - { - "id": "d5de2fb4.dc9d8", - "type": "ui_button", - "z": "977131e7.c2e76", - "name": "FORWARD", - "group": "34f03c4a.abdf94", - "order": 4, - "width": 6, - "height": 1, - "passthru": true, - "label": "", - "tooltip": "", - "color": "", - "bgcolor": "", - "icon": "arrow_forward", - "payload": "FORWARD", - "payloadType": "str", - "topic": "actuator/pump", - "x": 470, - "y": 160, - "wires": [ - [ - "3cb96380.e575ec" - ] - ] - }, { "id": "43fa762d.35bcb", "type": "switch", - "z": "977131e7.c2e76", + "z": "bccd1f23.87219", "name": "", "property": "topic", "propertyType": "msg", @@ -2878,8 +3740,8 @@ "checkall": "true", "repair": false, "outputs": 2, - "x": 770, - "y": 140, + "x": 490, + "y": 240, "wires": [ [ "bdc8ce57.de1f08" @@ -2892,7 +3754,7 @@ { "id": "8bcce348.efc1a", "type": "ui_toast", - "z": "977131e7.c2e76", + "z": "bccd1f23.87219", "position": "dialog", "displayTime": "3", "highlight": "", @@ -2903,187 +3765,52 @@ "raw": false, "topic": "", "name": "", - "x": 930, - "y": 160, + "x": 650, + "y": 260, "wires": [ [] ] }, - { - "id": "f162cc1b.985148", - "type": "ui_button", - "z": "977131e7.c2e76", - "name": "stop pump", - "group": "34f03c4a.abdf94", - "order": 5, - "width": 4, - "height": 1, - "passthru": true, - "label": "STOP PUMP", - "tooltip": "", - "color": "", - "bgcolor": "#AD1625", - "icon": "", - "payload": "{\"action\":\"stop\"}", - "payloadType": "json", - "topic": "actuator/pump", - "x": 470, - "y": 200, - "wires": [ - [ - "c38103c0.9aaa18" - ] - ] - }, { "id": "bdc8ce57.de1f08", "type": "mqtt out", - "z": "977131e7.c2e76", + "z": "bccd1f23.87219", "name": "", "topic": "", "qos": "", "retain": "", "broker": "8dc3722c.06efa8", - "x": 910, - "y": 120, + "x": 630, + "y": 220, "wires": [] }, { - "id": "c38103c0.9aaa18", - "type": "mqtt out", - "z": "977131e7.c2e76", - "name": "", - "topic": "", - "qos": "", - "retain": "", - "broker": "8dc3722c.06efa8", - "x": 610, - "y": 200, - "wires": [] - }, - { - "id": "f1b85f22.ac673", + "id": "3d31ee98.a7d6fa", "type": "ui_text_input", - "z": "977131e7.c2e76", - "name": "pump_manual_volume", - "label": "Volume to pass (ml)", - "tooltip": "", - "group": "34f03c4a.abdf94", - "order": 3, - "width": 8, - "height": 1, - "passthru": true, - "mode": "number", - "delay": 300, - "topic": "pump_manual_volume", - "x": 500, - "y": 80, - "wires": [ - [] - ] - }, - { - "id": "b8bf2a9.be099d8", - "type": "ui_slider", - "z": "977131e7.c2e76", - "name": "pump_flowrate", - "label": "Flowrate (ml/min)*", - "tooltip": "", - "group": "34f03c4a.abdf94", - "order": 1, - "width": 0, - "height": 0, - "passthru": true, - "outs": "end", - "topic": "pump_flowrate", - "min": "0.1", - "max": "10", - "step": "0.1", - "x": 480, - "y": 40, - "wires": [ - [] - ] - }, - { - "id": "f49b3397.2599f8", - "type": "ui_text_input", - "z": "a0f9bde.423644", + "z": "bccd1f23.87219", "name": "focus_distance", "label": "Distance in µm", "tooltip": "This will be rounded to the nearest 25µm", - "group": "de7c8e82.7faa98", - "order": 8, - "width": 8, - "height": 1, + "group": "fbd92986.1028c8", + "order": 4, + "width": 0, + "height": 0, "passthru": true, "mode": "number", "delay": 300, "topic": "focus_distance", - "x": 540, - "y": 40, + "x": 400, + "y": 440, "wires": [ [ - "b69e435f.b93558" + "dbd6bde.99db64" ] ] }, { - "id": "30718b7.3986b74", - "type": "ui_button", - "z": "a0f9bde.423644", - "name": "DOWN", - "group": "de7c8e82.7faa98", - "order": 4, - "width": 3, - "height": 1, - "passthru": true, - "label": "", - "tooltip": "", - "color": "", - "bgcolor": "", - "icon": "arrow_downward", - "payload": "DOWN", - "payloadType": "str", - "topic": "actuator/focus", - "x": 280, - "y": 320, - "wires": [ - [ - "ee01103f.f91b28" - ] - ] - }, - { - "id": "e0e433da.64e4e8", - "type": "ui_button", - "z": "a0f9bde.423644", - "name": "UP", - "group": "de7c8e82.7faa98", - "order": 2, - "width": 3, - "height": 1, - "passthru": false, - "label": "", - "tooltip": "", - "color": "", - "bgcolor": "", - "icon": "arrow_upwards", - "payload": "UP", - "payloadType": "str", - "topic": "actuator/focus", - "x": 290, - "y": 281, - "wires": [ - [ - "ee01103f.f91b28" - ] - ] - }, - { - "id": "c46d3379.54e17", + "id": "1f7cea1d.fbe61e", "type": "switch", - "z": "a0f9bde.423644", + "z": "bccd1f23.87219", "name": "", "property": "topic", "propertyType": "msg", @@ -3102,21 +3829,21 @@ "checkall": "true", "repair": false, "outputs": 2, - "x": 570, - "y": 300, + "x": 470, + "y": 620, "wires": [ [ - "a8dfcfd1.c5863" + "62030521.88317c" ], [ - "6e5f2b4e.fcbeac" + "d71d224f.0585d8" ] ] }, { - "id": "6e5f2b4e.fcbeac", + "id": "d71d224f.0585d8", "type": "ui_toast", - "z": "a0f9bde.423644", + "z": "bccd1f23.87219", "position": "dialog", "displayTime": "3", "highlight": "", @@ -3127,39 +3854,39 @@ "raw": false, "topic": "", "name": "", - "x": 730, - "y": 340, + "x": 650, + "y": 640, "wires": [ [] ] }, { - "id": "ee01103f.f91b28", + "id": "65ad39d.b6d4d48", "type": "function", - "z": "a0f9bde.423644", + "z": "bccd1f23.87219", "name": "focus.js", "func": "state = global.get(\"state\");\n\nif (state == null){state=\"free\"}\n\nvar distance = global.get(\"focus_distance\");\n\nif (distance === undefined || distance === \"\" || distance === null) {\n msg.topic = \"Missing entry :\"\n msg.payload = \"Distance\";\n}else {\n distance = global.get(\"focus_distance\");\n if(state===\"free\"){\n // msg.payload is UP or DOWN here\n msg.payload={\"action\":\"move\", \n \"direction\":msg.payload,\n \"distance\":(distance/1000)};\n }\n}\nreturn msg;", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", - "x": 420, - "y": 300, + "x": 320, + "y": 620, "wires": [ [ - "c46d3379.54e17" + "1f7cea1d.fbe61e" ] ] }, { - "id": "b8a2ecb3.f4f5f", + "id": "1962d999.4a97e6", "type": "ui_button", - "z": "a0f9bde.423644", + "z": "bccd1f23.87219", "name": "stop focus", - "group": "de7c8e82.7faa98", - "order": 6, - "width": 4, - "height": 1, + "group": "fbd92986.1028c8", + "order": 7, + "width": 0, + "height": 0, "passthru": true, "label": "STOP FOCUS", "tooltip": "", @@ -3169,1724 +3896,69 @@ "payload": "{\"action\":\"stop\"}", "payloadType": "json", "topic": "actuator/focus", - "x": 270, - "y": 400, + "x": 180, + "y": 680, "wires": [ [ - "2c100d73.ac6fba" + "fd05f252.5a90c" ] ] }, { - "id": "a8dfcfd1.c5863", + "id": "62030521.88317c", "type": "mqtt out", - "z": "a0f9bde.423644", + "z": "bccd1f23.87219", "name": "", "topic": "", "qos": "", "retain": "", "broker": "8dc3722c.06efa8", - "x": 710, - "y": 280, - "wires": [] - }, - { - "id": "2c100d73.ac6fba", - "type": "mqtt out", - "z": "a0f9bde.423644", - "name": "", - "topic": "", - "qos": "", - "retain": "", - "broker": "8dc3722c.06efa8", - "x": 410, - "y": 400, - "wires": [] - }, - { - "id": "67fc8b3f.96c6cc", - "type": "ui_text_input", - "z": "81483277.2521e", - "name": "sample_ship", - "label": "Name of the ship", - "tooltip": "", - "group": "71c63dd4.311c44", - "order": 4, - "width": 0, - "height": 0, - "passthru": true, - "mode": "text", - "delay": 300, - "topic": "sample_ship", - "x": 590, - "y": 160, - "wires": [ - [] - ] - }, - { - "id": "91a896c8.7c9fb8", - "type": "ui_dropdown", - "z": "81483277.2521e", - "name": "sample_sampling_gear", - "label": "Sampling gear", - "tooltip": "", - "place": "Select", - "group": "71c63dd4.311c44", - "order": 6, - "width": 0, - "height": 0, - "passthru": true, - "multiple": true, - "options": [ - { - "label": "Plankton net", - "value": "net", - "type": "str" - }, - { - "label": "Niskin bottle 12L", - "value": "niskin_12L", - "type": "str" - }, - { - "label": "Niskin bottle 24L", - "value": "niskin_24L", - "type": "str" - }, - { - "label": "Pass Hull", - "value": "pass_hull", - "type": "str" - }, - { - "label": "Flask", - "value": "flask", - "type": "str" - } - ], - "payload": "", - "topic": "sample_sampling_gear", - "x": 550, - "y": 240, - "wires": [ - [] - ] - }, - { - "id": "8cc6c6f1.65bf28", - "type": "ui_text_input", - "z": "81483277.2521e", - "name": "sample_operator", - "label": "Name of the operator", - "tooltip": "", - "group": "71c63dd4.311c44", - "order": 5, - "width": 0, - "height": 0, - "passthru": true, - "mode": "text", - "delay": 300, - "topic": "sample_operator", - "x": 570, - "y": 200, - "wires": [ - [] - ] - }, - { - "id": "adaccbb2.320458", - "type": "ui_text_input", - "z": "81483277.2521e", - "name": "sample_project", - "label": "Name of the project*", - "tooltip": "", - "group": "71c63dd4.311c44", - "order": 3, - "width": 0, - "height": 0, - "passthru": true, - "mode": "text", - "delay": 300, - "topic": "sample_project", - "x": 580, - "y": 80, - "wires": [ - [] - ] - }, - { - "id": "a63c1b66.f9a77", - "type": "ui_text_input", - "z": "81483277.2521e", - "name": "sample_id", - "label": "ID of the station*", - "tooltip": "", - "group": "71c63dd4.311c44", - "order": 7, - "width": 0, - "height": 0, - "passthru": true, - "mode": "number", - "delay": 300, - "topic": "sample_id", - "x": 590, - "y": 120, - "wires": [ - [] - ] - }, - { - "id": "d027a6bf.7049e8", - "type": "function", - "z": "81483277.2521e", - "name": "get sample_projet", - "func": "msg.payload = msg.payload.sample_project;\nreturn msg;", - "outputs": 1, - "noerr": 0, - "x": 250, - "y": 80, - "wires": [ - [ - "adaccbb2.320458" - ] - ] - }, - { - "id": "5a811caf.0f3144", - "type": "function", - "z": "81483277.2521e", - "name": "get sample_ship", - "func": "msg.payload = msg.payload.sample_ship;\nreturn msg;", - "outputs": 1, - "noerr": 0, - "x": 240, - "y": 160, - "wires": [ - [ - "67fc8b3f.96c6cc" - ] - ] - }, - { - "id": "45911c98.2bd83c", - "type": "function", - "z": "81483277.2521e", - "name": "get sample_id", - "func": "msg.payload = msg.payload.sample_id+1;\nreturn msg;", - "outputs": 1, - "noerr": 0, - "x": 240, - "y": 120, - "wires": [ - [ - "a63c1b66.f9a77" - ] - ] - }, - { - "id": "1e09a4ab.72996b", - "type": "function", - "z": "81483277.2521e", - "name": "get sample_operator", - "func": "msg.payload = msg.payload.sample_operator;\nreturn msg;", - "outputs": 1, - "noerr": 0, - "x": 260, - "y": 200, - "wires": [ - [ - "8cc6c6f1.65bf28" - ] - ] - }, - { - "id": "a3272681.f271c8", - "type": "function", - "z": "81483277.2521e", - "name": "get sample_sampling_gear", - "func": "msg.payload = msg.payload.sample_sampling_gear;\nreturn msg;", - "outputs": 1, - "noerr": 0, - "x": 280, - "y": 240, - "wires": [ - [ - "91a896c8.7c9fb8" - ] - ] - }, - { - "id": "10bfbbf.494c244", - "type": "ui_template", - "z": "81483277.2521e", - "group": "71c63dd4.311c44", - "name": "Information message", - "order": 2, - "width": 24, - "height": 1, - "format": "
Fill the different inputs concerning the sample you want to image.
", - "storeOutMessages": true, - "fwdInMessages": true, - "resendOnRefresh": false, - "templateScope": "local", - "x": 420, - "y": 40, - "wires": [ - [] - ] - }, - { - "id": "6f6ad84e.d9222", - "type": "function", - "z": "e8d4d920.35344", - "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, - "initialize": "", - "finalize": "", - "x": 1340, - "y": 220, - "wires": [ - [ - "7cd7b4d0.cfc56c" - ] - ] - }, - { - "id": "bb1b1e3.906e7e", - "type": "file", - "z": "e8d4d920.35344", - "name": "", - "filename": "/home/pi/PlanktonScope/config.json", - "appendNewline": true, - "createDir": true, - "overwriteFile": "true", - "encoding": "none", - "x": 1750, - "y": 220, - "wires": [ - [] - ] - }, - { - "id": "7cd7b4d0.cfc56c", - "type": "json", - "z": "e8d4d920.35344", - "name": "config.json", - "property": "payload", - "action": "str", - "pretty": true, - "x": 1500, - "y": 220, - "wires": [ - [ - "bb1b1e3.906e7e" - ] - ] - }, - { - "id": "83f2e27a.b59688", - "type": "file in", - "z": "e8d4d920.35344", - "name": "", - "filename": "/home/pi/PlanktonScope/config.json", - "format": "utf8", - "chunk": false, - "sendError": false, - "encoding": "none", - "x": 410, - "y": 80, - "wires": [ - [ - "3333aa46.5fa3ee" - ] - ], - "info": "# PlanktonScope Help\nThis Node will read the content of the file named **config.txt** containing all the input placeholders.\n" - }, - { - "id": "9db37b60.5e5488", - "type": "inject", - "z": "e8d4d920.35344", - "name": "on_load", - "props": [ - { - "p": "payload" - }, - { - "p": "topic", - "vt": "str" - } - ], - "repeat": "", - "crontab": "", - "once": true, - "onceDelay": 0.1, - "topic": "", - "payload": "", - "payloadType": "date", - "x": 100, - "y": 240, - "wires": [ - [ - "83f2e27a.b59688", - "c31360e5.5d804", - "cdf769fd.a196", - "452af41c.43940c" - ] - ], - "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": "3333aa46.5fa3ee", - "type": "json", - "z": "e8d4d920.35344", - "name": "config.json", - "property": "payload", - "action": "", - "pretty": false, - "x": 650, - "y": 80, - "wires": [ - [ - "1f2d3f3d.5eeff9", - "64b58fc8.cdc4e", - "c94db91f.7cf2b8", - "70625f12.179948" - ] - ] - }, - { - "id": "6725d70.a4aed28", - "type": "function", - "z": "e8d4d920.35344", - "name": "set global", - "func": "var value = msg.payload;\nvar key = msg.topic;\n\nglobal.set(key,value);\nreturn msg;", - "outputs": 1, - "noerr": 0, - "initialize": "", - "finalize": "", - "x": 1340, - "y": 140, - "wires": [ - [ - "6f6ad84e.d9222" - ] - ] - }, - { - "id": "9f81fc0f.814988", - "type": "rpi-gpio out", - "z": "e8d4d920.35344", - "name": "LED OUTPUT", - "pin": "40", - "set": true, - "level": "0", - "freq": "", - "out": "out", - "x": 580, - "y": 180, - "wires": [] - }, - { - "id": "60cc050b.8dae74", - "type": "ui_template", - "z": "e8d4d920.35344", - "group": "59434d8d.70ed94", - "name": "Stream Pi Camera", - "order": 1, - "width": 24, - "height": 19, - "format": "
\n \n
", - "storeOutMessages": true, - "fwdInMessages": true, - "resendOnRefresh": false, - "templateScope": "local", - "x": 970, - "y": 440, - "wires": [ - [] - ] - }, - { - "id": "1f2d3f3d.5eeff9", - "type": "subflow:81483277.2521e", - "z": "e8d4d920.35344", - "name": "", - "env": [], - "x": 970, - "y": 140, - "wires": [ - [ - "6725d70.a4aed28" - ] - ] - }, - { - "id": "24a381c3.761f56", - "type": "subflow:a0f9bde.423644", - "z": "e8d4d920.35344", - "name": "", - "env": [], - "x": 960, - "y": 360, - "wires": [ - [ - "6725d70.a4aed28" - ] - ] - }, - { - "id": "6a7bbade.f3174c", - "type": "subflow:977131e7.c2e76", - "z": "e8d4d920.35344", - "name": "", - "env": [], - "x": 960, - "y": 400, - "wires": [ - [ - "6725d70.a4aed28" - ] - ] - }, - { - "id": "64b58fc8.cdc4e", - "type": "subflow:758bc08f.c57318", - "z": "e8d4d920.35344", - "name": "", - "env": [], - "x": 980, - "y": 180, - "wires": [ - [ - "6725d70.a4aed28" - ], - [ - "6f6ad84e.d9222" - ] - ] - }, - { - "id": "c94db91f.7cf2b8", - "type": "subflow:1a447be0.198674", - "z": "e8d4d920.35344", - "name": "", - "env": [], - "x": 960, - "y": 220, - "wires": [ - [ - "6725d70.a4aed28" - ], - [ - "6f6ad84e.d9222" - ] - ] - }, - { - "id": "f1f6f8ca.a80bd", - "type": "subflow:9c3e6ad4.7471a8", - "z": "e8d4d920.35344", - "name": "RPi commands", - "env": [], - "x": 960, - "y": 820, - "wires": [] - }, - { - "id": "b8638c84.bcd58", - "type": "subflow:bee3b478.ef4b88", - "z": "e8d4d920.35344", - "name": "", - "env": [], - "x": 360, - "y": 460, - "wires": [] - }, - { - "id": "70625f12.179948", - "type": "subflow:714bd4fe.163ab4", - "z": "e8d4d920.35344", - "name": "Process metadata", - "env": [], - "x": 970, - "y": 260, - "wires": [ - [ - "6725d70.a4aed28" - ] - ] - }, - { - "id": "f56b39e5.245b4", - "type": "subflow:1bc3f9f9.1ee996", - "z": "e8d4d920.35344", - "name": "Acquisition inputs", - "env": [], - "x": 970, - "y": 580, - "wires": [ - [ - "6725d70.a4aed28" - ] - ], - "icon": "node-red-dashboard/ui_switch.png" - }, - { - "id": "590670c8.5b17c", - "type": "subflow:130e0533.4f1813", - "z": "e8d4d920.35344", - "name": "", - "env": [], - "x": 970, - "y": 620, - "wires": [] - }, - { - "id": "b902251f.c756f", - "type": "comment", - "z": "e8d4d920.35344", - "name": "Inject config.json in GUI inputs", - "info": "", - "x": 700, - "y": 40, - "wires": [] - }, - { - "id": "e824bf49.c0716", - "type": "comment", - "z": "e8d4d920.35344", - "name": "Edit config.json on changes", - "info": "", - "x": 1360, - "y": 40, - "wires": [] - }, - { - "id": "5836c9be.895de8", - "type": "subflow:21b3da63.2cef2e", - "z": "e8d4d920.35344", - "name": "", - "env": [], - "x": 960, - "y": 860, - "wires": [] - }, - { - "id": "b94ee83b.5fc548", - "type": "comment", - "z": "e8d4d920.35344", - "name": "Create and run python code receiving MQTT queries", - "info": "", - "x": 450, - "y": 380, - "wires": [] - }, - { - "id": "61f01a83.88da5c", - "type": "comment", - "z": "e8d4d920.35344", - "name": "On Load", - "info": "", - "x": 100, - "y": 200, - "wires": [] - }, - { - "id": "fa75a682.73df7", - "type": "comment", - "z": "e8d4d920.35344", - "name": "Get metadata from config.json", - "info": "", - "x": 390, - "y": 40, - "wires": [] - }, - { - "id": "5d22882.f86d2f8", - "type": "comment", - "z": "e8d4d920.35344", - "name": "White LED control", - "info": "", - "x": 350, - "y": 140, - "wires": [] - }, - { - "id": "d418fabe.d0b75", - "type": "comment", - "z": "e8d4d920.35344", - "name": "Visible on the GUI", - "info": "", - "x": 970, - "y": 40, - "wires": [] - }, - { - "id": "ac2a06c3.0eec2", - "type": "comment", - "z": "e8d4d920.35344", - "name": "RPi", - "info": "", - "x": 930, - "y": 780, - "wires": [] - }, - { - "id": "630ed3ce.35374c", - "type": "comment", - "z": "e8d4d920.35344", - "name": "Metadata", - "info": "", - "x": 940, - "y": 100, - "wires": [] - }, - { - "id": "1fc17ae3.11b69d", - "type": "comment", - "z": "e8d4d920.35344", - "name": "Actuation", - "info": "", - "x": 940, - "y": 320, - "wires": [] - }, - { - "id": "dada61e7.83ee38", - "type": "comment", - "z": "e8d4d920.35344", - "name": "Acquisition", - "info": "", - "x": 940, - "y": 540, - "wires": [] - }, - { - "id": "f44de853.0c855", - "type": "ui_switch", - "z": "e8d4d920.35344", - "name": "", - "label": "LED", - "tooltip": "", - "group": "59434d8d.70ed94", - "order": 2, - "width": 0, - "height": 0, - "passthru": true, - "decouple": "false", - "topic": "", - "style": "", - "onvalue": "true", - "onvalueType": "bool", - "onicon": "", - "oncolor": "", - "offvalue": "false", - "offvalueType": "bool", - "officon": "", - "offcolor": "", - "x": 430, - "y": 180, - "wires": [ - [ - "9f81fc0f.814988" - ] - ] - }, - { - "id": "22392d.ef1a66d4", - "type": "status", - "z": "1a447be0.198674", - "name": "GPS Status", - "scope": [ - "cb77803f.357f88" - ], - "x": 110, - "y": 560, - "wires": [ - [ - "a30fe92c.6b73e8" - ] - ] - }, - { - "id": "a30fe92c.6b73e8", - "type": "ui_text", - "z": "1a447be0.198674", - "group": "7b7849e8.363288", - "order": 3, - "width": 6, - "height": 1, - "name": "GPS Status Display", - "label": "GPS Status:", - "format": "{{msg.status.text}}", - "layout": "row-left", - "x": 600, - "y": 560, - "wires": [] - }, - { - "id": "ec0d715e.19fdd", - "type": "ui_text", - "z": "1a447be0.198674", - "group": "7b7849e8.363288", - "order": 4, - "width": 6, - "height": 1, - "name": "Latitude", - "label": "Latitude", - "format": "{{msg.payload.lat.deg}}°{{msg.payload.lat.min}}'{{msg.payload.lat.sec}}{{msg.payload.lat.dir}}", - "layout": "row-left", - "x": 640, - "y": 340, - "wires": [] - }, - { - "id": "f8c5f7ef.e93908", - "type": "ui_text", - "z": "1a447be0.198674", - "group": "7b7849e8.363288", - "order": 5, - "width": 6, - "height": 1, - "name": "Longitude", - "label": "Longitude", - "format": "{{msg.payload.lon.deg}}°{{msg.payload.lon.min}}'{{msg.payload.lon.sec}}{{msg.payload.lon.dir}}", - "layout": "row-right", - "x": 640, - "y": 380, - "wires": [] - }, - { - "id": "3f718ceb.5e9f34", - "type": "function", - "z": "1a447be0.198674", - "name": "Convert DD to DMS", - "func": "function ConvertDDToDMS(D, lng){\n // from https://stackoverflow.com/a/5786281/2108279\n return {\n dir : D<0?lng?'W':'S':lng?'E':'N',\n deg : 0|(D<0?D=-D:D),\n min : 0|D%1*60,\n sec :(0|D*60%1*6000)/100\n };\n}\n\nmsg.payload = {\n \"lat\":ConvertDDToDMS(msg.payload.lat, false),\n \"lon\":ConvertDDToDMS(msg.payload.lon, true)\n};\nreturn msg;", - "outputs": 1, - "noerr": 0, - "initialize": "", - "finalize": "", - "x": 350, - "y": 360, - "wires": [ - [ - "ec0d715e.19fdd", - "f8c5f7ef.e93908" - ] - ] - }, - { - "id": "74554b33.14ab6c", - "type": "file", - "z": "1a447be0.198674", - "d": true, - "name": "gpsd_output", - "filename": "/home/pi/gpsd.json", - "appendNewline": true, - "createDir": false, - "overwriteFile": "false", "x": 630, - "y": 240, - "wires": [ - [] - ] + "y": 560, + "wires": [] }, { - "id": "b69e435f.b93558", + "id": "fd05f252.5a90c", + "type": "mqtt out", + "z": "bccd1f23.87219", + "name": "", + "topic": "", + "qos": "", + "retain": "", + "broker": "8dc3722c.06efa8", + "x": 630, + "y": 680, + "wires": [] + }, + { + "id": "dbd6bde.99db64", "type": "function", - "z": "a0f9bde.423644", + "z": "bccd1f23.87219", "name": "round distance", "func": "// Here we change the focus_distance to 25 µm increment\nif (msg.payload%25 <= 12.5){\n msg.payload = msg.payload - msg.payload%25\n}\nelse {\n msg.payload = msg.payload + msg.payload%25\n}\nreturn msg;", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", - "x": 820, - "y": 40, + "x": 620, + "y": 440, "wires": [ [ - "f49b3397.2599f8", - "d9930546.489a58" + "3d31ee98.a7d6fa", + "69d4ea6c.4c1e2c", + "dc48dc42.98d18" ] ] }, { - "id": "2aa5b118.d75f2e", - "type": "json", - "z": "bee3b478.ef4b88", - "name": "", - "property": "payload", - "action": "obj", - "pretty": true, - "x": 210, - "y": 300, - "wires": [ - [ - "ecedbda4.fed15", - "f6fd015e.5c1fe" - ] - ] - }, - { - "id": "1dd0c3dd.60236c", - "type": "template", - "z": "bee3b478.ef4b88", - "name": "Create sentence", - "field": "payload", - "fieldType": "msg", - "format": "handlebars", - "syntax": "mustache", - "template": "The {{topic}} is {{payload.status}}", - "output": "str", - "x": 1170, - "y": 280, - "wires": [ - [ - "1403e1a4.528926" - ] - ] - }, - { - "id": "117aad13.53e11b", - "type": "change", - "z": "bee3b478.ef4b88", - "name": "Remove high-level topic", - "rules": [ - { - "t": "change", - "p": "topic", - "pt": "msg", - "from": "status/", - "fromt": "str", - "to": "", - "tot": "str" - } - ], - "action": "", - "property": "", - "from": "", - "to": "", - "reg": false, - "x": 930, - "y": 280, - "wires": [ - [ - "1dd0c3dd.60236c" - ] - ] - }, - { - "id": "8ec68b82.17e3d8", + "id": "3bd43039.bc5fb8", "type": "ui_button", - "z": "4b508eab.dccae8", - "name": "Start segmentation", - "group": "566dcd6a.03db74", - "order": 1, - "width": 16, - "height": 1, - "passthru": false, - "label": "Start segmentation", - "tooltip": "", - "color": "", - "bgcolor": "", - "icon": "", - "payload": "{\"action\":\"segment\"}", - "payloadType": "json", - "topic": "segmenter/segment", - "x": 270, - "y": 200, - "wires": [ - [ - "16f3cef4.0acac9" - ] - ] - }, - { - "id": "27be7971.b3fbce", - "type": "ui_button", - "z": "4b508eab.dccae8", - "name": "Stop segmentation", - "group": "566dcd6a.03db74", - "order": 2, - "width": 8, - "height": 1, - "passthru": true, - "label": "Stop segmentation", - "tooltip": "", - "color": "", - "bgcolor": "#AD1625", - "icon": "", - "payload": "{\"action\":\"stop\"}", - "payloadType": "json", - "topic": "segmenter/segment", - "x": 270, - "y": 320, - "wires": [ - [ - "16f3cef4.0acac9" - ] - ] - }, - { - "id": "16f3cef4.0acac9", - "type": "mqtt out", - "z": "4b508eab.dccae8", + "z": "bccd1f23.87219", "name": "", - "topic": "", - "qos": "", - "retain": "", - "broker": "8dc3722c.06efa8", - "x": 610, - "y": 260, - "wires": [] - }, - { - "id": "f8eade62.0eb118", - "type": "subflow:4b508eab.dccae8", - "z": "e8d4d920.35344", - "name": "", - "env": [], - "x": 970, - "y": 720, - "wires": [] - }, - { - "id": "30fc0aaa.8fdd96", - "type": "comment", - "z": "e8d4d920.35344", - "name": "Segmentation", - "info": "", - "x": 950, - "y": 680, - "wires": [] - }, - { - "id": "16aa0238.209276", - "type": "ui_slider", - "z": "674362b7.9b6574", - "name": "Iso slider", - "label": "ISO", - "tooltip": "Possible values are 100, 200, 320, 400, 500, 640, 800. 500 by default.", - "group": "e8b67968.dea6", - "order": 1, - "width": 0, - "height": 0, - "passthru": true, - "outs": "end", - "topic": "imager/image", - "min": "100", - "max": "800", - "step": "20", - "x": 300, - "y": 100, - "wires": [ - [ - "bb090334.1e21a8" - ] - ] - }, - { - "id": "bb090334.1e21a8", - "type": "function", - "z": "674362b7.9b6574", - "name": "round iso", - "func": "// Iso should be one of 60, 100, 200, 320, 400, 500, 640, 800\n\nif (msg.payload <= 80){\n msg.payload = 60;\n return msg;\n}\n\nif (msg.payload <= 150){\n msg.payload = 100;\n return msg;\n}\n\nif (msg.payload <= 260){\n msg.payload = 200;\n return msg;\n}\n\nif (msg.payload <= 360){\n msg.payload = 320;\n return msg;\n}\n\nif (msg.payload <= 450){\n msg.payload = 400;\n return msg;\n}\n\nif (msg.payload <= 565){\n msg.payload = 500;\n return msg;\n}\n\nif (msg.payload <= 700){\n msg.payload = 640;\n return msg;\n}\n\n\nif (700 < msg.payload){\n msg.payload = 800;\n return msg;\n}\n", - "outputs": 1, - "noerr": 0, - "initialize": "", - "finalize": "", - "x": 460, - "y": 100, - "wires": [ - [ - "16aa0238.209276", - "8ea9dc9a.c7d87" - ] - ] - }, - { - "id": "8ea9dc9a.c7d87", - "type": "function", - "z": "674362b7.9b6574", - "name": "Encapsulate settings", - "func": "msg.payload = {\n \"action\":\"settings\", \n \"settings\":{\"iso\":msg.payload}\n}\nmsg.topic = \"imager/image\"\nreturn msg;", - "outputs": 1, - "noerr": 0, - "initialize": "", - "finalize": "", - "x": 660, - "y": 100, - "wires": [ - [ - "845e06e1.0d812" - ] - ] - }, - { - "id": "5765a825.a595c8", - "type": "ui_slider", - "z": "674362b7.9b6574", - "name": "Shutter speed slider", - "label": "Shutter Speed", - "tooltip": "In microseconds, up to 2500µs, 10µs by default", - "group": "e8b67968.dea6", + "group": "fbd92986.1028c8", "order": 2, "width": 0, "height": 0, - "passthru": true, - "outs": "end", - "topic": "imager/image", - "min": "10", - "max": "2500", - "step": "10", - "x": 340, - "y": 220, - "wires": [ - [ - "c38509b.fb08af8" - ] - ] - }, - { - "id": "c38509b.fb08af8", - "type": "function", - "z": "674362b7.9b6574", - "name": "Encapsulate settings", - "func": "msg.payload = {\n \"action\":\"settings\", \n \"settings\":{\"shutter_speed\":msg.payload}\n}\nmsg.topic = \"imager/image\"\nreturn msg;", - "outputs": 1, - "noerr": 0, - "initialize": "", - "finalize": "", - "x": 660, - "y": 220, - "wires": [ - [ - "845e06e1.0d812" - ] - ] - }, - { - "id": "845e06e1.0d812", - "type": "mqtt out", - "z": "674362b7.9b6574", - "name": "", - "topic": "", - "qos": "", - "retain": "", - "broker": "8dc3722c.06efa8", - "x": 950, - "y": 160, - "wires": [] - }, - { - "id": "2350e507.d4e302", - "type": "inject", - "z": "674362b7.9b6574", - "name": "", - "props": [ - { - "p": "payload" - } - ], - "repeat": "", - "crontab": "", - "once": true, - "onceDelay": "1", - "topic": "", - "payload": "10", - "payloadType": "num", - "x": 110, - "y": 220, - "wires": [ - [ - "5765a825.a595c8" - ] - ] - }, - { - "id": "2edd922b.a471a6", - "type": "inject", - "z": "674362b7.9b6574", - "name": "", - "props": [ - { - "p": "payload" - } - ], - "repeat": "", - "crontab": "", - "once": true, - "onceDelay": "1", - "topic": "", - "payload": "500", - "payloadType": "num", - "x": 110, - "y": 100, - "wires": [ - [ - "16aa0238.209276" - ] - ] - }, - { - "id": "649552a6.bf68fc", - "type": "subflow:674362b7.9b6574", - "z": "e8d4d920.35344", - "name": "", - "env": [], - "x": 960, - "y": 480, - "wires": [] - }, - { - "id": "bb62da8a.ebc328", - "type": "ui_switch", - "z": "130e0533.4f1813", - "name": "", - "label": "Pump FORWARD/BACKWARD", - "tooltip": "", - "group": "75a5ce1f.728d", - "order": 3, - "width": 0, - "height": 0, - "passthru": true, - "decouple": "false", - "topic": "", - "style": "", - "onvalue": "FORWARD", - "onvalueType": "str", - "onicon": "", - "oncolor": "", - "offvalue": "BACKWARD", - "offvalueType": "str", - "officon": "", - "offcolor": "", - "x": 150, - "y": 180, - "wires": [ - [] - ] - }, - { - "id": "743041f8.d2b9b", - "type": "inject", - "z": "e8d4d920.35344", - "name": "OFF", - "props": [ - { - "p": "payload" - } - ], - "repeat": "", - "crontab": "", - "once": true, - "onceDelay": 0.1, - "topic": "", - "payload": "false", - "payloadType": "bool", - "x": 310, - "y": 180, - "wires": [ - [ - "f44de853.0c855" - ] - ] - }, - { - "id": "f6fd015e.5c1fe", - "type": "debug", - "z": "bee3b478.ef4b88", - "d": true, - "name": "segmenter area", - "active": true, - "tosidebar": true, - "console": false, - "tostatus": false, - "complete": "payload", - "targetType": "msg", - "statusVal": "", - "statusType": "auto", - "x": 640, - "y": 620, - "wires": [] - }, - { - "id": "9998aa86.74bb", - "type": "exec", - "z": "d95291dc.83b0b8", - "command": "python3 /home/pi/PlanktonScope/scripts/main.py", - "addpay": false, - "append": "", - "useSpawn": "true", - "timer": "", - "oldrc": false, - "name": "", - "x": 830, - "y": 140, - "wires": [ - [], - [], - [ - "de4ba211.e1d3f" - ] - ] - }, - { - "id": "35ded403.3d7244", - "type": "template", - "z": "d95291dc.83b0b8", - "name": "main.py", - "field": "payload", - "fieldType": "msg", - "format": "python", - "syntax": "plain", - "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(\"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 #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 = ('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\", 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": 760, - "y": 340, - "wires": [ - [] - ] - }, - { - "id": "672d89a8.4e6968", - "type": "exec", - "z": "d95291dc.83b0b8", - "command": "sudo killall -9 python3", - "addpay": true, - "append": "", - "useSpawn": "false", - "timer": "", - "oldrc": false, - "name": "Hard kill", - "x": 1280, - "y": 100, - "wires": [ - [], - [], - [] - ] - }, - { - "id": "172d187b.ad216", - "type": "subflow:d95291dc.83b0b8", - "z": "e8d4d920.35344", - "name": "", - "env": [], - "x": 340, - "y": 420, - "wires": [] - }, - { - "id": "afa9f4b.2e77988", - "type": "delay", - "z": "d95291dc.83b0b8", - "name": "", - "pauseType": "delay", - "timeout": "5", - "timeoutUnits": "seconds", - "rate": "1", - "nbRateUnits": "1", - "rateUnits": "second", - "randomFirst": "1", - "randomLast": "5", - "randomUnits": "seconds", - "drop": false, - "x": 420, - "y": 140, - "wires": [ - [ - "9998aa86.74bb" - ] - ] - }, - { - "id": "1df370a8.6c70ff", - "type": "ui_button", - "z": "d95291dc.83b0b8", - "name": "Restart Python", - "group": "adcd0ef7.81a7f8", - "order": 1, - "width": 0, - "height": 0, - "passthru": false, - "label": "Restart Python", - "tooltip": "", - "color": "", - "bgcolor": "#AD1625", - "icon": "", - "payload": "", - "payloadType": "str", - "topic": "", - "x": 100, - "y": 140, - "wires": [ - [ - "afa9f4b.2e77988", - "39edf8d2.bc92e8" - ] - ] - }, - { - "id": "39edf8d2.bc92e8", - "type": "function", - "z": "d95291dc.83b0b8", - "name": "", - "func": "msg.kill = \"SIGTERM\";\nreturn msg;", - "outputs": 1, - "noerr": 0, - "initialize": "", - "finalize": "", - "x": 420, - "y": 200, - "wires": [ - [ - "9998aa86.74bb", - "de4ba211.e1d3f", - "a776b9fc.d542e8" - ] - ] - }, - { - "id": "de4ba211.e1d3f", - "type": "debug", - "z": "d95291dc.83b0b8", - "name": "output", - "active": true, - "tosidebar": true, - "console": false, - "tostatus": false, - "complete": "payload", - "targetType": "msg", - "statusVal": "", - "statusType": "auto", - "x": 1270, - "y": 200, - "wires": [] - }, - { - "id": "7aa2e737.e16d98", - "type": "status", - "z": "d95291dc.83b0b8", - "name": "", - "scope": [ - "9998aa86.74bb" - ], - "x": 960, - "y": 260, - "wires": [ - [ - "439b952c.3e9cf4" - ] - ] - }, - { - "id": "439b952c.3e9cf4", - "type": "debug", - "z": "d95291dc.83b0b8", - "name": "status", - "active": true, - "tosidebar": true, - "console": false, - "tostatus": false, - "complete": "status", - "targetType": "msg", - "statusVal": "", - "statusType": "auto", - "x": 1270, - "y": 260, - "wires": [] - }, - { - "id": "631688df.6f74c", - "type": "ui_switch", - "z": "1a447be0.198674", - "name": "", - "label": "Manual input", - "tooltip": "", - "group": "7b7849e8.363288", - "order": 2, - "width": 4, - "height": 1, - "passthru": true, - "decouple": "false", - "topic": "", - "style": "", - "onvalue": "true", - "onvalueType": "bool", - "onicon": "", - "oncolor": "", - "offvalue": "false", - "offvalueType": "bool", - "officon": "", - "offcolor": "", - "x": 110, - "y": 460, - "wires": [ - [ - "c05c94eb.25471" - ] - ] - }, - { - "id": "c05c94eb.25471", - "type": "function", - "z": "1a447be0.198674", - "name": "Enable Invert", - "func": "msg.enabled = !msg.payload;\nmsg.payload = \"\"\nreturn msg;", - "outputs": 1, - "noerr": 0, - "initialize": "", - "finalize": "", - "x": 320, - "y": 460, - "wires": [ - [ - "ec0d715e.19fdd", - "1b5cd285.71fa15", - "f8c5f7ef.e93908" - ] - ] - }, - { - "id": "6d0acc39.1d2e9c", - "type": "ui_text_input", - "z": "1a447be0.198674", - "name": "Lat Manual", - "label": "Latitude", - "tooltip": "", - "group": "7b7849e8.363288", - "order": 8, - "width": 12, - "height": 1, - "passthru": false, - "mode": "text", - "delay": "2000", - "topic": "latitude", - "x": 650, - "y": 460, - "wires": [ - [] - ] - }, - { - "id": "1b5cd285.71fa15", - "type": "change", - "z": "1a447be0.198674", - "name": "invert", - "rules": [ - { - "t": "set", - "p": "enabled", - "pt": "msg", - "to": "$not(msg.enabled)", - "tot": "jsonata" - } - ], - "action": "", - "property": "", - "from": "", - "to": "", - "reg": false, - "x": 490, - "y": 480, - "wires": [ - [ - "6d0acc39.1d2e9c", - "8c2f9e2.0f3cd6" - ] - ] - }, - { - "id": "8c2f9e2.0f3cd6", - "type": "ui_text_input", - "z": "1a447be0.198674", - "name": "Lon Manual", - "label": "Longitude", - "tooltip": "", - "group": "7b7849e8.363288", - "order": 7, - "width": 12, - "height": 1, - "passthru": false, - "mode": "text", - "delay": "2000", - "topic": "longitude", - "x": 650, - "y": 500, - "wires": [ - [] - ] - }, - { - "id": "34a51d85.680172", - "type": "inject", - "z": "1a447be0.198674", - "name": "", - "props": [ - { - "p": "payload" - } - ], - "repeat": "", - "crontab": "", - "once": true, - "onceDelay": 0.1, - "topic": "", - "payload": "false", - "payloadType": "bool", - "x": 130, - "y": 420, - "wires": [ - [ - "c05c94eb.25471", - "60308f41.f3b54" - ] - ] - }, - { - "id": "52ea7d01.711034", - "type": "function", - "z": "130e0533.4f1813", - "name": "Encapsulate config", - "func": "msg.payload = {\n \"action\":\"update_config\", \n \"config\":{\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 \"acq_camera_name\":\"Pi Camera V2.1 - 8MP\",\n \"acq_nb_frame\":global.get(\"custom_nb_frame\"),\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 \"process_pixel\":global.get(\"process_pixel\"),\n \"process_id\":global.get(\"process_id\")\n }\n};\nreturn msg;", - "outputs": 1, - "noerr": 0, - "initialize": "", - "finalize": "", - "x": 430, - "y": 60, - "wires": [ - [ - "c3e50240.82aa58" - ] - ] - }, - { - "id": "40c12463.a1f84c", - "type": "delay", - "z": "130e0533.4f1813", - "name": "", - "pauseType": "delay", - "timeout": "1", - "timeoutUnits": "seconds", - "rate": "1", - "nbRateUnits": "1", - "rateUnits": "second", - "randomFirst": "1", - "randomLast": "5", - "randomUnits": "seconds", - "drop": false, - "x": 400, - "y": 100, - "wires": [ - [ - "c9f510c0.7d1328" - ] - ] - }, - { - "id": "4d1b02cb.83b51c", - "type": "ui_button", - "z": "130e0533.4f1813", - "name": "", - "group": "4361c3b6.e2b7a4", - "order": 10, - "width": 0, - "height": 0, - "passthru": false, - "label": "Update config", - "tooltip": "", - "color": "", - "bgcolor": "", - "icon": "", - "payload": "", - "payloadType": "str", - "topic": "imager/image", - "x": 200, - "y": 60, - "wires": [ - [ - "52ea7d01.711034" - ] - ] - }, - { - "id": "5a159d39.3bdca4", - "type": "ui_text", - "z": "bee3b478.ef4b88", - "group": "91acd434.6205", - "order": 3, - "width": 6, - "height": 1, - "name": "imager", - "label": "Imager status:", - "format": "{{msg.payload.status}}", - "layout": "col-center", - "x": 870, - "y": 200, - "wires": [] - }, - { - "id": "89058790.909e7", - "type": "ui_text", - "z": "bee3b478.ef4b88", - "group": "91acd434.6205", - "order": 4, - "width": 6, - "height": 1, - "name": "segmenter", - "label": "Segmenter status:", - "format": "{{msg.payload.status}}", - "layout": "col-center", - "x": 890, - "y": 420, - "wires": [] - }, - { - "id": "dc72e121.0aacd", - "type": "ui_text", - "z": "bee3b478.ef4b88", - "group": "91acd434.6205", - "order": 1, - "width": 6, - "height": 1, - "name": "focus", - "label": "Focus status:", - "format": "{{msg.payload.status}}", - "layout": "col-center", - "x": 870, - "y": 160, - "wires": [] - }, - { - "id": "d700c8a1.2d1f48", - "type": "ui_text", - "z": "bee3b478.ef4b88", - "group": "91acd434.6205", - "order": 2, - "width": 6, - "height": 1, - "name": "pump", - "label": "Pump status:", - "format": "{{msg.payload.status}}", - "layout": "col-center", - "x": 870, - "y": 120, - "wires": [] - }, - { - "id": "d95c87fe.e4ccd", - "type": "ui_button", - "z": "a0f9bde.423644", - "name": "", - "group": "de7c8e82.7faa98", - "order": 1, - "width": 3, - "height": 1, "passthru": false, "label": "UP 1mm", "tooltip": "", @@ -4896,23 +3968,23 @@ "payload": "{\"action\":\"move\",\"direction\":\"UP\",\"distance\":1}", "payloadType": "json", "topic": "actuator/focus", - "x": 280, - "y": 200, + "x": 180, + "y": 520, "wires": [ [ - "a8dfcfd1.c5863" + "62030521.88317c" ] ] }, { - "id": "1be18c84.59a4ab", + "id": "c0663029.2d03b", "type": "ui_button", - "z": "a0f9bde.423644", + "z": "bccd1f23.87219", "name": "", - "group": "de7c8e82.7faa98", - "order": 5, - "width": 3, - "height": 1, + "group": "fbd92986.1028c8", + "order": 6, + "width": 0, + "height": 0, "passthru": false, "label": "DOWN 1mm", "tooltip": "", @@ -4922,325 +3994,43 @@ "payload": "{\"action\":\"move\",\"direction\":\"DOWN\",\"distance\":1}", "payloadType": "json", "topic": "actuator/focus", - "x": 270, - "y": 240, + "x": 170, + "y": 560, "wires": [ [ - "a8dfcfd1.c5863" + "62030521.88317c" ] ] }, { - "id": "d9930546.489a58", + "id": "69d4ea6c.4c1e2c", "type": "ui_slider", - "z": "a0f9bde.423644", + "z": "bccd1f23.87219", "name": "focus_distance", "label": "", "tooltip": "in µm", - "group": "de7c8e82.7faa98", + "group": "fbd92986.1028c8", "order": 3, - "width": 8, - "height": 1, + "width": 0, + "height": 0, "passthru": true, "outs": "end", "topic": "focus_distance", "min": "25", "max": "2000", "step": "25", - "x": 540, - "y": 120, + "x": 400, + "y": 500, "wires": [ [ - "f49b3397.2599f8" + "3d31ee98.a7d6fa" ] ] }, { - "id": "4a30a6af.fa662", - "type": "ui_switch", - "z": "1a447be0.198674", - "d": true, - "name": "Worldmap", - "label": "Display worldmap", - "tooltip": "", - "group": "7b7849e8.363288", - "order": 6, - "width": 2, - "height": 1, - "passthru": true, - "decouple": "false", - "topic": "", - "style": "", - "onvalue": "true", - "onvalueType": "bool", - "onicon": "", - "oncolor": "", - "offvalue": "false", - "offvalueType": "bool", - "officon": "", - "offcolor": "", - "x": 290, - "y": 260, - "wires": [ - [ - "60308f41.f3b54" - ] - ] - }, - { - "id": "60308f41.f3b54", - "type": "function", - "z": "1a447be0.198674", - "d": true, - "name": "Enable", - "func": "msg.enabled = msg.payload;\nmsg.payload = \"\"\n\nreturn msg;", - "outputs": 1, - "noerr": 0, - "initialize": "", - "finalize": "", - "x": 440, - "y": 260, - "wires": [ - [ - "f7ae988c.184598" - ] - ] - }, - { - "id": "35ea3cf0.a398ac", - "type": "exec", - "z": "d95291dc.83b0b8", - "command": "sudo killall -15 python3", - "addpay": true, - "append": "", - "useSpawn": "false", - "timer": "", - "oldrc": false, - "name": "Soft kill", - "x": 1280, - "y": 40, - "wires": [ - [], - [], - [] - ] - }, - { - "id": "a776b9fc.d542e8", - "type": "delay", - "z": "d95291dc.83b0b8", - "d": true, - "name": "", - "pauseType": "delay", - "timeout": "4", - "timeoutUnits": "seconds", - "rate": "1", - "nbRateUnits": "1", - "rateUnits": "second", - "randomFirst": "1", - "randomLast": "5", - "randomUnits": "seconds", - "drop": false, - "x": 700, - "y": 100, - "wires": [ - [ - "672d89a8.4e6968" - ] - ] - }, - { - "id": "e2913641.ea203", - "type": "ui_text", - "z": "bee3b478.ef4b88", - "group": "6d1af0ab.7b4a18", - "order": 2, - "width": 3, - "height": 2, - "name": "img_count", - "label": "Images count", - "format": "{{msg.payload}}", - "layout": "col-center", - "x": 1370, - "y": 360, - "wires": [] - }, - { - "id": "b3f6e410.547fc", - "type": "ui_text", - "z": "bee3b478.ef4b88", - "group": "6d1af0ab.7b4a18", - "order": 4, - "width": 3, - "height": 2, - "name": "obj_count", - "label": "Objects count", - "format": "{{msg.payload}}", - "layout": "col-center", - "x": 1360, - "y": 460, - "wires": [] - }, - { - "id": "81c0a465.c4f0b", + "id": "71f55a58.d7eaf4", "type": "inject", - "z": "bee3b478.ef4b88", - "name": "Init graphs", - "props": [ - { - "p": "payload" - }, - { - "p": "topic", - "vt": "str" - } - ], - "repeat": "", - "crontab": "", - "once": true, - "onceDelay": 0.1, - "topic": "", - "payload": "0", - "payloadType": "num", - "x": 590, - "y": 700, - "wires": [ - [ - "cbcf66e1.7b1588", - "d3a02ef1.d473b" - ] - ] - }, - { - "id": "cbcf66e1.7b1588", - "type": "function", - "z": "bee3b478.ef4b88", - "name": "obj_counter init", - "func": "obj_counter=0\nglobal.set('obj_counter',obj_counter)\nmsg.payload = obj_counter\nreturn msg;", - "outputs": 1, - "noerr": 0, - "initialize": "", - "finalize": "", - "x": 900, - "y": 640, - "wires": [ - [ - "b3f6e410.547fc" - ] - ] - }, - { - "id": "d3a02ef1.d473b", - "type": "function", - "z": "bee3b478.ef4b88", - "name": "img_counter init", - "func": "img_counter=0\nglobal.set('img_counter',img_counter)\nmsg.payload = img_counter\nreturn msg;", - "outputs": 1, - "noerr": 0, - "initialize": "", - "finalize": "", - "x": 900, - "y": 600, - "wires": [ - [ - "e2913641.ea203" - ] - ] - }, - { - "id": "c31360e5.5d804", - "type": "rpi-gpio out", - "z": "e8d4d920.35344", - "name": "Pump Enable", - "pin": "7", - "set": true, - "level": "1", - "freq": "", - "out": "out", - "x": 330, - "y": 280, - "wires": [] - }, - { - "id": "cdf769fd.a196", - "type": "rpi-gpio out", - "z": "e8d4d920.35344", - "name": "Focus Enable", - "pin": "32", - "set": true, - "level": "1", - "freq": "", - "out": "out", - "x": 340, - "y": 320, - "wires": [] - }, - { - "id": "7ed84a57.18378c", - "type": "comment", - "z": "e8d4d920.35344", - "name": "Initialize Waveshare HAT", - "info": "********", - "x": 370, - "y": 240, - "wires": [] - }, - { - "id": "4828d2f4.7c712c", - "type": "function", - "z": "e8d4d920.35344", - "name": "set global", - "func": "var value = msg.payload;\nvar key = msg.topic;\n\nglobal.set(key,value);\nreturn msg;", - "outputs": 1, - "noerr": 0, - "initialize": "", - "finalize": "", - "x": 540, - "y": 540, - "wires": [ - [] - ] - }, - { - "id": "452af41c.43940c", - "type": "python3-function", - "z": "e8d4d920.35344", - "name": "Get MachineName", - "func": "import sys\nsys.path.append('/home/pi/PlanktonScope/scripts')\nimport planktoscope.uuidName\n\nmsg['payload'] = planktoscope.uuidName.machineName(machine=planktoscope.uuidName.getSerial())\nmsg['topic'] = \"MachineName\"\nreturn msg", - "outputs": 1, - "x": 350, - "y": 540, - "wires": [ - [ - "4828d2f4.7c712c", - "c2abdf2b.f0a3e" - ] - ] - }, - { - "id": "c2abdf2b.f0a3e", - "type": "ui_template", - "z": "e8d4d920.35344", - "group": "411742cf.3abb8c", - "name": "Machine Name", - "order": 1, - "width": 0, - "height": 0, - "format": "
", - "storeOutMessages": true, - "fwdInMessages": true, - "resendOnRefresh": true, - "templateScope": "local", - "x": 560, - "y": 600, - "wires": [ - [] - ] - }, - { - "id": "fa22d6d5.f8a15", - "type": "inject", - "z": "a0f9bde.423644", + "z": "bccd1f23.87219", "name": "Default: 500µm", "props": [ { @@ -5254,20 +4044,258 @@ "topic": "", "payload": "500", "payloadType": "num", - "x": 220, - "y": 40, + "x": 120, + "y": 440, "wires": [ [ - "f49b3397.2599f8", - "d9930546.489a58" + "3d31ee98.a7d6fa", + "69d4ea6c.4c1e2c" ] ] }, { - "id": "a87e400c.aaf68", + "id": "9a1d0e7c.2d5a1", "type": "inject", - "z": "977131e7.c2e76", - "name": "Default: 2ml/min", + "z": "bccd1f23.87219", + "name": "Default: OFF", + "props": [ + { + "p": "payload" + } + ], + "repeat": "", + "crontab": "", + "once": true, + "onceDelay": 0.1, + "topic": "", + "payload": "false", + "payloadType": "bool", + "x": 110, + "y": 40, + "wires": [ + [ + "961d27e7.da65c8" + ] + ] + }, + { + "id": "16aa0238.209276", + "type": "ui_slider", + "z": "bccd1f23.87219", + "name": "Iso slider", + "label": "ISO", + "tooltip": "Possible values are 100, 200, 320, 400, 500, 640, 800. 500 by default.", + "group": "4248342d.e55fac", + "order": 10, + "width": 0, + "height": 0, + "passthru": true, + "outs": "end", + "topic": "imager/image", + "min": "100", + "max": "800", + "step": "20", + "x": 360, + "y": 820, + "wires": [ + [ + "bb090334.1e21a8" + ] + ] + }, + { + "id": "bb090334.1e21a8", + "type": "function", + "z": "bccd1f23.87219", + "name": "round iso", + "func": "// Iso should be one of 60, 100, 200, 320, 400, 500, 640, 800\n\nif (msg.payload <= 80){\n msg.payload = 60;\n return msg;\n}\n\nif (msg.payload <= 150){\n msg.payload = 100;\n return msg;\n}\n\nif (msg.payload <= 260){\n msg.payload = 200;\n return msg;\n}\n\nif (msg.payload <= 360){\n msg.payload = 320;\n return msg;\n}\n\nif (msg.payload <= 450){\n msg.payload = 400;\n return msg;\n}\n\nif (msg.payload <= 565){\n msg.payload = 500;\n return msg;\n}\n\nif (msg.payload <= 700){\n msg.payload = 640;\n return msg;\n}\n\n\nif (700 < msg.payload){\n msg.payload = 800;\n return msg;\n}\n", + "outputs": 1, + "noerr": 0, + "initialize": "", + "finalize": "", + "x": 520, + "y": 820, + "wires": [ + [ + "16aa0238.209276", + "8ea9dc9a.c7d87" + ] + ] + }, + { + "id": "8ea9dc9a.c7d87", + "type": "function", + "z": "bccd1f23.87219", + "name": "Encapsulate settings", + "func": "msg.payload = {\n \"action\":\"settings\", \n \"settings\":{\"iso\":msg.payload}\n}\nmsg.topic = \"imager/image\"\nreturn msg;", + "outputs": 1, + "noerr": 0, + "initialize": "", + "finalize": "", + "x": 720, + "y": 820, + "wires": [ + [ + "845e06e1.0d812" + ] + ] + }, + { + "id": "5765a825.a595c8", + "type": "ui_slider", + "z": "bccd1f23.87219", + "name": "Shutter speed slider", + "label": "Shutter Speed", + "tooltip": "In microseconds, up to 2500µs, 10µs by default", + "group": "4248342d.e55fac", + "order": 9, + "width": 0, + "height": 0, + "passthru": true, + "outs": "end", + "topic": "imager/image", + "min": "10", + "max": "2500", + "step": "10", + "x": 390, + "y": 880, + "wires": [ + [ + "c38509b.fb08af8" + ] + ] + }, + { + "id": "c38509b.fb08af8", + "type": "function", + "z": "bccd1f23.87219", + "name": "Encapsulate settings", + "func": "msg.payload = {\n \"action\":\"settings\", \n \"settings\":{\"shutter_speed\":msg.payload}\n}\nmsg.topic = \"imager/image\"\nreturn msg;", + "outputs": 1, + "noerr": 0, + "initialize": "", + "finalize": "", + "x": 720, + "y": 880, + "wires": [ + [ + "845e06e1.0d812" + ] + ] + }, + { + "id": "845e06e1.0d812", + "type": "mqtt out", + "z": "bccd1f23.87219", + "name": "", + "topic": "", + "qos": "", + "retain": "", + "broker": "8dc3722c.06efa8", + "x": 930, + "y": 840, + "wires": [] + }, + { + "id": "2350e507.d4e302", + "type": "inject", + "z": "bccd1f23.87219", + "name": "Default: 10µs", + "props": [ + { + "p": "payload" + } + ], + "repeat": "", + "crontab": "", + "once": true, + "onceDelay": "1", + "topic": "", + "payload": "10", + "payloadType": "num", + "x": 110, + "y": 880, + "wires": [ + [ + "5765a825.a595c8" + ] + ] + }, + { + "id": "2edd922b.a471a6", + "type": "inject", + "z": "bccd1f23.87219", + "name": "Default: ISO 100", + "props": [ + { + "p": "payload" + } + ], + "repeat": "", + "crontab": "", + "once": true, + "onceDelay": "1", + "topic": "", + "payload": "100", + "payloadType": "num", + "x": 120, + "y": 820, + "wires": [ + [ + "16aa0238.209276" + ] + ] + }, + { + "id": "96ff24f0.955f", + "type": "ui_template", + "z": "bccd1f23.87219", + "group": "4248342d.e55fac", + "name": "Camera Settings", + "order": 8, + "width": 0, + "height": 0, + "format": "
\nCamera Settings\n
", + "storeOutMessages": true, + "fwdInMessages": true, + "resendOnRefresh": false, + "templateScope": "local", + "x": 360, + "y": 780, + "wires": [ + [] + ] + }, + { + "id": "f782a471.447748", + "type": "inject", + "z": "bccd1f23.87219", + "name": "Default: 5mL/min", + "props": [ + { + "p": "payload" + } + ], + "repeat": "", + "crontab": "", + "once": true, + "onceDelay": 0.1, + "topic": "", + "payload": "5", + "payloadType": "num", + "x": 130, + "y": 300, + "wires": [ + [ + "34c81624.df1cea" + ] + ] + }, + { + "id": "73b8252a.5ca754", + "type": "inject", + "z": "bccd1f23.87219", + "name": "Default: 2mL", "props": [ { "p": "payload" @@ -5280,22 +4308,923 @@ "topic": "", "payload": "2", "payloadType": "num", - "x": 180, - "y": 40, + "x": 110, + "y": 340, "wires": [ [ - "b8bf2a9.be099d8" + "68962547.34a67c" ] ] }, { - "id": "98e6d756.7dab38", + "id": "8ec68b82.17e3d8", + "type": "ui_button", + "z": "cb95299c.2817c8", + "name": "Start segmentation", + "group": "abeb6dad.635a2", + "order": 1, + "width": 6, + "height": 1, + "passthru": false, + "label": "Start segmentation", + "tooltip": "", + "color": "", + "bgcolor": "", + "icon": "", + "payload": "{\"action\":\"segment\"}", + "payloadType": "json", + "topic": "segmenter/segment", + "x": 370, + "y": 260, + "wires": [ + [ + "16f3cef4.0acac9" + ] + ] + }, + { + "id": "27be7971.b3fbce", + "type": "ui_button", + "z": "cb95299c.2817c8", + "name": "Stop segmentation", + "group": "abeb6dad.635a2", + "order": 2, + "width": 6, + "height": 1, + "passthru": true, + "label": "Stop segmentation", + "tooltip": "", + "color": "", + "bgcolor": "#AD1625", + "icon": "", + "payload": "{\"action\":\"stop\"}", + "payloadType": "json", + "topic": "segmenter/segment", + "x": 370, + "y": 380, + "wires": [ + [ + "16f3cef4.0acac9" + ] + ] + }, + { + "id": "16f3cef4.0acac9", + "type": "mqtt out", + "z": "cb95299c.2817c8", + "name": "", + "topic": "", + "qos": "", + "retain": "", + "broker": "8dc3722c.06efa8", + "x": 710, + "y": 320, + "wires": [] + }, + { + "id": "6b61b50c.7456d4", + "type": "ui_button", + "z": "1371dec5.76e671", + "name": "Update", + "group": "1be83144.4fe4bf", + "order": 3, + "width": 6, + "height": 1, + "passthru": false, + "label": "Update", + "tooltip": "", + "color": "", + "bgcolor": "", + "icon": "system_update", + "payload": "", + "payloadType": "str", + "topic": "update", + "x": 100, + "y": 520, + "wires": [ + [ + "386ce65d.a15d52" + ] + ] + }, + { + "id": "386ce65d.a15d52", + "type": "exec", + "z": "1371dec5.76e671", + "command": "git", + "addpay": false, + "append": "stash", + "useSpawn": "false", + "timer": "2", + "oldrc": false, + "name": "git stash", + "x": 260, + "y": 520, + "wires": [ + [ + "c3f72169.9d2b8" + ], + [], + [] + ] + }, + { + "id": "c3f72169.9d2b8", + "type": "exec", + "z": "1371dec5.76e671", + "command": "git", + "addpay": false, + "append": "pull", + "useSpawn": "false", + "timer": "2", + "oldrc": false, + "name": "git pull", + "x": 430, + "y": 520, + "wires": [ + [], + [], + [] + ] + }, + { + "id": "9998aa86.74bb", + "type": "exec", + "z": "1371dec5.76e671", + "command": "python3 /home/pi/PlanktonScope/scripts/main.py", + "addpay": false, + "append": "", + "useSpawn": "true", + "timer": "", + "oldrc": false, + "name": "", + "x": 860, + "y": 940, + "wires": [ + [], + [], + [ + "de4ba211.e1d3f" + ] + ] + }, + { + "id": "672d89a8.4e6968", + "type": "exec", + "z": "1371dec5.76e671", + "d": true, + "command": "sudo killall -9 python3", + "addpay": true, + "append": "", + "useSpawn": "false", + "timer": "", + "oldrc": false, + "name": "Hard kill", + "x": 980, + "y": 1020, + "wires": [ + [], + [], + [] + ] + }, + { + "id": "afa9f4b.2e77988", + "type": "delay", + "z": "1371dec5.76e671", + "name": "", + "pauseType": "delay", + "timeout": "5", + "timeoutUnits": "seconds", + "rate": "1", + "nbRateUnits": "1", + "rateUnits": "second", + "randomFirst": "1", + "randomLast": "5", + "randomUnits": "seconds", + "drop": false, + "x": 460, + "y": 940, + "wires": [ + [ + "9998aa86.74bb" + ] + ] + }, + { + "id": "1df370a8.6c70ff", + "type": "ui_button", + "z": "1371dec5.76e671", + "name": "Restart Python", + "group": "1be83144.4fe4bf", + "order": 6, + "width": 6, + "height": 1, + "passthru": false, + "label": "Restart Python", + "tooltip": "", + "color": "", + "bgcolor": "#AD1625", + "icon": "refresh", + "payload": "", + "payloadType": "str", + "topic": "", + "x": 100, + "y": 940, + "wires": [ + [ + "afa9f4b.2e77988", + "39edf8d2.bc92e8", + "3829adc.ccc87d2" + ] + ] + }, + { + "id": "39edf8d2.bc92e8", + "type": "function", + "z": "1371dec5.76e671", + "name": "SIGTERM", + "func": "msg.kill = \"SIGTERM\";\nreturn msg;", + "outputs": 1, + "noerr": 0, + "initialize": "", + "finalize": "", + "x": 470, + "y": 900, + "wires": [ + [ + "9998aa86.74bb", + "de4ba211.e1d3f", + "a776b9fc.d542e8" + ] + ] + }, + { + "id": "de4ba211.e1d3f", + "type": "debug", + "z": "1371dec5.76e671", + "name": "output", + "active": true, + "tosidebar": true, + "console": false, + "tostatus": false, + "complete": "payload", + "targetType": "msg", + "statusVal": "", + "statusType": "auto", + "x": 1210, + "y": 900, + "wires": [] + }, + { + "id": "7aa2e737.e16d98", + "type": "status", + "z": "1371dec5.76e671", + "name": "", + "scope": [ + "9998aa86.74bb" + ], + "x": 980, + "y": 1080, + "wires": [ + [ + "439b952c.3e9cf4" + ] + ] + }, + { + "id": "439b952c.3e9cf4", + "type": "debug", + "z": "1371dec5.76e671", + "name": "status", + "active": true, + "tosidebar": true, + "console": false, + "tostatus": false, + "complete": "status", + "targetType": "msg", + "statusVal": "", + "statusType": "auto", + "x": 1210, + "y": 1080, + "wires": [] + }, + { + "id": "35ea3cf0.a398ac", + "type": "exec", + "z": "1371dec5.76e671", + "command": "sudo killall -15 python3", + "addpay": true, + "append": "", + "useSpawn": "false", + "timer": "", + "oldrc": false, + "name": "Python soft kill", + "x": 960, + "y": 860, + "wires": [ + [], + [], + [] + ] + }, + { + "id": "a776b9fc.d542e8", + "type": "delay", + "z": "1371dec5.76e671", + "d": true, + "name": "", + "pauseType": "delay", + "timeout": "4", + "timeoutUnits": "seconds", + "rate": "1", + "nbRateUnits": "1", + "rateUnits": "second", + "randomFirst": "1", + "randomLast": "5", + "randomUnits": "seconds", + "drop": false, + "x": 740, + "y": 1020, + "wires": [ + [ + "672d89a8.4e6968" + ] + ] + }, + { + "id": "569154a.b53182c", "type": "inject", - "z": "977131e7.c2e76", - "name": "Default: 1ml", + "z": "1371dec5.76e671", + "name": "once", "props": [ { - "p": "payload" + "p": "topic", + "vt": "str" + } + ], + "repeat": "60", + "crontab": "", + "once": true, + "onceDelay": "", + "topic": "", + "x": 130, + "y": 840, + "wires": [ + [ + "afa9f4b.2e77988", + "3829adc.ccc87d2", + "452af41c.43940c", + "b3c21aa9.8c06c" + ] + ] + }, + { + "id": "3829adc.ccc87d2", + "type": "exec", + "z": "1371dec5.76e671", + "command": "sudo killall -15 raspimjpeg", + "addpay": true, + "append": "", + "useSpawn": "false", + "timer": "", + "oldrc": false, + "name": "Raspimjpeg soft kill", + "x": 490, + "y": 820, + "wires": [ + [], + [], + [] + ] + }, + { + "id": "b55ed048.2418c8", + "type": "ui_template", + "z": "1371dec5.76e671", + "group": "1be83144.4fe4bf", + "name": "", + "order": 1, + "width": 0, + "height": 0, + "format": "
If you want to update to the latest code version of Node-Red and Python, please click here.\n
\nPlease note that all your changes are going to be saved with git stash but are not going to be restored!
", + "storeOutMessages": true, + "fwdInMessages": true, + "resendOnRefresh": true, + "templateScope": "local", + "x": 100, + "y": 460, + "wires": [ + [] + ] + }, + { + "id": "4b489713.ccde5", + "type": "ui_button", + "z": "baa1e3d9.cb29d", + "name": "", + "group": "4322c187.e73e5", + "order": 9, + "width": 5, + "height": 1, + "passthru": false, + "label": "Start Acquisition", + "tooltip": "", + "color": "", + "bgcolor": "", + "icon": "", + "payload": "", + "payloadType": "str", + "topic": "imager/image", + "x": 520, + "y": 460, + "wires": [ + [ + "52ea7d01.711034", + "40c12463.a1f84c" + ] + ] + }, + { + "id": "c9f510c0.7d1328", + "type": "function", + "z": "baa1e3d9.cb29d", + "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 acq_celltype= global.get(\"acq_celltype\");\nvar acq_minimum_mesh= global.get(\"acq_minimum_mesh\");\nvar acq_maximum_mesh= global.get(\"acq_maximum_mesh\");\nvar acq_volume= global.get(\"acq_volume\");\nvar acq_id= global.get(\"acq_id\");\n\nif (acq_celltype === undefined || acq_celltype === \"\") {\n msg.topic = \"Missing entry :\"\n msg.payload = \"Type of the flowcell\"\n}\nelse if (acq_minimum_mesh === undefined || acq_minimum_mesh === \"\") {\n msg.topic = \"Missing entry :\"\n msg.payload = \"Lower fraction size\"\n}\nelse if (acq_maximum_mesh === undefined || acq_maximum_mesh === \"\") {\n msg.topic = \"Missing entry :\"\n msg.payload = \"Upper fraction size\"\n}\nelse if (acq_volume === undefined || acq_volume === \"\") {\n msg.topic = \"Missing entry :\"\n msg.payload = \"Volume to image\"\n}\nelse if (acq_id === undefined || acq_id === \"\") {\n msg.topic = \"Missing entry :\"\n msg.payload = \"Acquisition ID\"\n}\nelse if (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 msg.payload={\"action\":\"image\", \n \"sleep\":sleep_before,\n \"volume\":nb_step,\n \"nb_frame\":nb_frame,\n }\n}\n\nreturn msg;", + "outputs": 1, + "noerr": 0, + "initialize": "", + "finalize": "", + "x": 880, + "y": 460, + "wires": [ + [ + "d6ebaa2.ea21d58" + ] + ], + "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": "d6ebaa2.ea21d58", + "type": "switch", + "z": "baa1e3d9.cb29d", + "name": "", + "property": "topic", + "propertyType": "msg", + "rules": [ + { + "t": "eq", + "v": "imager/image", + "vt": "str" + }, + { + "t": "eq", + "v": "Missing entry :", + "vt": "str" + } + ], + "checkall": "true", + "repair": false, + "outputs": 2, + "x": 1030, + "y": 460, + "wires": [ + [ + "c3e50240.82aa58" + ], + [ + "20e0a8c8.edbeb" + ] + ] + }, + { + "id": "20e0a8c8.edbeb", + "type": "ui_toast", + "z": "baa1e3d9.cb29d", + "position": "dialog", + "displayTime": "3", + "highlight": "", + "sendall": true, + "outputs": 1, + "ok": "OK", + "cancel": "", + "raw": false, + "topic": "", + "name": "", + "x": 1190, + "y": 500, + "wires": [ + [] + ] + }, + { + "id": "c3e50240.82aa58", + "type": "mqtt out", + "z": "baa1e3d9.cb29d", + "name": "", + "topic": "", + "qos": "", + "retain": "", + "broker": "8dc3722c.06efa8", + "x": 1170, + "y": 420, + "wires": [] + }, + { + "id": "3a4450b1.4459a8", + "type": "ui_button", + "z": "baa1e3d9.cb29d", + "name": "Stop Acquisition", + "group": "4322c187.e73e5", + "order": 8, + "width": 5, + "height": 1, + "passthru": true, + "label": "STOP ACQUISITION", + "tooltip": "", + "color": "", + "bgcolor": "#AD1625", + "icon": "cancel", + "payload": "{\"action\":\"stop\"}", + "payloadType": "json", + "topic": "imager/image", + "x": 520, + "y": 500, + "wires": [ + [ + "d74210ef.edc15" + ] + ] + }, + { + "id": "d74210ef.edc15", + "type": "mqtt out", + "z": "baa1e3d9.cb29d", + "name": "", + "topic": "", + "qos": "", + "retain": "", + "broker": "8dc3722c.06efa8", + "x": 710, + "y": 500, + "wires": [] + }, + { + "id": "bb62da8a.ebc328", + "type": "ui_switch", + "z": "baa1e3d9.cb29d", + "name": "", + "label": "Pump FORWARD/BACKWARD", + "tooltip": "", + "group": "4322c187.e73e5", + "order": 4, + "width": 3, + "height": 1, + "passthru": true, + "decouple": "false", + "topic": "", + "style": "", + "onvalue": "FORWARD", + "onvalueType": "str", + "onicon": "", + "oncolor": "", + "offvalue": "BACKWARD", + "offvalueType": "str", + "officon": "", + "offcolor": "", + "x": 470, + "y": 540, + "wires": [ + [] + ] + }, + { + "id": "52ea7d01.711034", + "type": "function", + "z": "baa1e3d9.cb29d", + "name": "Encapsulate config", + "func": "msg.payload = {\n \"action\":\"update_config\", \n \"config\":{\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 \"acq_camera_name\":\"Pi Camera V2.1 - 8MP\",\n \"acq_nb_frame\":global.get(\"custom_nb_frame\"),\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 \"process_pixel\":global.get(\"process_pixel\"),\n \"process_id\":global.get(\"process_id\")\n }\n};\nreturn msg;", + "outputs": 1, + "noerr": 0, + "initialize": "", + "finalize": "", + "x": 750, + "y": 420, + "wires": [ + [ + "c3e50240.82aa58" + ] + ] + }, + { + "id": "40c12463.a1f84c", + "type": "delay", + "z": "baa1e3d9.cb29d", + "name": "", + "pauseType": "delay", + "timeout": "1", + "timeoutUnits": "seconds", + "rate": "1", + "nbRateUnits": "1", + "rateUnits": "second", + "randomFirst": "1", + "randomLast": "5", + "randomUnits": "seconds", + "drop": false, + "x": 720, + "y": 460, + "wires": [ + [ + "c9f510c0.7d1328" + ] + ] + }, + { + "id": "4d1b02cb.83b51c", + "type": "ui_button", + "z": "baa1e3d9.cb29d", + "name": "", + "group": "4322c187.e73e5", + "order": 6, + "width": 6, + "height": 1, + "passthru": false, + "label": "Update config", + "tooltip": "", + "color": "", + "bgcolor": "", + "icon": "", + "payload": "", + "payloadType": "str", + "topic": "imager/image", + "x": 520, + "y": 420, + "wires": [ + [ + "52ea7d01.711034", + "e2919164.70927" + ] + ] + }, + { + "id": "452af41c.43940c", + "type": "python3-function", + "z": "1371dec5.76e671", + "name": "Get MachineName", + "func": "import sys\nsys.path.append('/home/pi/PlanktonScope/scripts')\nimport planktoscope.uuidName\n\nmsg['payload'] = planktoscope.uuidName.machineName(machine=planktoscope.uuidName.getSerial())\nmsg['topic'] = \"acq_instrument_id\";\nreturn msg", + "outputs": 1, + "x": 490, + "y": 760, + "wires": [ + [ + "4828d2f4.7c712c", + "e2f39a35.f57298", + "a400a97e.e333a8" + ] + ] + }, + { + "id": "4828d2f4.7c712c", + "type": "function", + "z": "1371dec5.76e671", + "name": "set global", + "func": "global.set(msg.topic,msg.payload);\nreturn msg;", + "outputs": 1, + "noerr": 0, + "initialize": "", + "finalize": "", + "x": 780, + "y": 800, + "wires": [ + [] + ] + }, + { + "id": "2200e2ae.0d183e", + "type": "rpi-gpio out", + "z": "1371dec5.76e671", + "name": "Pump Enable", + "pin": "7", + "set": true, + "level": "1", + "freq": "", + "out": "out", + "x": 470, + "y": 600, + "wires": [] + }, + { + "id": "592c4dac.b8a9dc", + "type": "rpi-gpio out", + "z": "1371dec5.76e671", + "name": "Focus Enable", + "pin": "32", + "set": true, + "level": "1", + "freq": "", + "out": "out", + "x": 480, + "y": 640, + "wires": [] + }, + { + "id": "d027a6bf.7049e8", + "type": "function", + "z": "b771c342.49603", + "name": "get sample_projet", + "func": "msg.payload = msg.payload.sample_project;\nreturn msg;", + "outputs": 1, + "noerr": 0, + "initialize": "", + "finalize": "", + "x": 350, + "y": 300, + "wires": [ + [ + "9c882b37.fde668" + ] + ] + }, + { + "id": "5a811caf.0f3144", + "type": "function", + "z": "b771c342.49603", + "name": "get sample_ship", + "func": "msg.payload = msg.payload.sample_ship;\nreturn msg;", + "outputs": 1, + "noerr": 0, + "initialize": "", + "finalize": "", + "x": 340, + "y": 340, + "wires": [ + [ + "4557d689.a4fa88" + ] + ] + }, + { + "id": "45911c98.2bd83c", + "type": "function", + "z": "b771c342.49603", + "name": "get sample_id", + "func": "msg.payload = msg.payload.sample_id;\nreturn msg;", + "outputs": 1, + "noerr": 0, + "initialize": "", + "finalize": "", + "x": 340, + "y": 380, + "wires": [ + [ + "94eb4221.9b92c" + ] + ] + }, + { + "id": "1e09a4ab.72996b", + "type": "function", + "z": "b771c342.49603", + "name": "get sample_operator", + "func": "msg.payload = msg.payload.sample_operator;\nreturn msg;", + "outputs": 1, + "noerr": 0, + "initialize": "", + "finalize": "", + "x": 360, + "y": 420, + "wires": [ + [ + "82c5fc77.59c97" + ] + ] + }, + { + "id": "a3272681.f271c8", + "type": "function", + "z": "b771c342.49603", + "name": "get sample_sampling_gear", + "func": "msg.payload = msg.payload.sample_sampling_gear;\nreturn msg;", + "outputs": 1, + "noerr": 0, + "x": 380, + "y": 460, + "wires": [ + [ + "fcfc31ae.af3af" + ] + ] + }, + { + "id": "6465bdd5.15eb8c", + "type": "file in", + "z": "1c24ad9c.bebec2", + "name": "", + "filename": "/home/pi/PlanktonScope/config.json", + "format": "utf8", + "chunk": false, + "sendError": false, + "encoding": "none", + "x": 660, + "y": 300, + "wires": [ + [ + "15ceb135.6628bf" + ] + ], + "info": "# PlanktonScope Help\nThis Node will read the content of the file named **config.txt** containing all the input placeholders.\n" + }, + { + "id": "15ceb135.6628bf", + "type": "json", + "z": "1c24ad9c.bebec2", + "name": "config.json", + "property": "payload", + "action": "", + "pretty": false, + "x": 910, + "y": 300, + "wires": [ + [ + "ad541674.4791c8" + ] + ] + }, + { + "id": "b584292a.24b08", + "type": "function", + "z": "1c24ad9c.bebec2", + "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 \n \"acq_id\":global.get(\"acq_id\"),\n \"acq_instrument\":global.get(\"acq_instrument\"),\n \"acq_instrument_id\":global.get(\"machine_name\"),\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 \"acq_camera\":global.get(\"camera_name\"),\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};\nreturn msg;", + "outputs": 1, + "noerr": 0, + "initialize": "", + "finalize": "", + "x": 560, + "y": 860, + "wires": [ + [ + "2e6ddf51.c0dba" + ] + ] + }, + { + "id": "7205d267.36adcc", + "type": "file", + "z": "1c24ad9c.bebec2", + "name": "", + "filename": "/home/pi/PlanktonScope/config.json", + "appendNewline": true, + "createDir": true, + "overwriteFile": "true", + "encoding": "none", + "x": 970, + "y": 860, + "wires": [ + [] + ] + }, + { + "id": "2e6ddf51.c0dba", + "type": "json", + "z": "1c24ad9c.bebec2", + "name": "config.json", + "property": "payload", + "action": "str", + "pretty": true, + "x": 720, + "y": 860, + "wires": [ + [ + "7205d267.36adcc" + ] + ] + }, + { + "id": "ad541674.4791c8", + "type": "function", + "z": "1c24ad9c.bebec2", + "name": "Global Set", + "func": "for (const key in msg.payload) {\n global.set(key, msg.payload[key]);\n}\n\nreturn msg;", + "outputs": 1, + "noerr": 0, + "initialize": "", + "finalize": "", + "x": 1090, + "y": 300, + "wires": [ + [] + ] + }, + { + "id": "3e9a33c.141384c", + "type": "inject", + "z": "1c24ad9c.bebec2", + "name": "Load config", + "props": [ + { + "p": "topic", + "vt": "str" } ], "repeat": "", @@ -5303,14 +5232,513 @@ "once": true, "onceDelay": 0.1, "topic": "", - "payload": "1", - "payloadType": "num", - "x": 170, + "x": 410, + "y": 300, + "wires": [ + [ + "6465bdd5.15eb8c" + ] + ] + }, + { + "id": "e2f39a35.f57298", + "type": "subflow:1c24ad9c.bebec2", + "z": "1371dec5.76e671", + "name": "", + "env": [], + "x": 770, + "y": 720, + "wires": [ + [ + "bdc6718a.dd5d48", + "f783aefd.c3bfd8" + ] + ] + }, + { + "id": "a6907a38.f6611", + "type": "subflow:1c24ad9c.bebec2", + "z": "b771c342.49603", + "name": "", + "env": [], + "x": 90, + "y": 380, + "wires": [ + [ + "d027a6bf.7049e8", + "5a811caf.0f3144", + "45911c98.2bd83c", + "1e09a4ab.72996b", + "a3272681.f271c8" + ] + ] + }, + { + "id": "e2b277c1.07283", + "type": "subflow:1c24ad9c.bebec2", + "z": "b771c342.49603", + "name": "", + "x": 830, + "y": 1080, + "wires": [ + [] + ] + }, + { + "id": "3cea1f2.20525e", + "type": "ui_text_input", + "z": "b771c342.49603", + "name": "object_lat_end", + "label": "Latitude of retrieval", + "tooltip": "", + "group": "cf5d9f0e.d57e7", + "order": 1, + "width": 12, + "height": 1, + "passthru": true, + "mode": "number", + "delay": 300, + "topic": "object_lat_end", + "x": 640, + "y": 700, + "wires": [ + [ + "9f501f49.45645" + ] + ] + }, + { + "id": "661818e.5a31368", + "type": "ui_text_input", + "z": "b771c342.49603", + "name": "object_lon_end", + "label": "Longitude of retrieval", + "tooltip": "", + "group": "cf5d9f0e.d57e7", + "order": 2, + "width": 12, + "height": 1, + "passthru": true, + "mode": "number", + "delay": 300, + "topic": "object_lon_end", + "x": 640, + "y": 740, + "wires": [ + [ + "9f501f49.45645" + ] + ] + }, + { + "id": "f9d71e4b.2940a", + "type": "ui_date_picker", + "z": "b771c342.49603", + "name": "object_date_end", + "label": "Date", + "group": "cf5d9f0e.d57e7", + "order": 3, + "width": 12, + "height": 1, + "passthru": true, + "topic": "object_date_end", + "x": 640, + "y": 780, + "wires": [ + [ + "29f2b365.4327ec" + ] + ] + }, + { + "id": "2a514f3b.97a6b", + "type": "ui_text_input", + "z": "b771c342.49603", + "name": "object_time_end", + "label": "Time :", + "tooltip": "", + "group": "cf5d9f0e.d57e7", + "order": 4, + "width": 12, + "height": 1, + "passthru": true, + "mode": "time", + "delay": 300, + "topic": "object_time_end", + "x": 640, + "y": 820, + "wires": [ + [ + "1a945afa.d60aad" + ] + ] + }, + { + "id": "1a945afa.d60aad", + "type": "function", + "z": "b771c342.49603", + "name": "set time global", + "func": "var date = new Date(global.get(msg.topic));\n// From https://stackoverflow.com/a/53752557/2108279\n\n\n// attempt to parse string as time. return js date object\nstring = msg.payload\n\nvar am = null;\n\n// check if \"apm\" or \"pm\" explicitly specified, otherwise null\nif (string.toLowerCase().includes(\"p\")) am = false;\nelse if (string.toLowerCase().includes(\"a\")) am = true;\n\nstring = string.replace(/\\D/g, \"\"); // remove non-digit characters\nstring = string.substring(0, 4); // take only first 4 digits\nif (string.length === 3) string = \"0\" + string; // consider eg \"030\" as \"0030\"\nstring = string.replace(/^00/, \"24\"); // add 24 hours to preserve eg \"0012\" as \"00:12\" instead of \"12:00\", since will be converted to integer\n\nvar time = parseInt(string); // convert to integer\n// default time if all else fails\nvar hours = 12,\nminutes = 0;\n\n// if able to parse as int\nif (Number.isInteger(time)) {\n// treat eg \"4\" as \"4:00pm\" (or \"4:00am\" if \"am\" explicitly specified)\nif (time >= 0 && time <= 12) {\n hours = time;\n minutes = 0;\n // if \"am\" or \"pm\" not specified, establish from number\n if (am === null) {\n if (hours >= 1 && hours <= 12) am = false;\n else am = true;\n }\n}\n// treat eg \"20\" as \"8:00pm\"\nelse if (time >= 13 && time <= 99) {\n hours = time % 24;\n minutes = 0;\n // if \"am\" or \"pm\" not specified, force \"am\"\n if (am === null) am = true;\n}\n// treat eg \"52:95\" as 52 hours 95 minutes \nelse if (time >= 100) {\n hours = Math.floor(time / 100); // take first two digits as hour\n minutes = time % 100; // take last two digits as minute\n // if \"am\" or \"pm\" not specified, establish from number\n if (am === null) {\n if (hours >= 1 && hours <= 12) am = false;\n else am = true;\n }\n}\n\n// add 12 hours if \"pm\"\nif (am === false && hours !== 12) hours += 12;\n// sub 12 hours if \"12:00am\" (midnight), making \"00:00\"\nif (am === true && hours === 12) hours = 0;\n\n// keep hours within 24 and minutes within 60\n// eg 52 hours 95 minutes becomes 4 hours 35 minutes\nhours = hours % 24;\nminutes = minutes % 60;\n}\n\n// convert to js date object\ndate.setHours(hours);\ndate.setMinutes(minutes);\ndate.setSeconds(0);\n\nglobal.set(msg.topic,date.toISOString().split('T')[1].split('.')[0].replace(/:/gi, ''));", + "outputs": 1, + "noerr": 0, + "initialize": "", + "finalize": "", + "x": 980, + "y": 740, + "wires": [ + [] + ] + }, + { + "id": "29f2b365.4327ec", + "type": "function", + "z": "b771c342.49603", + "name": "set date global", + "func": "var date = new Date(msg.payload);\n\nglobal.set(msg.topic,date.toISOString().split('T')[0].replace(/-/gi, ''));", + "outputs": 1, + "noerr": 0, + "initialize": "", + "finalize": "", + "x": 980, + "y": 700, + "wires": [ + [] + ] + }, + { + "id": "b3c21aa9.8c06c", + "type": "exec", + "z": "1371dec5.76e671", + "command": "git --git-dir /home/pi/PlanktonScope/.git/ rev-parse --short master", + "addpay": false, + "append": "", + "useSpawn": "false", + "timer": "", + "oldrc": false, + "name": "git rev", + "x": 450, + "y": 700, + "wires": [ + [ + "3e64877a.9684b", + "1bdd7f07.616f69" + ], + [], + [] + ] + }, + { + "id": "3e64877a.9684b", + "type": "function", + "z": "1371dec5.76e671", + "name": "store git rev", + "func": "msg.payload = \"PlanktoScope v2.2-\"+msg.payload\n\nglobal.set(\"acq_software\",msg.payload);\n\nreturn msg\n", + "outputs": 1, + "noerr": 0, + "initialize": "", + "finalize": "", + "x": 790, + "y": 640, + "wires": [ + [ + "8343fa69.49339" + ] + ] + }, + { + "id": "68fa1227.dbdd5c", + "type": "function", + "z": "bccd1f23.87219", + "name": "get acq_fnumber_objective", + "func": "msg.payload = msg.payload.acq_fnumber_objective;\nreturn msg;", + "outputs": 1, + "noerr": 0, + "initialize": "", + "finalize": "", + "x": 820, + "y": 100, + "wires": [ + [ + "cc966678.da8d08" + ] + ] + }, + { + "id": "1c45ea1c.80234e", + "type": "subflow:1c24ad9c.bebec2", + "z": "bccd1f23.87219", + "name": "", + "x": 600, + "y": 100, + "wires": [ + [ + "68fa1227.dbdd5c" + ] + ] + }, + { + "id": "5921d0d0.a3d568", + "type": "subflow:1c24ad9c.bebec2", + "z": "baa1e3d9.cb29d", + "name": "", + "x": 80, + "y": 120, + "wires": [ + [ + "f3658d30.b8448", + "1f133196.96564e", + "d3ca8847.4d1ae", + "5e3dec55.881074", + "de2c90cf.b73b08" + ] + ] + }, + { + "id": "f3658d30.b8448", + "type": "function", + "z": "baa1e3d9.cb29d", + "name": "get acq_id", + "func": "msg.payload = msg.payload.acq_id+1;\nreturn msg;", + "outputs": 1, + "noerr": 0, + "x": 310, + "y": 240, + "wires": [ + [ + "6b34c456.83178c" + ] + ] + }, + { + "id": "5acd51d4.4ab13", + "type": "function", + "z": "baa1e3d9.cb29d", + "name": "get acq_instrument", + "func": "msg.payload = msg.payload.acq_instrument;\nreturn msg;", + "outputs": 1, + "noerr": 0, + "x": 370, + "y": 780, + "wires": [ + [] + ] + }, + { + "id": "de2c90cf.b73b08", + "type": "function", + "z": "baa1e3d9.cb29d", + "name": "get acq_celltype", + "func": "msg.payload = msg.payload.acq_celltype;\nreturn msg;", + "outputs": 1, + "noerr": 0, + "x": 320, "y": 80, "wires": [ [ - "f1b85f22.ac673" + "cc0ca68b.4263a8" ] ] + }, + { + "id": "5e3dec55.881074", + "type": "function", + "z": "baa1e3d9.cb29d", + "name": "get acq_minimum_mesh", + "func": "msg.payload = msg.payload.acq_minimum_mesh;\nreturn msg;", + "outputs": 1, + "noerr": 0, + "x": 350, + "y": 120, + "wires": [ + [ + "f59a2f0d.5e9af" + ] + ] + }, + { + "id": "d3ca8847.4d1ae", + "type": "function", + "z": "baa1e3d9.cb29d", + "name": "get acq_maximum_mesh", + "func": "msg.payload = msg.payload.acq_maximum_mesh;\nreturn msg;", + "outputs": 1, + "noerr": 0, + "x": 350, + "y": 160, + "wires": [ + [ + "6008a8bb.259f08" + ] + ] + }, + { + "id": "1f133196.96564e", + "type": "function", + "z": "baa1e3d9.cb29d", + "name": "get acq_volume", + "func": "msg.payload = msg.payload.acq_volume;\nreturn msg;", + "outputs": 1, + "noerr": 0, + "x": 320, + "y": 200, + "wires": [ + [ + "389bef3.d94c61" + ] + ] + }, + { + "id": "bdc6718a.dd5d48", + "type": "ui_text", + "z": "1371dec5.76e671", + "group": "ce9e278.781eed8", + "order": 3, + "width": 0, + "height": 0, + "name": "", + "label": "Instrument Type", + "format": "{{msg.payload.acq_instrument}}", + "layout": "row-spread", + "x": 1040, + "y": 700, + "wires": [] + }, + { + "id": "a400a97e.e333a8", + "type": "ui_text", + "z": "1371dec5.76e671", + "group": "ce9e278.781eed8", + "order": 0, + "width": 0, + "height": 0, + "name": "", + "label": "Instrument Name", + "format": "{{msg.payload}}", + "layout": "row-spread", + "x": 810, + "y": 760, + "wires": [] + }, + { + "id": "8343fa69.49339", + "type": "ui_text", + "z": "1371dec5.76e671", + "group": "ce9e278.781eed8", + "order": 1, + "width": 0, + "height": 0, + "name": "", + "label": "Software version", + "format": "{{msg.payload}}", + "layout": "row-spread", + "x": 1040, + "y": 640, + "wires": [] + }, + { + "id": "f783aefd.c3bfd8", + "type": "ui_text", + "z": "1371dec5.76e671", + "group": "ce9e278.781eed8", + "order": 0, + "width": 0, + "height": 0, + "name": "", + "label": "Camera Name", + "format": "{{msg.payload.acq_camera}}", + "layout": "row-spread", + "x": 1040, + "y": 740, + "wires": [] + }, + { + "id": "1bdd7f07.616f69", + "type": "debug", + "z": "1371dec5.76e671", + "name": "", + "active": true, + "tosidebar": true, + "console": false, + "tostatus": false, + "complete": "false", + "statusVal": "", + "statusType": "auto", + "x": 790, + "y": 680, + "wires": [] + }, + { + "id": "a0e2d78c.a587e", + "type": "inject", + "z": "1371dec5.76e671", + "name": "ON", + "props": [ + { + "p": "payload" + } + ], + "repeat": "60", + "crontab": "", + "once": true, + "onceDelay": "", + "topic": "", + "payload": "true", + "payloadType": "bool", + "x": 130, + "y": 620, + "wires": [ + [ + "2200e2ae.0d183e", + "592c4dac.b8a9dc" + ] + ] + }, + { + "id": "906d9fea.4bab48", + "type": "status", + "z": "b771c342.49603", + "d": true, + "name": "GPS Status", + "scope": [], + "x": 310, + "y": 1320, + "wires": [ + [ + "7116e906.9f50f" + ] + ] + }, + { + "id": "7116e906.9f50f", + "type": "ui_text", + "z": "b771c342.49603", + "d": true, + "group": "cf5d9f0e.d57e7", + "order": 5, + "width": 6, + "height": 1, + "name": "GPS Status Display", + "label": "GPS Status:", + "format": "{{msg.status.text}}", + "layout": "row-left", + "x": 810, + "y": 1320, + "wires": [] + }, + { + "id": "3269f55f.05d0d2", + "type": "function", + "z": "b771c342.49603", + "name": "Convert DD to DMS", + "func": "function ConvertDDToDMS(D, lng){\n // from https://stackoverflow.com/a/5786281/2108279\n return {\n dir : D<0?lng?'W':'S':lng?'E':'N',\n deg : 0|(D<0?D=-D:D),\n min : 0|D%1*60,\n sec :(0|D*60%1*6000)/100\n };\n}\n\nmsg.payload = {\n \"lat\":ConvertDDToDMS(msg.payload.lat, false),\n \"lon\":ConvertDDToDMS(msg.payload.lon, true)\n};\nreturn msg;", + "outputs": 1, + "noerr": 0, + "initialize": "", + "finalize": "", + "x": 550, + "y": 1240, + "wires": [ + [] + ] } ] \ No newline at end of file