From 3bd716c159eed5c09b581000b7aabbce6368f414 Mon Sep 17 00:00:00 2001 From: Your Name <marko.guberina@control.lth.se> Date: Tue, 4 Feb 2025 18:32:03 +0100 Subject: [PATCH] frame id has to be a string. can't run at 250Hz, shit brakes --- python/examples/graz/protobuf_ros1_bridge.py | 2 +- python/examples/graz/protobuf_to_ros1.py | 7 ++++--- python/examples/graz/ros1_to_protobuf.py | 5 +++-- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/python/examples/graz/protobuf_ros1_bridge.py b/python/examples/graz/protobuf_ros1_bridge.py index 4c412c9..9f2c854 100644 --- a/python/examples/graz/protobuf_ros1_bridge.py +++ b/python/examples/graz/protobuf_ros1_bridge.py @@ -167,5 +167,5 @@ if __name__ == "__main__": wrench_message.wrench.torque.y = pb2_msg.wrench[4] wrench_message.wrench.torque.z = pb2_msg.wrench[5] wrench_message.header.stamp = rospy.Time.now() - wrench_message.header.frame_id = 0 + wrench_message.header.frame_id = "0" pub.publish(wrench_message) diff --git a/python/examples/graz/protobuf_to_ros1.py b/python/examples/graz/protobuf_to_ros1.py index 0b35f2b..ae11991 100644 --- a/python/examples/graz/protobuf_to_ros1.py +++ b/python/examples/graz/protobuf_to_ros1.py @@ -50,6 +50,7 @@ def parse_message(buffer): # ros parts +#if False: if importlib.util.find_spec("rospy"): ros1_exists = True rospy.init_node("ur5e_to_ros1_mapper", anonymous=True) @@ -73,8 +74,8 @@ buffer = b"" while True: msg_raw = comm_socket.recv(1024) buffer += msg_raw - print(msg_raw) - print(len(msg_raw)) +# print(msg_raw) +# print(len(msg_raw)) if len(msg_raw) < 1: continue msg_in_bytes, pos = parse_message(buffer) @@ -97,5 +98,5 @@ while True: wrench_message.wrench.torque.y = pb2_msg.wrench[4] wrench_message.wrench.torque.z = pb2_msg.wrench[5] wrench_message.header.stamp = rospy.Time.now() - wrench_message.header.frame_id = 0 + wrench_message.header.frame_id = "0" pub.publish(wrench_message) diff --git a/python/examples/graz/ros1_to_protobuf.py b/python/examples/graz/ros1_to_protobuf.py index 23b9a47..96f820a 100644 --- a/python/examples/graz/ros1_to_protobuf.py +++ b/python/examples/graz/ros1_to_protobuf.py @@ -55,12 +55,13 @@ def sendRandomForTest(comm_socket): pb2_msg.position.extend([random.random()] * 3) pb2_msg.rotation.extend([random.random()] * 4) pb2_msg.velocity.extend([random.random()] * 6) - # print(pb2_msg) + print(pb2_msg) msg_length = pb2_msg.ByteSize() msg_serialized = pb2_msg.SerializeToString() msg = _VarintBytes(msg_length) + msg_serialized comm_socket.send(msg) - time.sleep(0.002) + #time.sleep(0.002) + time.sleep(0.02) if __name__ == "__main__": -- GitLab