Skip to main content

mcap utils

Project description

Protobuf and MCAP Testing

Linux

apt install -y protobuf-compiler

macOS

brew install protobuf
brew install mcap
pip install -U protobuf mcap mcap-protobuf-support foxglove-schemas-protobuf

Generate Python Protobuf Messages

protoc protoc --python_out=gen proto/simple_msg.proto

Foxglove Protobuf

from mcap_protobuf.writer import Writer

Writer.write_message(
    topic: str,
    message: Any,
    log_time: int | None = None,
    publish_time: int | None = None,
    sequence: int = 0)[source]

Writes a message to an MCAP file.

Parameters:

  • topic: the topic that this message was originally published on.

  • message: a Protobuf object to write into the MCAP.

  • log_time: unix nanosecond timestamp of when this message was written to the MCAP.

  • publish_time: unix nanosecond timestamp of when this message was originally published.

  • sequence: an optional sequence count for messages on this topic.

  • schemas

    • CameraCalibration
    • CompressedImage
    • CompressedVideo
    • FrameTransform[s]
    • GeoJSON
    • LaserScan
    • LocationFix
    • Log
    • Pose[InFrame[s]]
    • Quaternion
    • RawImage
    • Vector3
    • more ...
syntax = "proto3";

import "google/protobuf/timestamp.proto";

package foxglove;

// A raw image
message RawImage {
  // Timestamp of image
  google.protobuf.Timestamp timestamp = 1;

  // Frame of reference for the image. The origin of the frame
  // is the optical center of the camera. +x points to the right
  // in the image, +y points down, and +z points into the plane
  // of the image.
  string frame_id = 7;

  // Image width
  fixed32 width = 2;

  // Image height
  fixed32 height = 3;

  // Encoding of the raw image data
  //
  // Supported values: `8UC1`, `8UC3`, `16UC1` (little endian),
  // `32FC1` (little endian), `bayer_bggr8`, `bayer_gbrg8`,
  // `bayer_grbg8`, `bayer_rggb8`, `bgr8`, `bgra8`, `mono8`,
  // `mono16`, `rgb8`, `rgba8`, `uyvy` or `yuv422`, `yuyv` or
  // `yuv422_yuy2`
  string encoding = 4;

  // Byte length of a single row
  fixed32 step = 5;

  // Raw image data
  bytes data = 6;
}
syntax = "proto3";

import "google/protobuf/timestamp.proto";

package foxglove;

// A compressed image
message CompressedImage {
  // Timestamp of image
  google.protobuf.Timestamp timestamp = 1;

  // Frame of reference for the image. The origin of the frame is the
  // optical center of the camera. +x points to the right in the image,
  // +y points down, and +z points into the plane of the image.
  string frame_id = 4;

  // Compressed image data
  bytes data = 2;

  // Image format
  //
  // Supported values: image media types supported by Chrome, such as
  // `webp`, `jpeg`, `png`
  string format = 3;
}
syntax = "proto3";

import "foxglove/Pose.proto";
import "google/protobuf/timestamp.proto";

package foxglove;

// A single scan from a planar laser range-finder
message LaserScan {
  // Timestamp of scan
  google.protobuf.Timestamp timestamp = 1;

  // Frame of reference
  string frame_id = 2;

  // Origin of scan relative to frame of reference; points are positioned
  // in the x-y plane relative to this origin; angles are interpreted as
  // counterclockwise rotations around the z axis with 0 rad being in the +x
  // direction
  foxglove.Pose pose = 3;

  // Bearing of first point, in radians
  double start_angle = 4;

  // Bearing of last point, in radians
  double end_angle = 5;

  // Distance of detections from origin; assumed to be at equally-spaced angles
  // between `start_angle` and `end_angle`
  repeated double ranges = 6;

  // Intensity of detections
  repeated double intensities = 7;
}

MIT License

Copyright (c) 2024 Mom's Friendly Robot Company

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

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

thebrian-2024.9.8.tar.gz (4.0 kB view details)

Uploaded Source

Built Distribution

thebrian-2024.9.8-py3-none-any.whl (4.9 kB view details)

Uploaded Python 3

File details

Details for the file thebrian-2024.9.8.tar.gz.

File metadata

  • Download URL: thebrian-2024.9.8.tar.gz
  • Upload date:
  • Size: 4.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.12.5 Darwin/21.6.0

File hashes

Hashes for thebrian-2024.9.8.tar.gz
Algorithm Hash digest
SHA256 dec34ae5e8fd3c60000661924b20355f79869fadda4904e7ab47584bbfbd5c35
MD5 f6beea4c711cb113b94ff666bba3a69a
BLAKE2b-256 c903e1c47669bb03cc5718309d59576844e82dabd3dfc5937883df24f8d47bd5

See more details on using hashes here.

File details

Details for the file thebrian-2024.9.8-py3-none-any.whl.

File metadata

  • Download URL: thebrian-2024.9.8-py3-none-any.whl
  • Upload date:
  • Size: 4.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.12.5 Darwin/21.6.0

File hashes

Hashes for thebrian-2024.9.8-py3-none-any.whl
Algorithm Hash digest
SHA256 29880499417860e5eca021c376a09bd30ba85bcfb40a5d8c06efbe04f5e353bf
MD5 17dfaf1395bd5c41b07fdce07c15acdb
BLAKE2b-256 03f91af8b80868184fd7e83d76e67b42dcc433bee5f74c8b44ed7b010fb9e43d

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