[ros-users] rosmsg and rossrv prototype

Top Page
Attachments:
Message as email
+ (text/plain)
Delete this message
Reply to this message
Author: User discussions
Date:  
To: User discussions
Subject: [ros-users] rosmsg and rossrv prototype
Hi,

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.
Examples:
$ 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:
https://code.ros.org/trac/ros/ticket/3732


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:
https://code.ros.org/trac/ros/attachment/ticket/3732/0002-protoype-command.patch
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.

cheers,
Thibault