thebrian


Namethebrian JSON
Version 2024.9.8 PyPI version JSON
download
home_pagehttps://pypi.org/project/thebrian/
Summarymcap utils
upload_time2024-09-09 00:59:53
maintainerNone
docs_urlNone
authorwalchko
requires_python>=3.9
licenseMIT
keywords mcap
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            ![](docs/brian.webp)

# Protobuf and MCAP Testing

## Linux

```bash
apt install -y protobuf-compiler
```

## macOS

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

## Generate Python Protobuf Messages

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

## Foxglove Protobuf

```python
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](https://github.com/foxglove/schemas/tree/main/schemas/proto/foxglove)
    - CameraCalibration
    - CompressedImage
    - CompressedVideo
    - FrameTransform[s]
    - GeoJSON
    - LaserScan
    - LocationFix
    - Log
    - Pose[InFrame[s]]
    - Quaternion
    - RawImage
    - Vector3
    - more ...

```protobuf
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;
}
```

```protobuf
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;
}
```

```protobuf
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.

            

Raw data

            {
    "_id": null,
    "home_page": "https://pypi.org/project/thebrian/",
    "name": "thebrian",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": null,
    "keywords": "mcap",
    "author": "walchko",
    "author_email": "walchko@users.noreply.github.com",
    "download_url": "https://files.pythonhosted.org/packages/c9/03/e1c47669bb03cc5718309d59576844e82dabd3dfc5937883df24f8d47bd5/thebrian-2024.9.8.tar.gz",
    "platform": null,
    "description": "![](docs/brian.webp)\n\n# Protobuf and MCAP Testing\n\n## Linux\n\n```bash\napt install -y protobuf-compiler\n```\n\n## macOS\n\n```bash\nbrew install protobuf\nbrew install mcap\npip install -U protobuf mcap mcap-protobuf-support foxglove-schemas-protobuf\n```\n\n## Generate Python Protobuf Messages\n\n```bash\nprotoc protoc --python_out=gen proto/simple_msg.proto\n```\n\n## Foxglove Protobuf\n\n```python\nfrom mcap_protobuf.writer import Writer\n\nWriter.write_message(\n    topic: str,\n    message: Any,\n    log_time: int | None = None,\n    publish_time: int | None = None,\n    sequence: int = 0)[source]\n```\n\nWrites a message to an MCAP file.\n\nParameters:\n- **topic:** the topic that this message was originally published on.\n- **message:** a Protobuf object to write into the MCAP.\n- **log_time:** unix nanosecond timestamp of when this message was written to the MCAP.\n- **publish_time:** unix nanosecond timestamp of when this message was originally published.\n- **sequence:** an optional sequence count for messages on this topic.\n\n\n- [schemas](https://github.com/foxglove/schemas/tree/main/schemas/proto/foxglove)\n    - CameraCalibration\n    - CompressedImage\n    - CompressedVideo\n    - FrameTransform[s]\n    - GeoJSON\n    - LaserScan\n    - LocationFix\n    - Log\n    - Pose[InFrame[s]]\n    - Quaternion\n    - RawImage\n    - Vector3\n    - more ...\n\n```protobuf\nsyntax = \"proto3\";\n\nimport \"google/protobuf/timestamp.proto\";\n\npackage foxglove;\n\n// A raw image\nmessage RawImage {\n  // Timestamp of image\n  google.protobuf.Timestamp timestamp = 1;\n\n  // Frame of reference for the image. The origin of the frame\n  // is the optical center of the camera. +x points to the right\n  // in the image, +y points down, and +z points into the plane\n  // of the image.\n  string frame_id = 7;\n\n  // Image width\n  fixed32 width = 2;\n\n  // Image height\n  fixed32 height = 3;\n\n  // Encoding of the raw image data\n  //\n  // Supported values: `8UC1`, `8UC3`, `16UC1` (little endian),\n  // `32FC1` (little endian), `bayer_bggr8`, `bayer_gbrg8`,\n  // `bayer_grbg8`, `bayer_rggb8`, `bgr8`, `bgra8`, `mono8`,\n  // `mono16`, `rgb8`, `rgba8`, `uyvy` or `yuv422`, `yuyv` or\n  // `yuv422_yuy2`\n  string encoding = 4;\n\n  // Byte length of a single row\n  fixed32 step = 5;\n\n  // Raw image data\n  bytes data = 6;\n}\n```\n\n```protobuf\nsyntax = \"proto3\";\n\nimport \"google/protobuf/timestamp.proto\";\n\npackage foxglove;\n\n// A compressed image\nmessage CompressedImage {\n  // Timestamp of image\n  google.protobuf.Timestamp timestamp = 1;\n\n  // Frame of reference for the image. The origin of the frame is the\n  // optical center of the camera. +x points to the right in the image,\n  // +y points down, and +z points into the plane of the image.\n  string frame_id = 4;\n\n  // Compressed image data\n  bytes data = 2;\n\n  // Image format\n  //\n  // Supported values: image media types supported by Chrome, such as\n  // `webp`, `jpeg`, `png`\n  string format = 3;\n}\n```\n\n```protobuf\nsyntax = \"proto3\";\n\nimport \"foxglove/Pose.proto\";\nimport \"google/protobuf/timestamp.proto\";\n\npackage foxglove;\n\n// A single scan from a planar laser range-finder\nmessage LaserScan {\n  // Timestamp of scan\n  google.protobuf.Timestamp timestamp = 1;\n\n  // Frame of reference\n  string frame_id = 2;\n\n  // Origin of scan relative to frame of reference; points are positioned\n  // in the x-y plane relative to this origin; angles are interpreted as\n  // counterclockwise rotations around the z axis with 0 rad being in the +x\n  // direction\n  foxglove.Pose pose = 3;\n\n  // Bearing of first point, in radians\n  double start_angle = 4;\n\n  // Bearing of last point, in radians\n  double end_angle = 5;\n\n  // Distance of detections from origin; assumed to be at equally-spaced angles\n  // between `start_angle` and `end_angle`\n  repeated double ranges = 6;\n\n  // Intensity of detections\n  repeated double intensities = 7;\n}\n```\n\n# MIT License\n\n**Copyright (c) 2024 Mom's Friendly Robot Company**\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "mcap utils",
    "version": "2024.9.8",
    "project_urls": {
        "Homepage": "https://pypi.org/project/thebrian/",
        "Repository": "http://github.com/MomsFriendlyRobotCompany/mcap-protobuf"
    },
    "split_keywords": [
        "mcap"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "03f91af8b80868184fd7e83d76e67b42dcc433bee5f74c8b44ed7b010fb9e43d",
                "md5": "17dfaf1395bd5c41b07fdce07c15acdb",
                "sha256": "29880499417860e5eca021c376a09bd30ba85bcfb40a5d8c06efbe04f5e353bf"
            },
            "downloads": -1,
            "filename": "thebrian-2024.9.8-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "17dfaf1395bd5c41b07fdce07c15acdb",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 4904,
            "upload_time": "2024-09-09T00:59:51",
            "upload_time_iso_8601": "2024-09-09T00:59:51.848742Z",
            "url": "https://files.pythonhosted.org/packages/03/f9/1af8b80868184fd7e83d76e67b42dcc433bee5f74c8b44ed7b010fb9e43d/thebrian-2024.9.8-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "c903e1c47669bb03cc5718309d59576844e82dabd3dfc5937883df24f8d47bd5",
                "md5": "f6beea4c711cb113b94ff666bba3a69a",
                "sha256": "dec34ae5e8fd3c60000661924b20355f79869fadda4904e7ab47584bbfbd5c35"
            },
            "downloads": -1,
            "filename": "thebrian-2024.9.8.tar.gz",
            "has_sig": false,
            "md5_digest": "f6beea4c711cb113b94ff666bba3a69a",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 4003,
            "upload_time": "2024-09-09T00:59:53",
            "upload_time_iso_8601": "2024-09-09T00:59:53.409631Z",
            "url": "https://files.pythonhosted.org/packages/c9/03/e1c47669bb03cc5718309d59576844e82dabd3dfc5937883df24f8d47bd5/thebrian-2024.9.8.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-09-09 00:59:53",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "MomsFriendlyRobotCompany",
    "github_project": "mcap-protobuf",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "thebrian"
}
        
Elapsed time: 0.41727s