ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
Here is my first attempt on Python code.
The recompose.py
script allows to take a message of any(?) complexity and generate another message based on given format. The format of new message is specified by YAML string, where the values of elements are the paths (delimited by /
) to a data in input message.
The most valuable use case for myself is to take a complex message like gazebo_msgs/ContactsState and combine geometry_msgs/WrenchStamped. Main problem here is that we need both std_msgs/Header
and geometry_msgs/Wrench
to be combined in a new message. However these fields are spread across the ContactsState
.
So, this issue can be solve with the provided script as follows:
rostopic echo /gazebo_bumper | recompose.py "{header: header, wrench: 'states[0]/total_wrench'}"
Maybe I'm reinventing a wheel, but I was unable to find a ready to use solution so far.
Hope it can be useful for others.
2 | No.2 Revision |
Here is my first attempt on Python code.
The recompose.py
script allows to take a message of any(?) complexity and generate another message based on given format. The format of new message is specified by YAML string, where the values of elements are the paths (delimited by /
) to a data in input message.
The most valuable use case for myself is to take a complex message like gazebo_msgs/ContactsState and combine geometry_msgs/WrenchStamped. Main problem here is that we need both std_msgs/Header
and geometry_msgs/Wrench
to be combined in a new message. However these fields are spread across the ContactsState
.
So, this issue can be solve with the provided script as follows:
rostopic echo /gazebo_bumper | recompose.py "{header: header, wrench: 'states[0]/total_wrench'}"
Maybe I'm reinventing a the wheel, but I was unable to find a ready to use solution so far.
Hope it can be useful for others.