Skip to content

Commit e8b8811

Browse files
Service header and body should be a single item in the send queue (ROS2)
1 parent 31c8d6f commit e8b8811

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

ros_tcp_endpoint/tcp_sender.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,9 @@ def send_ros_service_response(self, srv_id, destination, response):
8080
if self.queue is not None:
8181
command = SysCommand_Service()
8282
command.srv_id = srv_id
83-
serialized_bytes = ClientThread.serialize_command("__response", command)
84-
self.queue.put(serialized_bytes)
85-
self.send_unity_message(destination, response)
83+
serialized_header = ClientThread.serialize_command("__response", command)
84+
serialized_message = ClientThread.serialize_message(destination, response)
85+
self.queue.put(b"".join([serialized_header, serialized_message]))
8686

8787
def send_unity_message(self, topic, message):
8888
if self.queue is not None:
@@ -101,9 +101,9 @@ def send_unity_service_request(self, topic, service_class, request):
101101

102102
command = SysCommand_Service()
103103
command.srv_id = srv_id
104-
serialized_bytes = ClientThread.serialize_command("__request", command)
105-
self.queue.put(serialized_bytes)
106-
self.send_unity_message(topic, request)
104+
serialized_header = ClientThread.serialize_command("__request", command)
105+
serialized_message = ClientThread.serialize_message(topic, request)
106+
self.queue.put(b"".join([serialized_header, serialized_message]))
107107

108108
# rospy starts a new thread for each service request,
109109
# so it won't break anything if we sleep now while waiting for the response

0 commit comments

Comments
 (0)