[ros-users] [Discourse.ros.org] [Next Generation ROS] Discus…

Top Page
Attachments:
Message as email
+ (text/plain)
Delete this message
Reply to this message
Author: Sam Pfeiffer via ros-users
Date:  
To: ros-users
CC: Sam Pfeiffer
Subject: [ros-users] [Discourse.ros.org] [Next Generation ROS] Discussion about uint8[] type transport in ROS2 python


Just a few suggestions on maybe how to deal with this:

Given this is kinda a... corner case, just by monkeypatching the method to use a converting method that's already prepared for the usecase:

    from sensor_msgs.msg import Image
    Image._CONVERT_TO_PY = Image._pre_compiled_conversion_functions.uint8_to_list
    node.create_subscription(Image, '/camera/whatever/image_raw', callback)


Of course, this implies generating the the thing I called `_pre_compiled_conversion_functions`. A better name would come up from the experts, I'm sure. Or there could be a function to just enable that in a more friendly way:

`Image.use_list_conversion()`

Or make an option to choose to use the old list way when instantiating a message that contains this specific problem.

    from sensor_msgs.msg import Image
    Image._CONVERT_TO_PY_MODE = Image._ROS1_COMPATIBILITY_MODE


Or generate two messages when a field of type uint8[] appears:

`from sensor_msgs.msg import Image, Image_ROS1`

Or even allow for every field the mode of conversion in a generic way (keeping the default the most efficient):

    from sensor_msgs.msg import Image
    Image.data.conversion_type = list
    Image.data.conversion_type = bytes


Well, just throwing some ideas around. The monkeypatching way, with maybe a good method name to make it more friendly is probably my favorite.





---
[Visit Topic](https://discourse.ros.org/t/discussion-about-uint8-type-transport-in-ros2-python/4633/2) or reply to this email to respond.


If you do not want to receive messages from ros-users please use the unsubscribe link below. If you use the one above, you will stop all of ros-users from receiving updates.
______________________________________________________________________________
ros-users mailing list

http://lists.ros.org/mailman/listinfo/ros-users
Unsubscribe: <http://lists.ros.org/mailman//options/ros-users>