小鱼 ROS 2 新书上线!点击链接查看, 新书配套视频点击链接查看。
提问前必看的发帖注意事项—— 提问前必看!不符合要求的问题拒绝回答!!
社区使用指南—如何添加标签修改密码
MicroROS自定义接口,电脑端编译报错
-
[0.288s] WARNING:colcon.colcon_core.package_identification:Failed to parse ROS package manifest in 'arm_servo': Error(s) in package 'arm_servo/package.xml':
Error(s):-
The generic dependency on 'rosidl_default_generators' is redundant with: build_depend
Starting >>> arm_servo
--- stderr: arm_servo
CMake Error at /opt/ros/humble/share/rosidl_adapter/cmake/rosidl_adapt_interfaces.cmake:59 (message):
execute_process(/usr/bin/python3 -m rosidl_adapter --package-name arm_servo
--arguments-file
/home/lyt/arm_robot/arm_packages/build/arm_servo/rosidl_adapter__arguments__arm_servo.json
--output-dir
/home/lyt/arm_robot/arm_packages/build/arm_servo/rosidl_adapter/arm_servo
--output-file
/home/lyt/arm_robot/arm_packages/build/arm_servo/rosidl_adapter/arm_servo.idls)
returned error code 1:Traceback (most recent call last):
File "/usr/lib/python3.10/runpy.py", line 196, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/usr/lib/python3.10/runpy.py", line 86, in _run_code
exec(code, run_globals)
File "/opt/ros/humble/local/lib/python3.10/dist-packages/rosidl_adapter/main.py", line 19, in <module>
sys.exit(main())
File "/opt/ros/humble/local/lib/python3.10/dist-packages/rosidl_adapter/main.py", line 53, in main
abs_idl_file = convert_to_idl(
File "/opt/ros/humble/local/lib/python3.10/dist-packages/rosidl_adapter/init.py", line 24, in convert_to_idl
return convert_srv_to_idl(
File "/opt/ros/humble/local/lib/python3.10/dist-packages/rosidl_adapter/srv/init.py", line 28, in convert_srv_to_idl
srv = parse_service_string(package_name, input_file.stem, content)
File "/opt/ros/humble/local/lib/python3.10/dist-packages/rosidl_adapter/parser.py", line 859, in parse_service_string
request_message = parse_message_string(
File "/opt/ros/humble/local/lib/python3.10/dist-packages/rosidl_adapter/parser.py", line 544, in parse_message_string
msg = MessageSpecification(pkg_name, msg_name, fields, constants)
File "/opt/ros/humble/local/lib/python3.10/dist-packages/rosidl_adapter/parser.py", line 388, in init
self.base_type = BaseType(
File "/opt/ros/humble/local/lib/python3.10/dist-packages/rosidl_adapter/parser.py", line 205, in init
raise InvalidResourceName(rosidl_adapter.parser.InvalidResourceName: 'Arm_servo_Request' is an
invalid message name. It should have the pattern '^[A-Z][A-Za-z0-9]*$'
Call Stack (most recent call first):
/opt/ros/humble/share/rosidl_cmake/cmake/rosidl_generate_interfaces.cmake:130 (rosidl_adapt_interfaces)
CMakeLists.txt:12 (rosidl_generate_interfaces)
Failed <<< arm_servo [0.38s, exited with code 1]
Summary: 0 packages finished [0.67s]
1 package failed: arm_servo
1 package had stderr output: arm_servo -
-
cmake_minimum_required(VERSION 3.8)
project(arm_servo)if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(-Wall -Wextra -Wpedantic)
endif()find_package(ament_cmake REQUIRED)
find_package(rosidl_default_generators REQUIRED)rosidl_generate_interfaces(${PROJECT_NAME}
"srv/Arm_servo.srv"
)if(BUILD_TESTING)
find_package(ament_lint_auto REQUIRED)set(ament_cmake_copyright_FOUND TRUE)
set(ament_cmake_cpplint_FOUND TRUE)
ament_lint_auto_find_test_dependencies()
endif()ament_package()
-
<?xml version="1.0"?>
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
<package format="3">
<name>arm_servo</name>
<version>0.0.0</version>
<description>TODO: Package description</description>
<maintainer email="lyt@todo.todo">lyt</maintainer>
<license>TODO: License declaration</license><buildtool_depend>ament_cmake</buildtool_depend>
<depend>rosidl_default_generators</depend>
<member_of_group>rosidl_interface_packages</member_of_group>
<test_depend>ament_lint_auto</test_depend>
<test_depend>ament_lint_common</test_depend><export>
<build_type>ament_cmake</build_type>
</export><build_depend>rosidl_default_generators</build_depend>
<exec_depend>rosidl_default_runtime</exec_depend></package>
-
服了,喜欢命名带下划线,自定义消息类型名去掉下划线就好了