自定义消息接口——编译功能包报错
-
跟着小鱼老师的文档 1.控制OLED-自定义消息接口 操作下来,在2.2编译功能包的时候报错:
ros2@ros2-virtual-machine:~/example14_custom_interface/extra_packages$ colcon build Starting >>> fishbot_interfaces --- stderr: fishbot_interfaces CMake Error at /opt/ros/humble/share/rosidl_cmake/cmake/rosidl_generate_interfaces.cmake:93 (message): rosidl_generate_interfaces() the passed file 'srv/OledControl.srv' doesn't exist relative to the CMAKE_CURRENT_SOURCE_DIR '/home/ros2/example14_custom_interface/extra_packages/fishbot_interfaces' Call Stack (most recent call first): CMakeLists.txt:28 (rosidl_generate_interfaces) --- Failed <<< fishbot_interfaces [1.86s, exited with code 1] Summary: 0 packages finished [2.46s] 1 package failed: fishbot_interfaces 1 package had stderr output: fishbot_interfaces
请问怎么解决?
-
@378718608 细心点 src?srv
另外先看看发帖前必看 -
@小鱼 谢谢小鱼老师,我在srv下创建了.srv接口文件,编译时遇到了一个错误,我看了之前的帖子,按照解决方法在package.xml添加了
<build_depend>rosidl_default_generators</build_depend> <exec_depend>rosidl_default_runtime</exec_depend> <member_of_group>rosidl_interface_packages</member_of_group>
但是VSCode提示了一个错误:
提示是这样:Element name 'test_depend' is invalid. One of the following is expected: - member_of_group - export Error indicated by: {the schema} with code:xml(cvc-complex-type.2.4.a)
然后我把这三行代码放到了下面,不报错:
编译也成功了。继续按文档往下操作:重新编译工程,编写代码上传到开发板(我把接口文件和main都改成了两数相加的案例),启动Agent,也连通了,但是测试的时候给了这样的提示:
The passed service type is invalid
请问怎么解决?
-
@378718608 电脑段先colcon build
-
@378718608 解决了吗啊? 我也遇到啦
ros2 pkg create --build-type ament_cmake tutorial_interfaces
直接编译 也报错 -
@378718608 The passed service type is invalid 这个问题需要先在ex_pkg目录下source install/local_setup.sh