Skip to main content

ros_numpy

Note: This is the same as the original ros_numpy package by eric-wieser just edited to be OS independent and installable using pip. Loosely tested, but works perfectly on Windows and Ubuntu for "numpifying" PointCloud2 and Image messages from bag files.

Install using:

pip install rosnumpy

Quick Start

PointCloud2 msg to Numpy array:

import ros_numpy
import sensor_msgs

def get_pc_from_ros_pc2_msg(msg):
    """ Returns point-cloud as a structured numpy array. 
    Note: can be used with any topic of message type 'sensor_msgs/PointCloud2'
    """
    msg.__class__ = sensor_msgs.msg.PointCloud2
    return ros_numpy.numpify(msg)

pc_array =  get_pc_from_pc2_msg(msg)

Image msg to Numpy array:

import ros_numpy
import sensor_msgs

def get_img_from_ros_image_msg(msg):
    """ Returns image as a numpy array. 
    Note: can be used with any topic of message type 'sensor_msgs/Image'
    """
    msg.__class__ = sensor_msgs.msg.Image
    return ros_numpy.numpify(msg)

img_array =  get_img_from_ros_image_msg(msg)

The (msg) in previous examples is coming from here:

import rosbag

bag_path = r'path to .bag file here'
bag = rosbag.Bag(bag_path)
for topic, msg, t in bag.read_messages(topics=['/PointCloud2_topic_here']):
    pc_array =  get_pc_from_pc2_msg(msg)

Metadata

Release files for rosnumpy 0.0.6.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 rosnumpy 0.0.6.2
File Size Uploaded Provenance Actions
rosnumpy-0.0.6.2.tar.gz 24.5 kB Without provenance Details for rosnumpy-0.0.6.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for rosnumpy 0.0.6.2
File Interpreter ABI Platform Actions
rosnumpy-0.0.6.2-py3-none-any.whl Python 3 none any Details for rosnumpy-0.0.6.2-py3-none-any.whl

Total release size: 48.9 kB

Release files / rosnumpy-0.0.6.2.tar.gz

Download URL rosnumpy-0.0.6.2.tar.gz
Size 24.5 kB
Tags Source
SHA-256 checksum
How to use checksums
17ff607c586c73e9f92c8c5d498a54223bc0dedb2df386b643a17c1a81e73efe
BLAKE2b-256 checksum
How to use checksums
2787964fa875d47cd8e305498ad408af69cbf7b55accc2224a3fe1aae3aef84f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.8.10

Release files / rosnumpy-0.0.6.2-py3-none-any.whl

Download URL rosnumpy-0.0.6.2-py3-none-any.whl
Size 24.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
94a8108f403a7c806eb7f0faec672c4c6a3045d0326e07c1b73cc7d39c9b55f8
BLAKE2b-256 checksum
How to use checksums
7ecac6fe62b77f7d96ad6ddeafd6d179deb69a658c4398790e802bac0d792958
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.8.10

Security for rosnumpy 0.0.6.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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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