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

[ROS2] msg data types returned in Python subscribed messages

asked 2018-10-16 15:02:59 -0600

MisterblueGuy gravatar image

I am writing a pure Python3 publisher and subscriber that exchange a 'sensor_msg/CompressedImage' message.

In sensor_msg/CompressedImage, the data field is defined as an uint8[] (see [1]) but, on the reception side, I'm seeing that the received message 'data' field is returned as a list of 'int's.

I was expecting the 'data' field to be of the defined type at the receiving end. Is the conversion to a list expected? Or, is there some problem in the un-marshaling code?

I am running a compiled version of github repository 'master' as of October 14th so it is as close to Crystal as I can get (I wanted parameters in Python) on "Ubuntu 18.04.1 LTS" architecture x86_64.

[1] https://github.com/ros2/common_interf...

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2018-10-16 15:14:47 -0600

Dirk Thomas gravatar image

There is no native uint8 type in Python. As a result the field type is represented as an int in Python (see the current design document: http://design.ros2.org/articles/gener... ).

In the future (scheduled for Crystal) sequences of numeric values will be mapped to a more strictly typed numpy type (see the new design document: https://github.com/ros2/design/blob/f... ). This will also improve the memory usage of large lists.

edit flag offensive delete link more

Question Tools

2 followers

Stats

Asked: 2018-10-16 15:02:59 -0600

Seen: 772 times

Last updated: Oct 16 '18