Skip to content

Commit

Permalink
io_stop
Browse files Browse the repository at this point in the history
  • Loading branch information
rise0chen committed Oct 16, 2024
1 parent ec631d6 commit 4609aa9
Show file tree
Hide file tree
Showing 8 changed files with 43 additions and 2 deletions.
4 changes: 2 additions & 2 deletions camera/web/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,12 @@
ws.send(JSON.stringify(rpc_data));
rpc_data.params[0] = {
"key": "plugin_camera_height",
"value": document.getElementById("flip").value
"value": document.getElementById("height").value
};
ws.send(JSON.stringify(rpc_data));
rpc_data.params[0] = {
"key": "plugin_camera_flip",
"value": document.getElementById("height").value
"value": document.getElementById("flip").value
};
ws.send(JSON.stringify(rpc_data));
rpc_data.params[0] = {
Expand Down
2 changes: 2 additions & 0 deletions io_stop/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/.plugin
x86_64/
4 changes: 4 additions & 0 deletions io_stop/bin/daemon.exe
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env bash
cd "$(dirname "$0")"
#./`uname -m`/main
lpy ./src/main.py
1 change: 1 addition & 0 deletions io_stop/bin/disable.exe
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#!/usr/bin/env bash
4 changes: 4 additions & 0 deletions io_stop/bin/enable.exe
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env bash
cd "$(dirname "$0")"
#chmod 755 ./`uname -m`/camera_calibrater
lpip install -r ./src/requirements.txt
23 changes: 23 additions & 0 deletions io_stop/bin/src/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# encoding: utf-8

import lebai_sdk
import time

lebai_sdk.init()
lebai = lebai_sdk.connect("127.0.0.1", False)


def main():
last = lebai.get_di("ROBOT", 0)
while True:
time.sleep(0.1)
new = lebai.get_di("ROBOT", 0)
if last == 0 and new == 1:
lebai.resume_task()
if last == 1 and new == 0:
lebai.pause_task()
last = new


if __name__ == "__main__":
main()
1 change: 1 addition & 0 deletions io_stop/bin/src/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
lebai_sdk>=0.2.0
6 changes: 6 additions & 0 deletions io_stop/plugin.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"name": "io_stop",
"description": "IO控制急停",
"homepage": "lebai.ltd",
"auto_restart": true
}

0 comments on commit 4609aa9

Please sign in to comment.