ros2 / rosidl_dds Goto Github PK
View Code? Open in Web Editor NEWLicense: Apache License 2.0
License: Apache License 2.0
The typesupport introspection generated code lists the fields in a statically sized array of field names, but when there are no fields it produces an array of size zero.
This fails hard on windows and should give a warning on gcc, but I haven't seen it. The AllPrimitiveConstants.msg
message in the simple_msgs
package exposes this for me.
This line
Produces creates warnings for every connext message generated to the effect of:
INFO com.rti.ndds.nddsgen.Main Running rtiddsgen version 2.2.0.0, please wait ...
WARN com.rti.ndds.nddsgen.antlr.auto.IdlLexer ParamDescription_.idl line 33 preprocessor directive not supported. It will be ignored
WARN com.rti.ndds.nddsgen.antlr.auto.IdlLexer Param_.idl line 29 preprocessor directive not supported. It will be ignored
INFO com.rti.ndds.nddsgen.Main Done
Generating: /home/tfoote/work/ros2/parameters/build/rcl_interfaces/rosidl_typesupport_connext_cpp/rcl_interfaces/dds_connext/ParamDescription_.h/cpp
In the context of the rosidl_dds package, currently we can generate a bounded sequence or a bounded string using the '<=' identifier in a ROS2 .msg/.srv. But we cannot compound this behavior so that we can write something like:
"string<=128[<=100]" to generate "sequence<string<128>, 100>" in the resulting idl.
(Note: Using RTI Connext DDS as a middleware)
Required Info:
0.7.1-1bionic.20191015.013612
git clone https://github.com/PX4/px4_msgs.git -b use_rosidl_generator_dds_idl
to a colcon/ament ws;colcon build --event-handlers console_direct+
.rosidl_generate_dds_interfaces()
should correctly generate the IDL files for each message in px4_msgs, as it was doing for the Crystal release.
The generator fails with the following error:
[ 13%] Built target px4_msgs__rosidl_generator_c
[ 13%] Generating C introspection for ROS interfaces
No terminal defined for 'u' at line 1 col 1
uint64 timestamp # time since system sta
^
Expecting: {'CONST', 'MODULE', 'ENUM', 'STRUCT', 'TYPEDEF', '__ANON_9', 'AT'}
/home/nuno/PX4/px4_ros_com_ros2/src/px4_msgs/msg/ActuatorArmed.msg
Error processing idl file: /home/nuno/PX4/px4_ros_com_ros2/src/px4_msgs/msg/ActuatorArmed.msg
Traceback (most recent call last):
File "/opt/ros/dashing/lib/rosidl_generator_dds_idl/rosidl_generator_dds_idl", line 41, in <module>
sys.exit(main())
File "/opt/ros/dashing/lib/rosidl_generator_dds_idl/rosidl_generator_dds_idl", line 36, in main
args.additional_service_templates,
File "/opt/ros/dashing/lib/python3.6/site-packages/rosidl_generator_dds_idl/__init__.py", line 51, in generate_dds_idl
generate_files(generator_arguments_file, mapping, additional_context, keep_case=True)
File "/home/nuno/PX4/rosidl_ws/install/rosidl_cmake/lib/python3.6/site-packages/rosidl_cmake/__init__.py", line 94, in generate_files
raise(e)
File "/home/nuno/PX4/rosidl_ws/install/rosidl_cmake/lib/python3.6/site-packages/rosidl_cmake/__init__.py", line 73, in generate_files
idl_file = parse_idl_file(locator)
File "/home/nuno/PX4/rosidl_ws/install/rosidl_parser/lib/python3.6/site-packages/rosidl_parser/parser.py", line 64, in parse_idl_file
content = parse_idl_string(string, png_file=png_file)
File "/home/nuno/PX4/rosidl_ws/install/rosidl_parser/lib/python3.6/site-packages/rosidl_parser/parser.py", line 72, in parse_idl_string
tree = get_ast_from_idl_string(idl_string)
File "/home/nuno/PX4/rosidl_ws/install/rosidl_parser/lib/python3.6/site-packages/rosidl_parser/parser.py", line 89, in get_ast_from_idl_string
return _parser.parse(idl_string)
File "/usr/lib/python3/dist-packages/lark/lark.py", line 306, in parse
return self.parser.parse(text, start=start)
File "/usr/lib/python3/dist-packages/lark/parser_frontends.py", line 182, in parse
return self._parse(text, start)
File "/usr/lib/python3/dist-packages/lark/parser_frontends.py", line 54, in _parse
return self.parser.parse(input, start, *args)
File "/usr/lib/python3/dist-packages/lark/parsers/earley.py", line 293, in parse
self._parse(stream, columns, to_scan, start_symbol)
File "/usr/lib/python3/dist-packages/lark/parsers/xearley.py", line 137, in _parse
to_scan = scan(i, to_scan)
File "/usr/lib/python3/dist-packages/lark/parsers/xearley.py", line 114, in scan
raise UnexpectedCharacters(stream, i, text_line, text_column, {item.expect.name for item in to_scan}, set(to_scan))
lark.exceptions.UnexpectedCharacters: No terminal defined for 'u' at line 1 col 1
uint64 timestamp # time since system sta
^
Expecting: {'CONST', 'MODULE', 'ENUM', 'STRUCT', 'TYPEDEF', '__ANON_9', 'AT'}
This follows up the problem reported in ros2/rmw_fastrtps#251 (comment) and in eProsima/Fast-DDS#829. Letting rosidl_generate_interfaces()
generate the IDL files and respective typesupport results in having typenames which are not compatible with the ones generated by fastrtpsgen. Previously in Crystal, using rosidl_generate_dds_interfaces()
, one was able to generate IDL's and typesupport compatible with the ones from fastrtpsgen (more context in eProsima/Fast-DDS#829).
I am not sure at this point if using rosidl_generate_dds_interfaces()
in Dashing is going to result on the same problem or not.
Required Info:
Try to build the following message defined with IDL:
module foo {
module msg {
module MyMessage_Constants {
const unsigned long UNSIGNED_LONG_CONSTANT = 42;
};
struct MyMessage {
// (1)
@default ( value=UNSIGNED_LONG_CONSTANT )
unsigned long unsigned_long_value;
// (2)
wstring<UNSIGNED_LONG_CONSTANT> constant_bounded_wstring_value;
// (3)
string<UNSIGNED_LONG_CONSTANT> bounded_string_value;
};
};
};
Assumes the package name is foo
and the message is a subdirectory named msg
.
Code is successfully generated and compiled for the message type.
The constant UNSIGNED_LONG_CONSTANT
is not resolved correctly. In cases (1) and (2), we get the following compilation error:
In file included from /tmp/bug_report/build/foo/rosidl_generator_c/foo/msg/detail/my_message__functions.h:19,
from /tmp/bug_report/build/foo/rosidl_generator_c/foo/msg/detail/my_message__functions.c:4:
/tmp/bug_report/build/foo/rosidl_generator_c/foo/msg/detail/my_message__struct.h:34:74: error: ‘UNSIGNED_LONG_CONSTANT’ undeclared here (not in a function)
34 | foo__msg__MyMessage__constant_bounded_wstring_value__MAX_STRING_SIZE = UNSIGNED_LONG_CONSTANT
| ^~~~~~~~~~~~~~~~~~~~~~
make[2]: *** [CMakeFiles/foo__rosidl_generator_c.dir/build.make:92: CMakeFiles/foo__rosidl_generator_c.dir/rosidl_generator_c/foo/msg/detail/my_message__functions.c.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:301: CMakeFiles/foo__rosidl_generator_c.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
TypeError in template '/home/jacob/ws/ros/latest/install/rosidl_typesupport_introspection_cpp/share/rosidl_typesupport_introspection_cpp/resource/msg__type_support.cpp.em': %u format: a number is required, not str
TypeError when expanding 'idl__type_support.cpp.em' into '/tmp/bug_report/build/foo/rosidl_typesupport_introspection_cpp/foo/msg/detail/my_message__type_support.cpp': %u format: a number is required, not str
Error processing idl file: /tmp/bug_report/src/foo/msg/MyMessage.idl
Traceback (most recent call last):
File "/home/jacob/ws/ros/latest/install/rosidl_typesupport_introspection_cpp/lib/rosidl_typesupport_introspection_cpp/rosidl_typesupport_introspection_cpp", line 23, in <module>
sys.exit(main())
File "/home/jacob/ws/ros/latest/install/rosidl_typesupport_introspection_cpp/lib/rosidl_typesupport_introspection_cpp/rosidl_typesupport_introspection_cpp", line 19, in main
return generate_cpp(args.generator_arguments_file)
File "/home/jacob/ws/ros/latest/install/rosidl_typesupport_introspection_cpp/lib/python3.8/site-packages/rosidl_typesupport_introspection_cpp/__init__.py", line 24, in generate_cpp
generate_files(generator_arguments_file, mapping)
File "/home/jacob/ws/ros/latest/install/rosidl_cmake/lib/python3.8/site-packages/rosidl_cmake/__init__.py", line 96, in generate_files
raise(e)
File "/home/jacob/ws/ros/latest/install/rosidl_cmake/lib/python3.8/site-packages/rosidl_cmake/__init__.py", line 87, in generate_files
expand_template(
File "/home/jacob/ws/ros/latest/install/rosidl_cmake/lib/python3.8/site-packages/rosidl_cmake/__init__.py", line 149, in expand_template
interpreter.string(template_content, template_path, locals=data)
File "/home/jacob/.local/lib/python3.8/site-packages/em.py", line 2391, in string
self.safe(scanner, True, locals)
File "/home/jacob/.local/lib/python3.8/site-packages/em.py", line 2401, in safe
self.parse(scanner, locals)
File "/home/jacob/.local/lib/python3.8/site-packages/em.py", line 2421, in parse
token.run(self, locals)
File "/home/jacob/.local/lib/python3.8/site-packages/em.py", line 1547, in run
self.subrun(info[0][1], interpreter, locals)
File "/home/jacob/.local/lib/python3.8/site-packages/em.py", line 1631, in subrun
token.run(interpreter, locals)
File "/home/jacob/.local/lib/python3.8/site-packages/em.py", line 1425, in run
interpreter.execute(self.code, locals)
File "/home/jacob/.local/lib/python3.8/site-packages/em.py", line 2596, in execute
_exec(statements, self.globals, locals)
File "<string>", line 2, in <module>
File "/home/jacob/ws/ros/latest/install/rosidl_cmake/lib/python3.8/site-packages/rosidl_cmake/__init__.py", line 198, in _expand_template
interpreter.string(content, str(template_path), kwargs)
File "/home/jacob/.local/lib/python3.8/site-packages/em.py", line 2391, in string
self.safe(scanner, True, locals)
File "/home/jacob/.local/lib/python3.8/site-packages/em.py", line 2401, in safe
self.parse(scanner, locals)
File "/home/jacob/.local/lib/python3.8/site-packages/em.py", line 2421, in parse
token.run(self, locals)
File "/home/jacob/.local/lib/python3.8/site-packages/em.py", line 1425, in run
interpreter.execute(self.code, locals)
File "/home/jacob/.local/lib/python3.8/site-packages/em.py", line 2596, in execute
_exec(statements, self.globals, locals)
File "<string>", line 27, in <module>
TypeError: %u format: a number is required, not str
Exception ignored in: <function Interpreter.__del__ at 0x7f8a84dcee50>
Traceback (most recent call last):
File "/home/jacob/.local/lib/python3.8/site-packages/em.py", line 2094, in __del__
File "/home/jacob/.local/lib/python3.8/site-packages/em.py", line 2157, in shutdown
File "/home/jacob/.local/lib/python3.8/site-packages/em.py", line 2647, in finalize
File "/home/jacob/.local/lib/python3.8/site-packages/em.py", line 2200, in push
AttributeError: '_io.TextIOWrapper' object has no attribute 'push'
make[2]: *** [CMakeFiles/foo__rosidl_typesupport_introspection_cpp.dir/build.make:70: rosidl_typesupport_introspection_cpp/foo/msg/detail/my_message__rosidl_typesupport_introspection_cpp.hpp] Error 1
make[2]: *** Deleting file 'rosidl_typesupport_introspection_cpp/foo/msg/detail/my_message__rosidl_typesupport_introspection_cpp.hpp'
make[1]: *** [CMakeFiles/Makefile2:468: CMakeFiles/foo__rosidl_typesupport_introspection_cpp.dir/all] Error 2
In case (3), we get a different error:
'>' not supported between instances of 'str' and 'int' /tmp/bug_report/src/foo/msg/MyMessage.idl
Error processing idl file: /tmp/bug_report/src/foo/msg/MyMessage.idl
'>' not supported between instances of 'str' and 'int' /tmp/bug_report/src/foo/msg/MyMessage.idl
Error processing idl file: /tmp/bug_report/src/foo/msg/MyMessage.idl
Traceback (most recent call last):
File "/home/jacob/ws/ros/latest/install/rosidl_generator_c/share/rosidl_generator_c/cmake/../../../lib/rosidl_generator_c/rosidl_generator_c", line 40, in <module>
sys.exit(main())
File "/home/jacob/ws/ros/latest/install/rosidl_generator_c/share/rosidl_generator_c/cmake/../../../lib/rosidl_generator_c/rosidl_generator_c", line 34, in main
return generate_c(
File "/home/jacob/ws/ros/latest/install/rosidl_generator_c/lib/python3.8/site-packages/rosidl_generator_c/__init__.py", line 37, in generate_c
generate_files(
File "/home/jacob/ws/ros/latest/install/rosidl_cmake/lib/python3.8/site-packages/rosidl_cmake/__init__.py", line 96, in generate_files
raise(e)
File "/home/jacob/ws/ros/latest/install/rosidl_cmake/lib/python3.8/site-packages/rosidl_cmake/__init__.py", line 74, in generate_files
idl_file = parse_idl_file(locator)
File "/home/jacob/ws/ros/latest/install/rosidl_parser/lib/python3.8/site-packages/rosidl_parser/parser.py", line 64, in parse_idl_file
content = parse_idl_string(string, png_file=png_file)
File "/home/jacob/ws/ros/latest/install/rosidl_parser/lib/python3.8/site-packages/rosidl_parser/parser.py", line 73, in parse_idl_string
content = extract_content_from_ast(tree)
File "/home/jacob/ws/ros/latest/install/rosidl_parser/lib/python3.8/site-packages/rosidl_parser/parser.py", line 144, in extract_content_from_ast
add_message_members(msg, struct_defs[0])
File "/home/jacob/ws/ros/latest/install/rosidl_parser/lib/python3.8/site-packages/rosidl_parser/parser.py", line 365, in add_message_members
abstract_type = get_abstract_type_from_type_spec(type_spec)
File "/home/jacob/ws/ros/latest/install/rosidl_parser/lib/python3.8/site-packages/rosidl_parser/parser.py", line 406, in get_abstract_type_from_type_spec
return get_abstract_type(child)
File "/home/jacob/ws/ros/latest/install/rosidl_parser/lib/python3.8/site-packages/rosidl_parser/parser.py", line 456, in get_abstract_type
assert maximum_size > 0
TypeError: '>' not supported between instances of 'str' and 'int'
make[2]: *** [CMakeFiles/foo__rosidl_generator_c.dir/build.make:75: rosidl_generator_c/foo/msg/my_message.h] Error 1
make[1]: *** [CMakeFiles/Makefile2:300: CMakeFiles/foo__rosidl_generator_c.dir/all] Error 2
I haven't tried, but I assume the issue relates to all types of constants, not just unsigned longs.
Required Info:
Hi,
I am trying to use this package to generate DDS IDL files from ROS messages. I know that rmw_fastrtps_cpp
is different since it uses introspection rather than generated code specific to each message so for FastRTPS, which results on one not having to generate .idl
files. Though, for my particular case, I do require the IDL's to be generated in order to generate code for a micro-RTPS agent daemon.
The following snippet is what I am adding to the CMakeLists.txt
file:
rosidl_generate_dds_interfaces("${PROJECT_NAME}_fastrtps_idl"
IDL_FILES ${MSGS}
DEPENDENCY_PACKAGE_NAMES ${PROJECT_NAME} builtin_interfaces
OUTPUT_SUBFOLDERS "dds_fastrtps"
)
Where MSGS
are the list of ROS msgs inside package_dir/msg
. I use dds_fastrtps
since it's the same naming for the output folder of the OpenSplice IDL files.
The expected behaviour, of course, is that the IDL files get generated, so they can be used.
It's verified that rosidl_generator_dds_idl__dds_fastrtps__arguments.json
is created under the build folder, though no build/<project_name>/rosidl_generator_dds_idl/<project_name>/msg/dds_fastrpts
directory is created, which results on having an error on the install process:
CMake Error at ament_cmake_symlink_install/ament_cmake_symlink_install.cmake:158 (message):
ament_cmake_symlink_install_files() can't find
'/home/nuno/PX4/px4_ros_com_ros2/build/px4_ros_com/rosidl_generator_dds_idl/px4_ros_com/msg/dds_fastrtps/ActuatorArmed_.idl'
Call Stack (most recent call first):
ament_cmake_symlink_install/ament_cmake_symlink_install.cmake:314 (ament_cmake_symlink_install_files)
cmake_install.cmake:41 (include)
Makefile:61: recipe for target 'install' failed
make: *** [install] Error 1
--- stderr: px4_ros_com
Thanks in advance for your support!
Hey was wondering what is the difference between this repo and ros2 /rosidl/rosidl_adapter? They seem to have very similar functionality
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.