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

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

thebrian-2025.3.1-py3-none-any.whl (6.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: thebrian-2025.3.1.tar.gz
  • Upload date:
  • Size: 4.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.5 CPython/3.13.0 Darwin/24.3.0

File hashes

Hashes for thebrian-2025.3.1.tar.gz
Algorithm Hash digest
SHA256 c94ca415ae9479749bd672de1c1f526ce6913f4e0f4959de79d15b18a74533e5
MD5 5a1cd5d24232193cd2a08c2b48e4046a
BLAKE2b-256 b4d9f831ad639319493960539f079195896a17c247898eaf57f56a8d703f5e1d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: thebrian-2025.3.1-py3-none-any.whl
  • Upload date:
  • Size: 6.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.5 CPython/3.13.0 Darwin/24.3.0

File hashes

Hashes for thebrian-2025.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 21e7984b8e2f3dfadf75b2dc3b148cbb857788669e8911deb5c0c841e5f3df15
MD5 12e015f917a2640907800bd54aa29f3b
BLAKE2b-256 dda2f829702c0482fb856981fa9903cd659523171998e9ae4e363ea0a27cd965

See more details on using hashes here.

Supported by

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