Ask Your Question

Best way to integrate ndarray into ros2 [closed]

asked 2022-04-03 22:05:13 -0500

alluring-mushroom gravatar image

Hello, I have a numpy ndarray, and when I try and publish it, I get this error:

AssertionError: The 'data' field must be a set or sequence and each value of type 'float'

Searching around, I see references to numpy in ros1, and also in the ros2 ros2idl_generator_py, however the only way I can seem to publish the array is to convert to a python list, which is expensive. Given that a numpy array is a sequence, is there any way to avoid this conversion?

Thank you for your time!

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by alluring-mushroom
close date 2022-05-05 22:37:26.465267

1 Answer

Sort by ยป oldest newest most voted

answered 2022-04-13 00:28:27 -0500

aprotyas gravatar image

There have been some recent PRs on this topic that might give you some ideas:

edit flag offensive delete link more


Hey , thank you for your reply, and sorry for my late one! There is a bit to unpack with these, and we we are still bound to Foxy. I am unsure how much is back ported, but I will see what options I have here. Again, thank you :D

alluring-mushroom gravatar image alluring-mushroom  ( 2022-05-05 22:36:53 -0500 )edit

Question Tools

1 follower


Asked: 2022-04-03 22:05:13 -0500

Seen: 68 times

Last updated: Apr 13