Skip to main content

rosmsg_dict_converter

Description

This package provides a tool to convert a ROS message dictionary to a Python dictionary and vice versa.

Features

  • Convert a ROS message dictionary to a Python dictionary
  • Convert a Python dictionary to a ROS message dictionary
  • Allow populate empty lists with default values for the message types.
  • Also allows passing an existing message to update its fields with values from the dictionary.

Installation

pip install rosmsg_dict_converter

Usage

  1. ros_message_to_dict
from rosmsg_dict_converter.converver import ros_message_to_dict

from geometry_msgs.msg import Pose

# ros message to dict
pose = Pose()
pose_dict = ros_message_to_dict(pose)
  1. dict_to_ros_message
from rosmsg_dict_converter.converver import dict_to_ros_message

from geometry_msgs.msg import Pose

# dict to ros message
pose_dict = {
    'position': {
        'x': 1.0,
        'y': 2.0,
        'z': 3.0
    },
    'orientation': {
        'x': 0.0,
        'y': 0.0,
        'z': 0.0,
        'w': 1.0
    }
}
pose = dict_to_ros_message("geometry_msgs/Pose", pose_dict)
  1. populate_empty_lists
from rosmsg_dict_converter.converver import ros_message_to_dict,

from geometry_msgs.msg import PoseArray

# ros message to dict
pose_array = PoseArray()
pose_array_dict = ros_message_to_dict(pose_array, include_defaults=True)
# output
# pose_array_dict={'header': {'seq': 0, 'stamp': {'secs': 0, 'nsecs': 0}, 'frame_id': ''}, 'poses': [{'position': {'x': 0.0, 'y': 0.0, 'z': 0.0}, 'orientation': {'x': 0.0, 'y': 0.0, 'z': 0.0, 'w': 0.0}}]}
  1. update_ros_message
from rosmsg_dict_converter.converver import a_dict_to_ros_message,ros_message_to_dict
from geometry_msgs.msg import Point

point = Point()
point.x = 1.0

point_dict = ros_message_to_dict(point)
point_dict["y"] = 2.0

# the value of point.x is still 1.0
point = a_dict_to_ros_message(point, point_dict)
console.print(f"{point=}")

# output
# point=Point(x=1.0, y=2.0, z=0.0)

License

Apache License 2.0

Metadata

Release files for rosmsg-dict-converter 0.1.2

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

Source distribution (sdist)

Source distribution for rosmsg-dict-converter 0.1.2
File Size Uploaded Provenance
rosmsg_dict_converter-0.1.2.tar.gz 9.6 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for rosmsg-dict-converter 0.1.2
File Interpreter ABI Platform
rosmsg_dict_converter-0.1.2-py3-none-any.whl Python 3 none any Details

Total release size: 23.4 kB

Release files / rosmsg_dict_converter-0.1.2.tar.gz

Download URL rosmsg_dict_converter-0.1.2.tar.gz
Size 9.6 kB
Tags Source
SHA-256 checksum
How to use checksums
f27b22c09cbee00d93bbf7eb25267658634496ac8634d70413874181ce6d8675
BLAKE2b-256 checksum
How to use checksums
3c3012f5d37edc358014837306f2ad934779733ec28692af8b62c6d29b8a05d7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 2, 2025.

Transparency log

Release files / rosmsg_dict_converter-0.1.2-py3-none-any.whl

Download URL rosmsg_dict_converter-0.1.2-py3-none-any.whl
Size 13.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5b6b046890dcb6703f04295d07d64b992928ecd612324c3918157d787253a0f2
BLAKE2b-256 checksum
How to use checksums
59e686128b9453f229f11cedc93910d62f7fb93bac34c5ccdf6f7c4f0ac19c23
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 2, 2025.

Transparency log

Security for rosmsg-dict-converter 0.1.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for rosmsg_dict_converter-0.1.2.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 2, 2025.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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