Skip to main content

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.1.3.tar.gz (506.8 kB view details)

Uploaded Source

Built Distribution

record_msg-0.1.3-py3-none-any.whl (775.8 kB view details)

Uploaded Python 3

File details

Details for the file record_msg-0.1.3.tar.gz.

File metadata

  • Download URL: record_msg-0.1.3.tar.gz
  • Upload date:
  • Size: 506.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.7.6

File hashes

Hashes for record_msg-0.1.3.tar.gz
Algorithm Hash digest
SHA256 54d2915d100df51e939878392d53c9d1fb468d2956cd34846fa963b63749983f
MD5 94b950099022edfa18fd65aa49afd8ef
BLAKE2b-256 a7c7671570a2b57edd92fac1d68fcd41f77cdc0d07f17f075a1c1432576e5a35

See more details on using hashes here.

File details

Details for the file record_msg-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: record_msg-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 775.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.7.6

File hashes

Hashes for record_msg-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 fc3e82b97681fa656ec346431b3244130a3dbb04b494a4c3e8db8665ff7631a8
MD5 5c1781628f5b4694334cc21b7e4960d1
BLAKE2b-256 ed800097d3bead5e67e689451c9659e236e6038b7d8b370c990e912ecfa2fd7c

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page