动手4.3.2报错
-
完全按照教程操作,但是编译就是不通过
报错如下:(pytorch) l@l-GF63-Thin-9SC:~/桌面/town_ws/village_interfaces$ colcon build --packages-select village_interfaces Starting >>> village_interfaces --- stderr: village_interfaces CMake Error at /opt/ros/eloquent/share/rosidl_cmake/cmake/rosidl_generate_interfaces.cmake:240 (list): list index: 1 out of range (-1, 0) Call Stack (most recent call first): CMakeLists.txt:40 (rosidl_generate_interfaces) CMake Error at /opt/ros/eloquent/share/rosidl_generator_cpp/cmake/rosidl_generator_cpp_generate_interfaces.cmake:57 (message): Target dependency '/town_ws/village_interfaces/build/village_interfaces/rosidl_adapter/village_interfaces/msg/Novel.idl' does not exist Call Stack (most recent call first): /opt/ros/eloquent/share/ament_cmake_core/cmake/core/ament_execute_extensions.cmake:48 (include) /opt/ros/eloquent/share/rosidl_cmake/cmake/rosidl_generate_interfaces.cmake:286 (ament_execute_extensions) CMakeLists.txt:40 (rosidl_generate_interfaces) --- Failed <<< village_interfaces [0.53s, exited with code 1] Summary: 0 packages finished [0.67s] 1 package failed: village_interfaces 1 package had stderr output: village_interfaces
-
@小鱼 我用win电脑装了个vm配置了u20。装的ros2-rolling就好使。醉了
-
@505106035 看一下你的
- 消息定义文件
- CMakeLists.txt
- 目录结构
-
@小鱼
消息定义文件如下:# 直接使用ROS2原始的数据类型 string content # 图像消息,调用sensor_msgs下的Image类型 sensor_msgs/Image image
cmake.txt如下:
cmake_minimum_required(VERSION 3.5) project(village_interfaces) # Default to C99 if(NOT CMAKE_C_STANDARD) set(CMAKE_C_STANDARD 99) endif() # Default to C++14 if(NOT CMAKE_CXX_STANDARD) set(CMAKE_CXX_STANDARD 14) endif() if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") add_compile_options(-Wall -Wextra -Wpedantic) endif() # find dependencies find_package(ament_cmake REQUIRED) #添加对sensor_msgs的 find_package(sensor_msgs REQUIRED) find_package(rosidl_default_generators REQUIRED) #添加消息文件和依赖 rosidl_generate_interfaces(${PROJECT_NAME} #---msg--- "msg/Novel.msg" DEPENDENCIES sensor_msgs ) # uncomment the following section in order to fill in # further dependencies manually. # find_package(<dependency> REQUIRED) if(BUILD_TESTING) find_package(ament_lint_auto REQUIRED) # the following line skips the linter which checks for copyrights # uncomment the line when a copyright and license is not present in all source files #set(ament_cmake_copyright_FOUND TRUE) # the following line skips cpplint (only works in a git repo) # uncomment the line when this package is not in a git repo #set(ament_cmake_cpplint_FOUND TRUE) ament_lint_auto_find_test_dependencies() endif() ament_package()
目录结构如下:
(pytorch) l@l-GF63-Thin-9SC:~/桌面/town_ws/village_interfaces$ tree . ├── CMakeLists.txt ├── include │ └── village_interfaces ├── msg │ └── Novel.msg ├── package.xml └── src 4 directories, 3 files
-
此回复已被删除! -
@505106035 复制粘贴你的代码我做了一下测试,编译没问题,除了
packages.xml
需要增加一个<member_of_group>rosidl_interface_packages</member_of_group>
增加完后
<?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>village_interfaces</name> <version>0.0.0</version> <description>TODO: Package description</description> <maintainer email="fishros@foxmail.com">pear</maintainer> <license>TODO: License declaration</license> <buildtool_depend>ament_cmake</buildtool_depend> <test_depend>ament_lint_auto</test_depend> <test_depend>ament_lint_common</test_depend> <member_of_group>rosidl_interface_packages</member_of_group> <export> <build_type>ament_cmake</build_type> </export> </package>
你可以试试
-
@小鱼 确认上下文有ros2环境,试试colcon build指令(不加packages-select)
-
@小鱼 不行。还是同样的报错。难道是我用的ubuntu18.04配置的ros2-eloquent这个版本和教程不一样?我看那个一键安装的ros2的脚本就只有到eloquent这个版本
-
@小鱼
如下:(pytorch) l@l-GF63-Thin-9SC:~/桌面/town_ws$ ros2 usage: ros2 [-h] Call `ros2 <command> -h` for more detailed usage. ... ros2 is an extensible command-line tool for ROS 2. optional arguments: -h, --help show this help message and exit Commands: action Various action related sub-commands component Various component related sub-commands daemon Various daemon related sub-commands doctor Check ROS setup and other potential issues interface Show information about ROS interfaces launch Run a launch file lifecycle Various lifecycle related sub-commands msg Various msg related sub-commands multicast Various multicast related sub-commands node Various node related sub-commands param Various param related sub-commands pkg Various package related sub-commands run Run a package specific executable security Various security related sub-commands service Various service related sub-commands srv Various srv related sub-commands topic Various topic related sub-commands wtf Use `wtf` as alias to `doctor` Call `ros2 <command> -h` for more detailed usage.
运行colcon build:
(pytorch) l@l-GF63-Thin-9SC:~/桌面/town_ws$ colcon build Starting >>> village_interfaces Starting >>> village_li Starting >>> village_wang Finished <<< village_wang [0.47s] --- stderr: village_interfaces CMake Error at /opt/ros/eloquent/share/rosidl_cmake/cmake/rosidl_generate_interfaces.cmake:240 (list): list index: 1 out of range (-1, 0) Call Stack (most recent call first): CMakeLists.txt:24 (rosidl_generate_interfaces) CMake Error at /opt/ros/eloquent/share/rosidl_generator_cpp/cmake/rosidl_generator_cpp_generate_interfaces.cmake:57 (message): Target dependency '/town_ws/build/village_interfaces/rosidl_adapter/village_interfaces/msg/Novel.idl' does not exist Call Stack (most recent call first): /opt/ros/eloquent/share/ament_cmake_core/cmake/core/ament_execute_extensions.cmake:48 (include) /opt/ros/eloquent/share/rosidl_cmake/cmake/rosidl_generate_interfaces.cmake:286 (ament_execute_extensions) CMakeLists.txt:24 (rosidl_generate_interfaces) --- Failed <<< village_interfaces [0.60s, exited with code 1] Aborted <<< village_li [0.82s] Summary: 1 package finished [0.97s] 1 package failed: village_interfaces 1 package aborted: village_li 1 package had stderr output: village_interfaces
还是一样的报错,就说cmake的错,
CMake Error at /opt/ros/eloquent/share/rosidl_cmake/cmake/rosidl_generate_interfaces.cmake:240 (list): list index: 1 out of range (-1, 0) Call Stack (most recent call first): CMakeLists.txt:24 (rosidl_generate_interfaces)
简直头疼,不知道什么毛病。
-
@505106035 版本问题有很大可能,你用的版本已经停止维护有一段时间了。
-
@505106035 ubuntu18上没有foxy版本,只有ubuntu20才支持
-
@小鱼 我用win电脑装了个vm配置了u20。装的ros2-rolling就好使。醉了
-
@505106035 ROS2前几个版本更新的很快,所以差异比较大
-
-
此回复已被删除! -
@小鱼 鱼哥,我的系统版本是22.04.3,ROS版本是humble,和上面的问题有点类似,但感觉不太一样,应该怎么解决??
列表回复: 动手4.3.2报错
liu@liu-virtual-machine:~/桌面$ git clone https://github.com/fishros/fishbot.git -b v1.0.0 --depth=1 fatal: destination path 'fishbot' already exists and is not an empty directory. liu@liu-virtual-machine:~/桌面$ liu@liu-virtual-machine:~/桌面$ cd fishbot liu@liu-virtual-machine:~/桌面/fishbot$ rosdep install --from-paths src --ignore-src -y -r # 安装依赖 #All required rosdeps installed successfully liu@liu-virtual-machine:~/桌面/fishbot$ colcon build Starting >>> fishbot_bringup Starting >>> fishbot_cartographer Finished <<< fishbot_cartographer [0.19s] Starting >>> fishbot_description Finished <<< fishbot_bringup [0.28s] Starting >>> fishbot_interfaces --- stderr: fishbot_interfaces CMake Error at /opt/ros/humble/share/rosidl_cmake/cmake/rosidl_generate_interfaces.cmake:240 (list): list index: 1 out of range (-1, 0) Call Stack (most recent call first): CMakeLists.txt:29 (rosidl_generate_interfaces) CMake Error at /opt/ros/humble/share/rosidl_generator_c/cmake/rosidl_generator_c_generate_interfaces.cmake:69 (message): Target dependency '/fishbot/build/fishbot_interfaces/rosidl_adapter/fishbot_interfaces/srv/FishBotConfig.idl' does not exist Call Stack (most recent call first): /opt/ros/humble/share/ament_cmake_core/cmake/core/ament_execute_extensions.cmake:48 (include) /opt/ros/humble/share/rosidl_cmake/cmake/rosidl_generate_interfaces.cmake:286 (ament_execute_extensions) CMakeLists.txt:29 (rosidl_generate_interfaces) --- Failed <<< fishbot_interfaces [0.44s, exited with code 1] Aborted <<< fishbot_description [0.56s] Summary: 2 packages finished [1.20s] 1 package failed: fishbot_interfaces 1 package aborted: fishbot_description 2 packages had stderr output: fishbot_description fishbot_interfaces 1 package not processed
-
@751365166 尽量避免路径中出现中文,这会产生很多未定义行为。(ROS开发者可不会想到你会输入除英文以外的路径哈哈
-
@ganyuanzhen 我懂了!!!感谢,问题出在,我应该新建一个英文名称的文件夹,然后在新建文件中运行终端命令!而不应该直接在桌面运行终端。
liu@liu-virtual-machine:~/ROS$ git clone https://github.com/fishros/fishbot.git -b v1.0.0 --depth=1 Cloning into 'fishbot'... remote: Enumerating objects: 84, done. remote: Counting objects: 100% (84/84), done. remote: Compressing objects: 100% (69/69), done. remote: Total 84 (delta 21), reused 46 (delta 7), pack-reused 0 Receiving objects: 100% (84/84), 332.98 KiB | 422.00 KiB/s, done. Resolving deltas: 100% (21/21), done. liu@liu-virtual-machine:~/ROS$ cd fishbot liu@liu-virtual-machine:~/ROS/fishbot$ rosdep install --from-paths src --ignore-src -y -r # 安装依赖 #All required rosdeps installed successfully liu@liu-virtual-machine:~/ROS/fishbot$ colcon build Starting >>> fishbot_bringup Starting >>> fishbot_cartographer Finished <<< fishbot_cartographer [0.53s] Starting >>> fishbot_description Finished <<< fishbot_description [0.57s] Starting >>> fishbot_interfaces Finished <<< fishbot_interfaces [7.94s] Starting >>> fishbot_navigation2 Finished <<< fishbot_navigation2 [0.63s] Finished <<< fishbot_bringup [13.5s] Summary: 5 packages finished [13.9s]