Ask Your Question
0

Show all message types which contain a given msg

asked 2015-11-14 16:55:33 -0500

lucasw gravatar image

updated 2015-11-16 11:22:56 -0500

Is there a way to use rosmsg to query for all messages that contain another msg type?

For instance, I'd like to see all message types which contain a sensor_msgs/Image. (querying services the same thing would also be useful)

Doing a rosmsg show on every message output by rosmsg and grepping it for the type is super slow, probably 10 minutes or more for all the messages.

edit retag flag offensive close merge delete

Comments

1

I've never heard of a function/script for that, but the code for the auto completion for 'rosmsg show' should be able to create a list of msg definitions in which you could just grep. Sounds like a fun python finger exercise.

NEngelhard gravatar imageNEngelhard ( 2015-11-15 10:22:48 -0500 )edit
1

Are you looking for "all" published topics that contain that message type? Or are you looking for messages that contain another message type (the message hierarchy)?

jeremya gravatar imagejeremya ( 2015-11-15 22:15:52 -0500 )edit

@jeremya messages types, I updated the question to reflect that.

lucasw gravatar imagelucasw ( 2015-11-16 11:13:43 -0500 )edit

1 Answer

Sort by » oldest newest most voted
1

answered 2015-11-17 05:14:51 -0500

updated 2015-11-21 06:05:37 -0500

lucasw gravatar image

This can be a good start:

 grep -R --include \*.msg --include \*.srv "sensor_msgs/Image" $(echo $ROS_PACKAGE_PATH | sed 's/:/ /g')

Maybe a recursive call to grep is necessary, so you could find message types that use Image indirectly. But in my case this can be done manually, because I get just one result (and 2 comments):

/opt/ros/indigo/share/polled_camera/srv/GetPolledImage.srv:                      # against incoming sensor_msgs/Image header.
/opt/ros/indigo/share/stereo_msgs/msg/DisparityImage.msg:sensor_msgs/Image image
/opt/ros/indigo/share/theora_image_transport/msg/Packet.msg:Header header     # Original sensor_msgs/Image header

To exclude the comments:

 grep -R --include \*.msg --include \*.srv "^sensor_msgs/Image" $(echo $ROS_PACKAGE_PATH | sed 's/:/ /g')
edit flag offensive delete link more

Comments

1

Cool! I've edited your answer to search the entire ROS_PACKAGE_PATH

lucasw gravatar imagelucasw ( 2015-11-21 06:05:23 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

2 followers

Stats

Asked: 2015-11-14 16:55:33 -0500

Seen: 133 times

Last updated: Nov 21 '15