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

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
2

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

Comments

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

did you end up finding a solution to publishing ndarrays without converting to a list?

waspinator gravatar image waspinator  ( 2022-09-10 10:24:33 -0500 )edit

@waspinator,

Sorry, my work pulled me away from this particular path, so I have yet to actually dive into this properly. Goodluck with your future pursuits!

alluring-mushroom gravatar image alluring-mushroom  ( 2022-09-11 21:35:11 -0500 )edit

Question Tools

1 follower

Stats

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

Seen: 638 times

Last updated: Apr 13 '22