Service Request and Action Goal Message Creation Fails for Message Types with Embedded Arrays
sgstreet opened this issue · comments
The function joy_teleop.fill_msg(self, msg, values) does not correctly build ROS message types of the form:
string name
geometry_msgs/Pose2D[] poses
from the the provided yaml excerpt:
action_goal:
name: odom
poses:
- x: 2.0
y: 0.0
theta: 0.0
- x: 2.0
y: -2.0
theta: 0
- x: 0.0
y: -2.0
theta: 0
The code should instead use the function genpy.message.fill_message_args which will correctly load the above yaml to the message.
Hi Bence,
Thanks for the quick response....
The fill_msg function does not handle lists correctly. Attaching:
The action:
Plan mission
---
duration time_elapsed
---
string goal_name
The Plan message:
string frame
Waypoint[] waypoints
The Waypoint message:
string name
geometry_msgs/Pose2D goal
The config yaml:
mission:
type: action
action_name: mission/plan
action_goal:
mission:
frame: odom
waypoints:
- name: wp11
goal:
x: 2.0
y: 0.0
theta: 0.0
- name: wp12
goal:
x: 2.0
y: -2.0
theta: 0
- name: wp13
goal:
x: 0.0
y: -2.0
theta: 0
- name: wp14
goal:
x: 0.0
y: 0.0
theta: 0.0
buttons: [0]
This set fails during serialization for the goal because the message was incorrectly built. If you want a traceback, let me know.....
Basically after the call to
goal = self.get_message_type(self.get_action_type(cmd['action_name'])[:-6] + 'Goal')()
the goal message is created with an empty python list for waypoints field which the serialization code is expecting to be a list of Waypoint objects which are not created by the joy_teleop.fill_msg method. The function genpy.message.fill_message_args correctly take the yaml list of dicts and creates the Waypoint objects and binds them to the waypoints field.
Anything else?
Thanks for submitting the issue and the fix for it!
I am going to update the example config file with the list case.