@@ -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
5253end
5354RosbagSubscriber (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
104106end
@@ -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)
118120end
0 commit comments