0
$\begingroup$

Rosanswers logo

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!


Originally posted by Kreace on ROS Answers with karma: 5 on 2020-11-02

Post score: 0

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

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.


Originally posted by stevemacenski with karma: 8272 on 2020-11-02

This answer was ACCEPTED on the original site

Post score: 1


Original comments

Comment by Kreace on 2020-11-04:
I have been a bit busy theses days, thanks for the clarification

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.