ros-teleop / teleop_tools

A set of generic teleoperation tools for any robot.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Empty message_value dict when loading from YAML file.

pgold opened this issue · comments

I'm trying to set-up a topic command that publishes a std_msgs/msg/Empty message. Here's the relevant snippet (under ros__parameters):

dock:
  type: topic
  interface_type: std_msgs/msg/Empty
  topic_name: dock 
  deadman_buttons: [3]  # X button
  message_value: {}

The issue I'm having is that the empty mapping under message_value gets transformed into None when ROS loads the values from the YAML configuration file. Would there be another way of letting joy_teleop know that no fields have to be set for the message it will publish?

For the time being, I've modified my local repository to ignore the message_value field if it is None. I could send that as a PR, but I also wonder is this isn't something that should be fixed "upstream" (rclpy?) so that users can, in general, use empty dictionaries.

Proposed teleop_tools only change (as opposed to an "upstream" fix): pgold@13488fc.

Thanks for the opposed to an "upstream" fix. I was having the same issue and it fixed perfectly 👍

Edit: use square brackets otherwise it tries to parse rest of the lines coming after }

dock:
  type: topic
  interface_type: std_msgs/msg/Empty
  topic_name: dock 
  deadman_buttons: [3]  # X button
  message_value: []