Ask Your Question
0

Error while writing from bag file to csv

asked 2012-08-12 23:51:14 -0500

apalomer gravatar image

updated 2012-08-13 00:31:28 -0500

Hi all!

I'm trying to extract data from a bag file and save it into a csv. For this I've been using:

rostopic echo -p --nosstr --noarr -b bagfile.bag /topic > name.csv

But now I also want to filter the data before storing it into the csv file. I've checked rostopic echo and found that it has a filter command. I've tried to use it:

rostopic echo --filter "m.header.stamp.secs>=1342763900 and m.header.stamp.secs<=1342763990" -p --nosstr --noarr -b bagfile.bag /topic > name.csv

And got this error:

Traceback (most recent call last):
  File "/opt/ros/electric/ros/bin/rostopic", line 45, in <module>
    rostopic.rostopicmain()
  File "/opt/ros/electric/stacks/ros_comm/tools/rostopic/src/rostopic.py", line 1696, in rostopicmain
    _rostopic_cmd_echo(argv)
  File "/opt/ros/electric/stacks/ros_comm/tools/rostopic/src/rostopic.py", line 1041, in _rostopic_cmd_echo
    _rostopic_echo(topic, callback_echo, bag_file=options.bag)
  File "/opt/ros/electric/stacks/ros_comm/tools/rostopic/src/rostopic.py", line 689, in _rostopic_echo
    _rostopic_echo_bag(callback_echo, bag_file)
  File "/opt/ros/electric/stacks/ros_comm/tools/rostopic/src/rostopic.py", line 670, in _rostopic_echo_bag
    callback_echo.callback(msg, t, current_time=timestamp)
  File "/opt/ros/electric/stacks/ros_comm/tools/rostopic/src/rostopic.py", line 577, in callback
    if self.filter_fn is not None and not self.filter_fn(data):
  File "/opt/ros/electric/stacks/ros_comm/tools/rostopic/src/rostopic.py", line 967, in eval_fn
    return eval(expr)
  File "<string>", line 1, in <module>
AttributeError: '_std_msgs__String' object has no attribute 'header'

But if instead of trying to save the data to a csv I just do the rostopic echo with the filter while a rosbag play is publishing the messages I have no problem.

Can somebody help please??

Cheers!

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2012-08-13 06:25:05 -0500

joq gravatar image

That sounds like a bug to me.

Probably the best solution is to open a defect ticket, to be sure the rosbag maintainers see it.

edit flag offensive delete link more

Your Answer

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

Add Answer

Question Tools

1 follower

Stats

Asked: 2012-08-12 23:51:14 -0500

Seen: 385 times

Last updated: Aug 13 '12