ROS2 Messages from IDL Files
I've seen in the release notes for Dashing that the message generation pipeline now supports IDL files directly. Are there any examples available on how to actually use an IDL file directly in a messages package? Can I pass a list of IDL files directly to rosidl_generate_interfaces()?
[UPDATE]
Based on the advice of sloretz I've tried creating an example project that includes the MyMessage.idl test case from rosidl_parser. It's located at idl_msgs. It tries to generate messages from a single IDL file. On Ubuntu 18.04 with Dashing, running 'colcon build' on the package produces several errors:
davidhodo@ubuntu:~/devel/idl_test_ws$ colcon build
Starting >>> idl_msgs
--- stderr: idl_msgs
AssertionError in template '/opt/ros/dashing/share/rosidl_generator_cpp/cmake/../resource/msg__struct.hpp.em': unknown primitive type 'long double'
AssertionError when expanding 'idl__struct.hpp.em' into '/home/davidhodo/devel/idl_test_ws/build/idl_msgs/rosidl_generator_cpp/idl_msgs/idl/my_message__struct.hpp': unknown primiti
ve type 'long double'
Error processing idl file: /home/davidhodo/devel/idl_test_ws/src/idl_msgs/idl/MyMessage.idl
TypeError in template '/opt/ros/dashing/share/rosidl_generator_dds_idl/resource/msg.idl.em': %d format: a number is required, not str
TypeError when expanding 'idl.idl.em' into '/home/davidhodo/devel/idl_test_ws/build/idl_msgs/rosidl_generator_dds_idl/idl_msgs/idl/dds_opensplice/MyMessage_.idl': %d format: a numb
er is required, not str
Error processing idl file: /home/davidhodo/devel/idl_test_ws/src/idl_msgs/idl/MyMessage.idl
The full error output is available here.
Any suggestions would be appreciated.
[UPDATE2]
I was able to get it to build with a few modifications. I had to remove the long double and wchar types as well as the includes. I also had to change the top level module name to match my package name and the next level module name from 'msg' to 'idl'.
module idl_msgs{
module idl {
}
}
That compiled and gave me a working message. The updated code is available at: https://github.com/davidhodo/idl_msgs.git
Thanks,
David
Can you try to remove the
long double
field? The 128 bit floating point type doesn't exist anywhere in the ROS message format and therefore has probably never been tested with the generators.If you want to use
long double
you can try the following two PRs which should make it work with FastRTPS: https://github.com/ros2/rosidl/pull/383 and https://github.com/ros2/rosidl_typesu...