[ros-users] rosmsg and rossrv prototype

Thibault Kruse kruset at in.tum.de
Tue Nov 1 13:01:07 UTC 2011


When using rostopic pub or rosservice call I often find it difficult to 
get the YAML right quickly, and a bit tedious as well.

I therefore implemented a function for
$ rosmsg prototype
$ rossrv prototype

that work similar to rosmsg show and rossrv show, except that yaml is 
returned that can be used for rostopic pub / rosservice call.
$ rosmsg prototype sensor_msgs/PointCloud
"{channels: [{name: '', values: []}], header: {frame_id: '', seq: 0, 
stamp: {nsecs: 0,\
       secs: 0}}, points: [{x: 0.0, y: 0.0, z: 0.0}]}"
$ rossrv prototype gazebo/SetModelConfiguration
"{joint_names: [''], joint_positions: [0.0], model_name: '', 
test_urdf_param_name: ''}"
$ rosmsg prototype tf/tfMessage
"{transforms: [{child_frame_id: '', header: {frame_id: '', seq: 0, 
stamp: {nsecs: 0,\
           secs: 0}}, transform: {rotation: {w: 0.0, x: 0.0, y: 0.0, z: 
0.0}, translation: {\
           x: 0.0, y: 0.0, z: 0.0}}}]}"

The key here was that the output can be copy/pasted as input to rostopic 
and rosservice.

I already made a ticket for that enhancement here:

but given it is an API change I'd first like to know who thinks this 
would be useful. Note that this could then also be used for tab completion.

My other concern is with the code quality of my patch, attached to the 
ticket at:
There are a lot of python introspection and roslib.message and yaml 
dumping bits that seem a bit unelegant to me, but I would not know better.
I marked the spots with TODO comments in the patch.
I'd be happy if python experts on either of those areas would have a 
look at the patch and improve it if possible.
I am not sure whether this overlaps with rosh bagy functionality.

Also it is a bit of a pity that some values are not well initialized, in 
particular Qauternions and header times. If anyone has a great idea of 
how to do this cleanly, that could be great.


More information about the ros-users mailing list