Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix rosmsg show from bag #1006

Merged
merged 1 commit into from
May 22, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions tools/rosmsg/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

<run_depend version_gte="0.6.4">catkin</run_depend>
<run_depend>genmsg</run_depend>
<run_depend version_gte="0.6.5">genpy</run_depend>
<run_depend>python-rospkg</run_depend>
<run_depend>rosbag</run_depend>
<run_depend>roslib</run_depend>
Expand Down
10 changes: 9 additions & 1 deletion tools/rosmsg/src/rosmsg/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@

import rospkg
import genmsg
from genpy.dynamic import generate_dynamic

import roslib.message
import rosbag
Expand Down Expand Up @@ -603,7 +604,14 @@ def rosmsg_cmd_show(mode, full, alias='show'):
for topic, msg, t in rosbag.Bag(bag_file).read_messages(raw=True):
datatype, _, _, _, pytype = msg
if datatype == arg:
print(get_msg_text(datatype, options.raw, pytype._full_text))
if options.raw:
print(pytype._full_text)
else:
context = genmsg.MsgContext.create_default()
msgs = generate_dynamic(datatype, pytype._full_text)
for t, msg in msgs.items():
context.register(t, msg._spec)
print(spec_to_str(context, msgs[datatype]._spec))
break
else:
rospack = rospkg.RosPack()
Expand Down