Skip to main content
Archived

This project has been archived by its maintainers, and is no longer receiving any updates.

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.

Metadata

Release files for colav-protobuf-utils 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for colav-protobuf-utils 0.2.0
File Size Uploaded
colav_protobuf_utils-0.2.0.tar.gz 18.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for colav-protobuf-utils 0.2.0
File Interpreter ABI Platform
colav_protobuf_utils-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 36.3 kB

Release files / colav_protobuf_utils-0.2.0.tar.gz

Download URL colav_protobuf_utils-0.2.0.tar.gz
Size 18.7 kB
Tags Source
SHA-256 checksum
How to use checksums
c6335a106e2cb01b427784213f953bb2533ef0cb68f7b8c502abe9af8a6d7a11
BLAKE2b-256 checksum
How to use checksums
5bac3eced0006526e8e6dd6ce75230bccd574891df47cb92858328140883901a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.10.17

Release files / colav_protobuf_utils-0.2.0-py3-none-any.whl

Download URL colav_protobuf_utils-0.2.0-py3-none-any.whl
Size 17.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
27dafdae8aadb115d50b10365a7f4e320f6d803ab554d389130594d5b34f82bf
BLAKE2b-256 checksum
How to use checksums
ffee870625b5a2085b668ee804b791095769293658fb4a2e6e89bb0e6dd17da0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.10.17
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page