Record message parse helper function
Project description
record_msg
record message parse helper function. It needs to be used in combination with cyber_record
Parser record
First read the record file through cyber_record
, then record_msg
provides 3 interfaces to help parsing cyber record file.
csv format
you can use to_csv
to format objects so that they can be easily saved in csv format.
import csv
from record_msg.parser import to_csv
f = open("message.csv", 'w')
writer = csv.writer(f)
def parse_pose(pose):
'''
save pose to csv file
'''
line = to_csv([pose.header.timestamp_sec, pose.pose])
writer.writerow(line)
f.close()
image
you can use ImageParser
to parse and save images in output_path
.
from record_msg.parser import ImageParser
image_parser = ImageParser(output_path='../test')
for topic, message, t in record.read_messages():
if topic == "/apollo/sensor/camera/front_6mm/image":
image_parser.parse(message)
# or use timestamp as image file name
# image_parser.parse(image, t)
lidar
you can use PointCloudParser
to parse and save pointclouds in output_path
.
from record_msg.parser import PointCloudParser
pointcloud_parser = PointCloudParser('../test')
for topic, message, t in record.read_messages():
if topic == "/apollo/sensor/lidar32/compensator/PointCloud2":
pointcloud_parser.parse(message)
# other modes, default is 'ascii'
# pointcloud_parser.parse(message, mode='binary')
# pointcloud_parser.parse(message, mode='binary_compressed')
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
record_msg-0.0.8.tar.gz
(492.8 kB
view hashes)
Built Distribution
record_msg-0.0.8-py3-none-any.whl
(755.9 kB
view hashes)
Close
Hashes for record_msg-0.0.8-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 28da5e7e57eab9c7fedacc4ead843d8fa8df48de3b2f28fa390f8e269f1aadf0 |
|
MD5 | b8de267fb5e319dc73be5432acd4d2b6 |
|
BLAKE2b-256 | a4ef7327c2f72837de9a503f06840d5cd29d5e05e402de5e2fb242496d624e5a |