Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Workaround empty Trigger Request deserialization issue #1

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion ros_tcp_endpoint/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

import rclpy
import re
import std_srvs

from rclpy.serialization import deserialize_message

Expand Down Expand Up @@ -52,7 +53,16 @@ def send(self, data):
service response
"""
message_type = type(self.req)
message = deserialize_message(data, message_type)

"""
The below workaround handles deserialization issues with empty message type "Trigger.Request".
Solution was identified in: https://github.com/Unity-Technologies/Unity-Robotics-Hub/issues/390
"""
message = None
if(isinstance(message_type, std_srvs.srv._trigger.Metaclass_Trigger_Request)):
message = std_srvs.srv.Trigger.Request()
else:
message = deserialize_message(data, message_type)

if not self.cli.wait_for_service(10.0):
self.get_logger().error(
Expand Down