Skip to content

Commit a2be1fd

Browse files
committed
rm bag compress kwargs
1 parent 78c37a3 commit a2be1fd

2 files changed

Lines changed: 8 additions & 6 deletions

File tree

src/ros/Utils/RosbagSubscriber.jl

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,15 @@ mutable struct RosbagSubscriber
4848
syncBuffer::Dict{Symbol,Tuple{DateTime, Int}} # t,ns,msgdata
4949
nextMsgChl::Symbol
5050
nextMsgTimestamp::Tuple{DateTime, Int}
51+
compression::Any
5152
# constructors
5253
end
5354
RosbagSubscriber(bagfile::AbstractString;
55+
compression=nothing,
5456
channels::Vector{Symbol}=Symbol[],
5557
callbacks::Dict{Symbol,Function}=Dict{Symbol,Function}(),
5658
readers::Dict{Symbol,PyObject}=Dict{Symbol,PyObject}(),
57-
syncBuffer::Dict{Symbol,Tuple{DateTime, Int}}=Dict{Symbol,Tuple{DateTime, Int}}() ) = RosbagSubscriber(bagfile,channels,callbacks,readers,syncBuffer, :null, (unix2datetime(0),0))
59+
syncBuffer::Dict{Symbol,Tuple{DateTime, Int}}=Dict{Symbol,Tuple{DateTime, Int}}() ) = RosbagSubscriber(bagfile,channels,callbacks,readers,syncBuffer, :null, (unix2datetime(0),0),compression)
5860
#
5961

6062
# loss of accuracy (Julia only Millisecond)
@@ -97,8 +99,8 @@ function loop!(rbs::RosbagSubscriber, args...)
9799
rbs.callbacks[rbs.nextMsgChl](msg, args...)
98100
true
99101
else
100-
println("false, dont know how to handle message time as typeof(msgT)=$(typeof(msgT))")
101-
@show msg
102+
@warn "false, dont know how to handle message" rbs.nextMsgChl msgT maxlog=10
103+
# @show msg
102104
false
103105
end
104106
end
@@ -114,5 +116,5 @@ function (rbs::RosbagSubscriber)( chl::AbstractString,
114116
# include the type converter, see ref: https://github.com/jdlangs/RobotOS.jl/blob/21a7088461a21bc9b24cd2763254d5043d5b1800/src/callbacks.jl#L23
115117
rbs.callbacks[cn] = (m)->callback(convert(MT,m[2]),args...)
116118
rbs.syncBuffer[cn] = (unix2datetime(0), 0)
117-
rbs.readers[cn] = RosbagParser(rbs.bagfile, chl)
119+
rbs.readers[cn] = RosbagParser(rbs.bagfile, chl) #; rbs.compression)
118120
end

src/ros/Utils/rosbagReader.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@
66
import sys
77

88
class RosbagParser:
9-
def __init__(self, bag_file_name, topic_name):
9+
def __init__(self, bag_file_name, topic_name): #, compression=None):
1010
#bag_file_name = sys.argv[1]
1111
#topic_name = sys.argv[2]
1212

13-
self.bag = rosbag.Bag(bag_file_name)
13+
self.bag = rosbag.Bag(bag_file_name, 'r') #, compression=compression)
1414
self.bag_contents = self.bag.read_messages(topics=[topic_name])
1515

1616
self.idx = 0

0 commit comments

Comments
 (0)