Skip to content

Commit

Permalink
fix rosmsg show from bag
Browse files Browse the repository at this point in the history
  • Loading branch information
dirk-thomas committed Mar 24, 2017
1 parent 1246727 commit 0d4d664
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
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

0 comments on commit 0d4d664

Please sign in to comment.