Skip to main content

A package to simplify the generation, serialization, and deserialization of COLAV Protobuf messages.

This project has been archived.

The maintainers of this project have marked this project as archived. No new releases are expected.

Project description

colav-protobuf-utils

PyPI - Version PyPI - Python Version

This package simplifies the generation of COLAV Protobuf messages as defined in colav-protobuf, allowing you to work with structured data without needing in-depth knowledge of Protobuf. Simply provide the required data to the relevant functions, and they will return the corresponding Protobuf messages. Additionally, the package includes built-in serialization and deserialization functionality for seamless data handling.


Table of Contents

Installation

pip install colav-protobuf-utils

Structure

The source code in colav_protobuf_utils is organized into the following main directories:

  • Tests: Contains tests that ensure the continued working state of this package as part of the CI/CD workflow.
  • src/colav_protobuf_utils: Contains the package source code.
    • protobuf_generator: Contains several Python functions for simplifying the generation of different colav_protobuf messages. Examples of usage for this package can be found in the Usage section.
    • deserialization: Contains functions that provide abstract deserialization functionality and validation for different colav-protobuf messages.
    • serialization: Contains functions that abstract Protobuf serialization functionality and validate the different colav-protobuf messages.

Usage

Once the package has been installed into your environment, usage is simple.

Imports

# Protobuf generation imports
from colav_protobuf_utils.protobuf_generator import (
    gen_mission_request,  # Mission Request 
    VesselType,
    gen_mission_response,  # Mission Response
    MissionResponseTypeEnum,
    gen_agent_update,  # Agent Update
    gen_obstacles_update,  # Obstacles update
    gen_static_obstacle, 
    StaticObstacleTypeEnum,
    gen_dynamic_obstacle,
    DynamicObstacleTypeEnum,
    gen_controller_feedback,  # Controller Feedback
    CtrlStatus,
    CtrlMode,
)

# Protobuf serialization import
from colav_protobuf_utils.serialization import serialize_protobuf

# Protobuf deserialization import
from colav_protobuf_utils.deserialization import deserialize_protobuf
from colav_protobuf_utils import ProtoType, Stamp

Sample Mission Request Creation

mission_req_proto = gen_mission_request(
    tag="sample_mission_tag",
    stamp=Stamp(sec=int(1010), nanosec(123)),
    vessel_tag="sample_vessel",
    vessel_type=VesselType.VESSEL.value,
    vessel_max_acceleration=2.0,
    vessel_max_deceleration=1.0,
    vessel_max_velocity=30.0,
    vessel_min_velocity=15.0,
    vessel_max_yaw_rate=0.2,
    vessel_loa=2.0,
    vessel_beam=0.5,
    vessel_safety_radius=5.0,
    cartesian_init_position=(30002.0, 2312.0, 10.0),
    cartesian_goal_position=(30402.0, 2000.0, 10.0),
    goal_safety_radius=10
)

Sample Serialization

serialized_msg = serialize_protobuf(mission_req_proto)

Sample Deserialization

deserialized_msg = deserialize_protobuf(serialized_msg, proto_type=ProtoType.MISSION_REQUEST)

License

colav-protobuf-utils is distributed under the terms of the MIT license.

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

colav_protobuf_utils-0.1.4.tar.gz (16.7 kB view details)

Uploaded Source

Built Distribution

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

colav_protobuf_utils-0.1.4-py3-none-any.whl (14.6 kB view details)

Uploaded Python 3

File details

Details for the file colav_protobuf_utils-0.1.4.tar.gz.

File metadata

  • Download URL: colav_protobuf_utils-0.1.4.tar.gz
  • Upload date:
  • Size: 16.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.16

File hashes

Hashes for colav_protobuf_utils-0.1.4.tar.gz
Algorithm Hash digest
SHA256 ef5c98fd9d8f99c6693d94b78ef0e6ab3c9db78b88323c2845d94a53572e6153
MD5 b0467a9ffe173a91843d01409b6cd5d0
BLAKE2b-256 f9644a8ac298580b2c60e4b8b344af3a860099f8a6be55dc8af28cf0046cc51d

See more details on using hashes here.

File details

Details for the file colav_protobuf_utils-0.1.4-py3-none-any.whl.

File metadata

File hashes

Hashes for colav_protobuf_utils-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 dee678998012cf2e3acdec995efe9f3a9ec5da76dbd71d0168ffe19a09c3d243
MD5 af8504299692c717352329f5cfe28207
BLAKE2b-256 aecf95b8bd29bca17e65a9f53b6d252e07072b9abe8b42d4634c886dac4af961

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