From 553a8c7413f0f20111f43945796589ece3b5af63 Mon Sep 17 00:00:00 2001 From: Kenneth Yang <82800265+kjy5@users.noreply.github.com> Date: Wed, 14 Feb 2024 11:34:16 -0800 Subject: [PATCH] Movement tester (#325) --- pyproject.toml | 1 + scripts/__init__.py | 0 scripts/move_tester.py | 21 +++++++++++++++++++++ 3 files changed, 22 insertions(+) create mode 100644 scripts/__init__.py create mode 100644 scripts/move_tester.py diff --git a/pyproject.toml b/pyproject.toml index b0ab101..550d4a3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -60,6 +60,7 @@ python = "3.12" dependencies = [ "coverage[toml]>=6.5", "pytest", + "python-socketio[client]==5.11.1", ] [tool.hatch.envs.default.scripts] test = "pytest {args:tests}" diff --git a/scripts/__init__.py b/scripts/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/scripts/move_tester.py b/scripts/move_tester.py new file mode 100644 index 0000000..4c546b5 --- /dev/null +++ b/scripts/move_tester.py @@ -0,0 +1,21 @@ +import json + +import socketio + +if __name__ == "__main__": + sio = socketio.Client() + sio.connect("http://localhost:8081") + + sio.emit("register_manipulator", "6") + sio.emit("bypass_calibration", "6") + sio.emit("set_can_write", json.dumps({"manipulator_id": "6", "can_write": True, "hours": 0})) + + end = "" + while end == "": + sio.emit("goto_pos", json.dumps({"manipulator_id": "6", "pos": [0, 10, 10, 10], "speed": 0.5})) + + input("Press enter to continue...") + + sio.emit("goto_pos", json.dumps({"manipulator_id": "6", "pos": [10, 10, 10, 10], "speed": 1})) + + end = input("Press enter to continue (or type any key then enter to end)...")