Closed Sdehnavi closed 4 years ago
I am not sure why you are trying to call the script rosidl_typesupport_c
manually. The normal workflow involved the CMake function rosidl_generate_interfaces()
which for rosidl_typesupport_c
will then take care of generating the necessary arguments, see: https://github.com/ros2/rosidl_typesupport/blob/fa9615156ecbd8b904d7dc07c1145e237996824a/rosidl_typesupport_c/cmake/rosidl_typesupport_c_generate_interfaces.cmake#L54-L74
If you really want to invoke the script manually you will need to provide the same arguments as the CMake does. You can find the logic of rosidl_write_generator_arguments
here: https://github.com/ros2/rosidl/blob/4caf9a8883a6e84d674e8c1a57261a4f751f6312/rosidl_cmake/cmake/rosidl_write_generator_arguments.cmake
@dirk-thomas Thanks for your response.
Actually I am going to use the generated source code for Int32 type support in another project which is going to be compiled in an embedded system. But it seems that cmake generates the shared library and I can not see the generated source code.
Following the cmake file logic I generated a json file like the following for the parameter --generator_arguments_file
{ "package_name": "rosidl_typesupport_c", "output_dir": "/home/computation/Cleanable/output/", "template_dir": "/home/computation/Cleanable/rosidl_typesupport/rosidl_typesupport_c/resource/", "ros_interface_files": [ "/home/computation/Cleanable/Int32.idl" ], "target_dependencies": [ "/opt/ros/dashing/lib/rosidl_typesupport_c/rosidl_typesupport_c", "/opt/ros/dashing/lib/python3.6/site-packages/rosidl_typesupport_c/__init__.py", "/opt/ros/dashing/share/rosidl_typesupport_c/resource/action__type_support.c.em", "/opt/ros/dashing/share/rosidl_typesupport_c/resource/idl__type_support.cpp.em", "/opt/ros/dashing/share/rosidl_typesupport_c/resource/msg__type_support.cpp.em", "/opt/ros/dashing/share/rosidl_typesupport_c/resource/srv__type_support.cpp.em", "/home/computation/Cleanable/Int32.idl", "/opt/ros/dashing/share/builtin_interfaces/msg/Duration.idl", "/opt/ros/dashing/share/builtin_interfaces/msg/Time.idl"] }
I dont know how correct is this argument file for Int32 but it seems that it does not generate anything. However, except --generator-arguments-file parameter, there is another parameter nmed --typesupports which I put it to Int32 but no idea about that...
The required source codes can be found in std_msgs package in the build directory if you build ROS2 from source.
Hi,
It might be somehow weird, but for some reason I have decided to compile and run Rosidl_typesupport_c package and generate the source files for a specific message type. For simplicity image that I want to do this for Int32. So after compilation with colcon we need to do the following command: "ros2 run rosidl_typesupport_c rosidl_typesupport_c " But indeed we get the following error: "rosidl_typesupport_c: error: the following arguments are required: --generator-arguments-file, --typesupports"
It is quite clear for me that this parameters are generated by another package when doing ros programming. But if you look at the resource directory of this package (rosidl_typesupport_c/resources) you can find some template files that will be converted to c and cpp files.
Now my problem is how to generate --generator-arguments-file and --typesupports and call this package manually?
Thanks for your response in advance