[ros-users] rosmsg and rossrv prototype

Felix Kolbe Felix.Kolbe at informatik.haw-hamburg.de
Tue Nov 1 13:37:20 UTC 2011

I would like to vote for it!
Not using rostopic pub every day, I'm confused about lists and tupels and such.

Maybe this can be done without adding another subcommand. If one types:
"rostopic pub /cmd_vel" (as you should know the topic)
and presses either tab, enter or temporarily add "-h" or similar, the
prototype could be shown, so that it can be inserted without modifying
the beginning of line.


2011/11/1 Thibault Kruse <kruset at in.tum.de>:
> 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
> _______________________________________________
> ros-users mailing list
> ros-users at code.ros.org
> https://code.ros.org/mailman/listinfo/ros-users

More information about the ros-users mailing list