Skip to main content

Python parser for ROS message definitions and Foxglove message path syntax

Project description

ROS Parser

A Python parser for ROS message definitions and Foxglove message path syntax.

Installation

uv add ros-parser

Parsers

  • ros1_msg: Parses ROS1 message definition files (.msg)
  • ros2_msg: Parses ROS2 message definition files (.msg)
  • message_path: Parses Foxglove message path syntax for data access and filtering

Usage

Parsing ROS2 Messages

from ros_parser import ros2_msg

definition = ros2_msg.parse_message_string("""
float64 x
float64 y
float64 z
""")

for field in definition.fields:
    print(f"{field.name}: {field.type}")

Parsing ROS1 Messages

from ros_parser import ros1_msg

definition = ros1_msg.parse_message_string("""
Header header
float64 x
float64 y
float64 z
""")

for field in definition.fields:
    print(f"{field.name}: {field.type}")

Parsing Schema with Dependencies

from ros_parser import parse_schema_to_definitions

# Parse a full schema including embedded type definitions
definitions = parse_schema_to_definitions(
    "geometry_msgs/msg/Pose",
    schema_data
)

Regenerating Standalone Parsers

The project uses Lark to generate standalone parsers from grammar files. If you modify any .lark grammar file, regenerate the parsers:

uv run _generate_standalone.py \
  src/ros_parser/ros1_msg/grammar.lark \
  src/ros_parser/ros2_msg/grammar.lark \
  src/ros_parser/message_path/grammar.lark \
  --output-dir src/ros_parser \
  --lexer contextual

For more details on the message path syntax, see src/ros_parser/message_path/README.md.

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

ros_parser-0.3.0.tar.gz (72.0 kB view details)

Uploaded Source

Built Distribution

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

ros_parser-0.3.0-py3-none-any.whl (79.4 kB view details)

Uploaded Python 3

File details

Details for the file ros_parser-0.3.0.tar.gz.

File metadata

  • Download URL: ros_parser-0.3.0.tar.gz
  • Upload date:
  • Size: 72.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.10.12 {"installer":{"name":"uv","version":"0.10.12","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for ros_parser-0.3.0.tar.gz
Algorithm Hash digest
SHA256 6fbbb4ddf5d2fc294219e3489b73f42d5361d7ef0011d4e3bf4233870b14e476
MD5 08a148434f15dbc57c413324d6c0b724
BLAKE2b-256 4e0e51a54d5fef92e0b8a703fe705410b8fef9c245617fcf54e25e6e7ddd1753

See more details on using hashes here.

File details

Details for the file ros_parser-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: ros_parser-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 79.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.10.12 {"installer":{"name":"uv","version":"0.10.12","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for ros_parser-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c3ca362141334f06a46dbb2efddbd579f2e6496a41abc7021a8d8d8bac02d9d8
MD5 e8bc0399caa7d8269f669b9106da8ffd
BLAKE2b-256 9f1bc8298357bbd536713c6f3f623e86c9f7b0fd0d0583dee2aa36e0f80daae2

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