ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

publish and subscribe to numpy.ndarray topic in ROS2

asked 2020-11-02 10:33:48 -0500

Kreace gravatar image

Hello!

My question is quite simple is it possible to create publishers/subscriber of a numpy.ndarray topic and how? I searched on the internet and I found these two links :

I don't know if I understood them wrong but apparently it is possible to do so. I'm using ROS2 Foxy Fitztroy. I tried to create my own custom message type with numpy.ndarray but it never ended up well, and in fact i don't really know in which direction i should search. Is there already some tutorial on how to do it? Should I create a custom message type? Does ROS2 handle it without doing anything? I'm quite lost now so any help would be very much appreciate!

If you need further information to help me let me know!

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2020-11-02 13:39:41 -0500

Create a custom message corresponding to the data you'd like to publish, then populate it with your ndarray, and publish. Or serialize it into a string field, but that's pretty hacky.

You cannot easily publish a numpy.ndarray by itself.

edit flag offensive delete link more

Comments

I have been a bit busy theses days, thanks for the clarification

Kreace gravatar image Kreace  ( 2020-11-04 08:33:31 -0500 )edit

Question Tools

2 followers

Stats

Asked: 2020-11-02 10:33:48 -0500

Seen: 853 times

Last updated: Nov 02 '20