[ros-users] Easily pulling in time-histories from bagfiles

Ken Conley kwc at willowgarage.com
Fri May 14 22:43:55 UTC 2010


And one more partial solution is to use "rostopic echo -p -b
bag_file.bag /topic", which will echo in a CSV format that is
matlab/octave friendly.

 - Ken

On Fri, May 14, 2010 at 3:37 PM, Tim Field <tfield at willowgarage.com> wrote:
> Hi Pat,
>
> There aren't any tools, but it's pretty easy to do with rosrecord:
>
> [(t, msg.var1) for topic, msg, t in
> rosrecord.logplayer('/path/to/some/bagfile.bag') if topic ==
> '/important_topic']
>
>
> Hope that helps,
> Tim
>
> On Fri, May 14, 2010 at 3:15 PM, Patrick Bouffard
> <bouffard at eecs.berkeley.edu> wrote:
>>
>> Are there tools in existence that allow one to easily grab any given
>> variable out of a bagfile, in Python (ideally) or Matlab (if push
>> comes to shove)? I'd like to be able to do something like the
>> following pseudo-python-code:
>>
>> from awesome_plotting_package import plot
>> from super_bagfile_package import BagFile
>> mybag = BagFile('/path/to/some/bagfile.bag')
>> (t_important_var1, important_var1) = mybag.get('/important_topic/var1')
>> plot(t_important_var1, important_var1)
>>
>>
>> ... and this would give me a plot of my important variable vs. time.
>> This would assume important_var1 is of a numeric type like float64,
>> and I as the user would probably need to do special processing to
>> parse other types like arrays, but that would be pretty
>> straightforward.
>>
>> Does something similar to the above exist? If not, I'll try to put
>> something together and share it.
>>
>> Cheers,
>> Pat
>> _______________________________________________
>> ros-users mailing list
>> ros-users at code.ros.org
>> https://code.ros.org/mailman/listinfo/ros-users
>
>
> _______________________________________________
> ros-users mailing list
> ros-users at code.ros.org
> https://code.ros.org/mailman/listinfo/ros-users
>
>



More information about the ros-users mailing list