JuliaRobotics / Caesar.jl

Robust robotic localization and mapping, together with NavAbility(TM). Reach out to info@wherewhen.ai for help.
https://www.wherewhen.ai
MIT License
184 stars 31 forks source link

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

Open dehann opened 1 year ago

dehann commented 1 year ago

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 commented 1 year ago

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...

Affie commented 1 year ago
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