https://github.com/neka-nat/ros_np_multiarray
Convert between numpy ndarray and ros multiarray
https://github.com/neka-nat/ros_np_multiarray
numpy ros
Last synced: 21 days ago
JSON representation
Convert between numpy ndarray and ros multiarray
- Host: GitHub
- URL: https://github.com/neka-nat/ros_np_multiarray
- Owner: neka-nat
- Created: 2018-07-09T16:55:58.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2022-08-23T12:46:22.000Z (almost 3 years ago)
- Last Synced: 2025-04-13T08:14:03.577Z (3 months ago)
- Topics: numpy, ros
- Language: CMake
- Size: 8.79 KB
- Stars: 18
- Watchers: 1
- Forks: 6
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# ros_np_multiarray
Convert between numpy ndarray and ros multiarray message.
## Usage
This is a simple example.
```py
from ros_np_multiarray import ros_np_multiarray as rnm
import numpy as npprint(rnm.to_multiarray_f32(np.array([[[1.0, 2.0], [3.0, 4.0]]], dtype=np.float32)))
```We get the data converted to 'std_msgs/Float32MultiArray'.
```
layout:
dim:
-
label: "dim0"
size: 1
stride: 4
-
label: "dim1"
size: 2
stride: 8
-
label: "dim2"
size: 2
stride: 8
data_offset: 0
data: [1.0, 2.0, 3.0, 4.0]
```