ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
1

running rosmsg show from code

asked 2016-12-05 10:31:14 -0500

McKracken82 gravatar image

Hi,

is there a way (possibly in Python) to call the command line command rosmsg show from code, passing as an argument the name of the message/service and getting an object representing the message/the class with the message structure? I know that some commands can be called from rospy (as rostopic list, for example), but I can't find how to run rosmsg.

edit retag flag offensive close merge delete

Comments

What do you really want to achieve? This sounds like an xy-problem

NEngelhard gravatar image NEngelhard  ( 2016-12-05 10:33:47 -0500 )edit

I need to build instances of all the ros messages and services in a KB, so I need to understand which are all the messages/services being published, and which re their structures in terms of submessages/primitive types.

McKracken82 gravatar image McKracken82  ( 2016-12-05 11:22:07 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
3

answered 2016-12-05 11:02:07 -0500

Dirk Thomas gravatar image

The command line tool calls a single function ( https://github.com/ros/ros_comm/blob/... ) which you can call directly in Python.

You could also call any API which is using behind this directly, e.g. rosmsg_cmd_show ( https://github.com/ros/ros_comm/blob/... ).

edit flag offensive delete link more

Comments

Great, that was exactly what I was searching for, although I thought messages were managed in a more object-oriented like structure. Anyway, that worked perfectly. Thanks!

McKracken82 gravatar image McKracken82  ( 2016-12-06 09:03:30 -0500 )edit

Question Tools

2 followers

Stats

Asked: 2016-12-05 10:31:14 -0500

Seen: 450 times

Last updated: Dec 05 '16