1

I have customized some messages. After compiling and source, when I use the ros2 interface show command to view the message definition, it throws the following exception:

Error processing '// generated from rosidl_adapter/resource/msg.idl.em' of 'interfaces/Gps': '//'
Traceback (most recent call last):
  File "/opt/ros/humble/install/bin/ros2", line 33, in <module>
    sys.exit(load_entry_point('ros2cli==0.18.7', 'console_scripts', 'ros2')())
  File "/opt/ros/humble/install/lib/python3.6/site-packages/ros2cli/cli.py", line 89, in main
    rc = extension.main(parser=parser, args=args)
  File "/opt/ros/humble/install/lib/python3.6/site-packages/ros2interface/command/interface.py", line 35, in main
    return extension.main(args=args)
  File "/opt/ros/humble/install/lib/python3.6/site-packages/ros2interface/verb/show.py", line 204, in main
    is_show_nested_comments=args.all_comments,
  File "/opt/ros/humble/install/lib/python3.6/site-packages/ros2interface/verb/show.py", line 148, in _show_interface
    for line in _get_interface_lines(interface_identifier):
  File "/opt/ros/humble/install/lib/python3.6/site-packages/ros2interface/verb/show.py", line 119, in _get_interface_lines
    line_text=line.rstrip(),
  File "/opt/ros/humble/install/lib/python3.6/site-packages/ros2interface/verb/show.py", line 46, in __init__
    message_string=line_text,
  File "/opt/ros/humble/install/lib/python3.6/site-packages/rosidl_adapter/parser.py", line 521, in parse_message_string
    Type(type_string, context_package_name=pkg_name),
  File "/opt/ros/humble/install/lib/python3.6/site-packages/rosidl_adapter/parser.py", line 280, in __init__
    context_package_name=context_package_name)
  File "/opt/ros/humble/install/lib/python3.6/site-packages/rosidl_adapter/parser.py", line 191, in __init__
    raise InvalidResourceName(type_string)
rosidl_adapter.parser.InvalidResourceName: //

But if I link the generated ws/install/interfaces/share/interfaces/sensor/Gps.msg file to ws/install/interfaces/share/interfaces/msg directory, it works fine.

Alternatively, moving ws/src/interfaces/msg/sensor/Gps.msg to ws/src/interfaces/msg/ directory and rebuild also works.


Here is the directory structure of my custom message repository:

.
├── CMakeLists.txt
├── msg
│   └── sensor
│       ├── Gps.msg
└── package.xml
张金阳
  • 11
  • 2

0 Answers0