Caesar.jl icon indicating copy to clipboard operation
Caesar.jl copied to clipboard

update ROS1 docs on bag reader and writer not needing roscore, but live traffic does

Open dehann opened this issue 3 years ago • 2 comments

update to docs page to clarify when and when not roscore is necessary. https://juliarobotics.org/Caesar.jl/latest/examples/using_ros/

RosbagReader and RosbagWriter do not need roscore to be running per se. Live traffic pub sub does need roscore running.

Extra info, likely also has something to do with initnode() call.

dehann avatar Sep 18 '22 21:09 dehann

HI @Affie , could you link perhaps the Python script you've been using please? The one that can read bag files but does not need the rest of ROS...

dehann avatar Mar 27 '23 17:03 dehann

using PyCall
py"""
# needs rosbags installed in python `pip install rosbags`
from rosbags.rosbag1 import Reader
from rosbags.serde import deserialize_ros1, deserialize_cdr, ros1_to_cdr
"""
#setup the rosbag reader 
reader = py"filename.bag')"
# open rosbag
reader.open()
# list of topics
topics = reader.topics
# reading like this
for (connection, timestamp, rawdata) in reader.messages()
    msg = py"deserialize_ros1($(Vector{UInt8}(rawdata)),$(connection[3]))"
    @show msg
    #do something with msg
end

Affie avatar Mar 27 '23 19:03 Affie