From f3bb5bd8fc9b7500202491ab56e7bb6cfd6ba3b0 Mon Sep 17 00:00:00 2001 From: Kseninia Mikhaylova Date: Thu, 10 Oct 2024 16:35:50 +0300 Subject: [PATCH] test el --- client_socket.py | 9 ++- data/test.nc.result | 7 +- test_socket_server.py | 4 +- urdf/sample.urdf | 167 ++++++++++++++++++++++-------------------- 4 files changed, 100 insertions(+), 87 deletions(-) diff --git a/client_socket.py b/client_socket.py index 57ca963..9d9d9b9 100644 --- a/client_socket.py +++ b/client_socket.py @@ -72,7 +72,7 @@ class SocketRobotArm: f"urdf/{self.urdf_filename}.urdf", [0, 0, 0], useFixedBase=True, - globalScaling=2, + globalScaling=1, ) while True: @@ -101,7 +101,7 @@ class SocketRobotArm: self.get_world() self.set_text(text=f"Мировые координаты {self.start_world_coordinates}") time.sleep(0.5) - self.set_joint(self.convert_to_joint(self.start_world_coordinates[0:3])) + # self.set_joint(self.convert_to_joint(self.start_world_coordinates[0:3])) self.get_command_count() self.set_text(text=f"Команд в очереди {self.remote_command_count}") @@ -151,6 +151,7 @@ class SocketRobotArm: [float(p) for p in [p["m0"], p["m1"], p["m2"]]] ) self.set_joint(angles) + time.sleep(0.5) def convert_to_joint(self, coordinates): num_joints = p.getNumJoints(self.body_id) @@ -167,8 +168,8 @@ class SocketRobotArm: def set_joint(self, coordinates): num_joints = p.getNumJoints(self.body_id) for joint_index in range(0, num_joints): - if not joint_index in coordinates: - return + # if not joint_index in coordinates: + # return p.setJointMotorControl2( bodyUniqueId=self.body_id, jointIndex=joint_index, diff --git a/data/test.nc.result b/data/test.nc.result index ca0c8ff..e645a49 100644 --- a/data/test.nc.result +++ b/data/test.nc.result @@ -1,4 +1,9 @@ +X0 Y0 +X0 Y50 X0 Y100 +X50 Y100 X100 Y100 +X100 Y50 X100 Y0 -X0 Y0 \ No newline at end of file +X50 Y0 +X0 Y0 diff --git a/test_socket_server.py b/test_socket_server.py index f95127c..0d01be5 100644 --- a/test_socket_server.py +++ b/test_socket_server.py @@ -18,8 +18,8 @@ with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s: res = {"queryData": ["ok"]} if "queryAddr" in req.keys() and "axis-0" in req["queryAddr"]: - res["queryData"] = [-59.696, 39.438, -7.478, -58.198, -76.606, 0] - # res["queryData"] = [-60, 40, -10, -60, -75, 0] + # res["queryData"] = [-59.696, 39.438, -7.478, -58.198, -76.606, 0.0] + res["queryData"] = [-60, 40, -10, -60, -75, 0] if "queryAddr" in req and "world-0" in req["queryAddr"]: res["queryData"] = [ diff --git a/urdf/sample.urdf b/urdf/sample.urdf index 3cbcd51..d1be32b 100644 --- a/urdf/sample.urdf +++ b/urdf/sample.urdf @@ -2,144 +2,151 @@ + + + + - + - + - - + + + + + + - + - + - - + + + + + + - + - + - - + + + + + + - + - + - - + + + + + + - + - + - - + + + + + + - + - + - - + + + + + + - + - + - - + + - - - - - + + + + + - - - - - + + + + + - - - - - + + + + + - - - - - + + + + + - - - - - + + + + + - - - - - + + + + + - - - - - - - - - - - - - - - - - - - - - - + \ No newline at end of file