We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 66efd10 commit 8230486Copy full SHA for 8230486
1 file changed
ros2topic/ros2topic/api/__init__.py
@@ -114,6 +114,17 @@ def set_msg_fields(msg, values):
114
except ValueError as e:
115
raise SetFieldError(field_name, e)
116
try:
117
+ f_type = msg.get_slot_types()['_' + field_name]
118
+ # Check if field is an array of ROS message types
119
+ if f_type.find('/') != -1:
120
+ if isinstance(field_type(), list):
121
+ f_type = f_type[:f_type.rfind('[')]
122
+ field_elem_type = import_message_type('', f_type)
123
+ for n in range(len(value)):
124
+ submsg = field_elem_type()
125
+ set_msg_fields(submsg, value[n])
126
+ value[n] = submsg
127
+
128
setattr(msg, field_name, value)
129
except Exception as e:
130
0 commit comments