ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
You can use a really nice package called rospy_message_converter
:
Converts between Python dictionaries and JSON to ROS messages.
from there:
https://github.com/uos/rospy_message_converter
The main author is also very active on ROS Answers! :)
2 | No.2 Revision |
You can use a really nice package called rospy_message_converter
:
Converts between Python dictionaries and JSON to ROS messages.
from there:
https://github.com/uos/rospy_message_converter
From the documentation:
Convert a dictionary to a ROS message
from rospy_message_converter import message_converter from std_msgs.msg import String dictionary = { 'data': 'Howdy' } message = message_converter.convert_dictionary_to_ros_message('std_msgs/String', dictionary)
Convert a ROS message to a dictionary
from rospy_message_converter import message_converter from std_msgs.msg import String message = String(data = 'Howdy') dictionary = message_converter.convert_ros_message_to_dictionary(message)
P.S.
The main author is also very active on ROS Answers! :) :)