lethal233 / autoware_record

Autoware ROS bag file (sqlite) parser tool

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

autoware_record

autoware_record is an Autoware ROS bag record file (in sqlite) offline parse tool. You can use autoware_record to read messages from record file.

os support remark
ubuntu ✔️
mac
windows

Quick start

Dependencies

How to use

First clone "autoware_record" to your project:

git clone https://github.com/lethal233/autoware_record.git

Demo record

You can download a Autoware demo record from sample-rosbag.zip

Command line mode

NOTE: NOT Supported for now

Python API

You can use autoware_record in the python file by importing

from autoware_record.record import Record

Examples

Below are some examples to help you read and write messages from record files.

1. Read messages

You can read messages directly from the record file in the following ways.

from autoware_record.record import Record
record_file_path = "~/Downloads/sample-rosbag/"
record = Record(record_file_path)
for topic, message, t in record.read_messages():
    print("{}, {}, {}".format(topic, type(message), t))

The following is the output log of the program

/clock, <class 'rosgraph_msgs.msg._clock.Clock'>, 1614315746338218272
/sensing/imu/tamagawa/imu_raw, <class 'sensor_msgs.msg._imu.Imu'>, 1614315746340263903
/clock, <class 'rosgraph_msgs.msg._clock.Clock'>, 1614315746347214625
/vehicle/status/control_mode, <class 'autoware_auto_vehicle_msgs.msg._control_mode_report.ControlModeReport'>, 1614315746348259492
/vehicle/status/gear_status, <class 'autoware_auto_vehicle_msgs.msg._gear_report.GearReport'>, 1614315746348361304
/vehicle/status/steering_status, <class 'autoware_auto_vehicle_msgs.msg._steering_report.SteeringReport'>, 1614315746348408503
/vehicle/status/velocity_status, <class 'autoware_auto_vehicle_msgs.msg._velocity_report.VelocityReport'>, 1614315746348462066
/clock, <class 'rosgraph_msgs.msg._clock.Clock'>, 1614315746357520034

Filter Read

You can also read messages filtered by topics and time. This will improve the speed of parsing messages.

from autoware_record.record import Record
file_name = "~/Downloads/sample-rosbag/"
def read_filter():
    record = Record(file_name)
    for topic, message, t in record.read_messages('/vehicle/status/gear_status',
                                                  start_time=1614315746865701308, end_time=1614315776212543503):
        print("{}, {}, {}".format(topic, type(message), t))

Speed up Read (Recommended)

Since deserialization is a time-consuming operation, you can speed up the reading process by setting the interested_topics parameter.

If the topic is not in the interested_topics, the message will not be deserialized.

if tpc in self.interested_topics:

from autoware_record.record import Record

file_name = "~/Downloads/sample-rosbag/"
interested_topics = ['/vehicle/status/gear_status', '/clock']
record = Record(file_name, interested_topics=interested_topics)
for topic, message, t in record.read_messages():
    print("{}, {}, {}".format(topic, type(message), t))

About

Autoware ROS bag file (sqlite) parser tool

License:Apache License 2.0


Languages

Language:Python 100.0%