Discussion about how to add a new PRIMITIVE_TYPES to rosidl(msg)

My understanding is that the proposal from @Zongpei_Jiang is to map uint8 to builtin.bytes as several ROS 1 messages use uint8 to send binary data around

I agree with that . Just map all the uint8[] to bytes[] instead of list[] may cause other problems since some algorithms are designed using the msg.data as list in python .

So that’s why i want to create a type like imguint8 that i can also create a BytesImage.msg which use the type to deliver image messages like what ‘Image.msg’ does . And i have changed some files in rosidl package and sensor_msg package and succeeded in ament building .

I have changed following files to add the imguint8:

rosidl/rosidl_generator_py/resource/_msg_support.c.em
rosidl/rosidl_generator_py/resource/_msg.py.em
rosidl/rosidl_generator_py/msg/Primitives.msg
rosidl/rosidl_generator_py/rosidl_generator_py/generate_py_impl.py
rosidl/rosidl_parser/rosidl_parser/__init__.py
common_interfaces/sensor_msgs/msg/BytesImage.msg
common_interfaces/sensor_msgs/CMakeLists.txt
rosidl/rosidl_generator_c/include/rosidl_generator_c/primitives_array.h
rosidl/rosidl_generator_c/include/rosidl_generator_c/primitives_array_functions.h
rosidl/rosidl_generator_c/msg/ImgUint8.msg

rosidl/rosidl_generator_c/msg/Primitive*.msg

rosidl/rosidl_generator_c/resource/msg__struct.h.em

rosidl/rosidl_generator_c/rosidl_generator_c/__init__.py
rosidl/rosidl_generator_c/src/primitives_array_functions.c


rosidl/rosidl_typesupport_introspection_c/include/rosidl_typesupport_introspection_c/field_types.h

rosidl/rosidl_generator_cpp/msg/Primitive*.msg

rosidl/rosidl_generator_cpp/resource/msg__struct.hpp.em
rosidl/rosidl_generator_cpp/rosidl_generator_cpp/__init__.py

rosidl/rosidl_typesupport_introspection_cpp/include/rosidl_typesupport_introspection_cpp/field_types.hpp

But i failed using the new type to publish the BytesImage.msg type with reporting :
Assertion convert_from_py != NULL && “unable to retrieve convert_from_py function, type_support mustn’t have been imported”’ failed.`

So i want to know whether i can add the imguint8 type and if i can , what i have missed to make the BytesImage.msg can work .

Thanks