在Windows设备上使用二进制文件安装Ros2,并在尝试页面上的第一个tutorials时遵循Ros installation guide。当尝试使用以下命令构建包时,我得到以下错误。
colcon build --merge-install
Starting >>> test1
--- stderr: test1
Traceback (most recent call last):
File "C:\Program Files\ros2-windows\share\ament_cmake_core\cmake\package_templates\templates_2_cmake.py", line 21, in <module>
from ament_package.templates import get_environment_hook_template_path
File "C:\Program Files\ros2-windows\Lib\site-packages\ament_package\templates.py", line 18, in <module>
import pkg_resources
ModuleNotFoundError: No module named 'pkg_resources'
CMake Error at C:/Program Files/ros2-windows/share/ament_cmake_core/cmake/ament_cmake_package_templates-extras.cmake:41 (message):
execute_process(C:/msys64/mingw64/bin/python3.exe C:/Program
Files/ros2-windows/share/ament_cmake_core/cmake/package_templates/templates_2_cmake.py
C:/Users/spero/Documents/GitHub/Robotic_Arm/01_Prototypes/03_Elephant/00_ROS/build/test1/ament_cmake_package_templates/templates.cmake)
returned error code 1
Call Stack (most recent call first):
C:/Program Files/ros2-windows/share/ament_cmake_core/cmake/ament_cmake_coreConfig.cmake:41 (include)
C:/Program Files/ros2-windows/share/ament_cmake/cmake/ament_cmake_export_dependencies-extras.cmake:15 (find_package)
C:/Program Files/ros2-windows/share/ament_cmake/cmake/ament_cmakeConfig.cmake:41 (include)
CMakeLists.txt:19 (find_package)
---
Failed <<< test1 [1.98s, exited with code 1]
Summary: 0 packages finished [2.23s]
1 package failed: test1
1 package had stderr output: test1
WNDPROC return value cannot be converted to LRESULT
TypeError: WPARAM is simple, so must be an int object (got NoneType)
我可以在包含pkg_resources的pip列表中看到setuptools 65.6.3。
我已经在另一台计算机上测试过,并从Ros 2文档的其他例子,我得到相同的错误每一次。错误是相同的问题讨论here。然而,提供的两个链接最终都是徒劳的。任何洞察问题是什么,以及如何解决它将是有帮助的。
编辑:这里是CMakeList.txt文件,似乎是问题所在
cmake_minimum_required(VERSION 3.5)
project(turtlesim)
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_package(ament_cmake REQUIRED)
find_package(ament_index_cpp REQUIRED)
find_package(geometry_msgs REQUIRED)
find_package(Qt5 REQUIRED COMPONENTS Widgets)
find_package(rclcpp REQUIRED)
find_package(rclcpp_action REQUIRED)
find_package(rosidl_default_generators REQUIRED)
find_package(std_msgs REQUIRED)
find_package(std_srvs REQUIRED)
include_directories(include ${Qt5Widgets_INCLUDE_DIRS})
rosidl_generate_interfaces(${PROJECT_NAME}
"action/RotateAbsolute.action"
"msg/Color.msg"
"msg/Pose.msg"
"srv/Kill.srv"
"srv/SetPen.srv"
"srv/Spawn.srv"
"srv/TeleportAbsolute.srv"
"srv/TeleportRelative.srv")
set(dependencies "ament_index_cpp" "geometry_msgs" "rclcpp" "rclcpp_action" "std_msgs" "std_srvs")
set(turtlesim_node_SRCS
src/turtlesim.cpp
src/turtle.cpp
src/turtle_frame.cpp
)
set(turtlesim_node_HDRS
include/turtlesim/turtle_frame.h
)
qt5_wrap_cpp(turtlesim_node_MOCS ${turtlesim_node_HDRS})
add_executable(turtlesim_node ${turtlesim_node_SRCS} ${turtlesim_node_MOCS})
target_link_libraries(turtlesim_node Qt5::Widgets)
ament_target_dependencies(turtlesim_node ${dependencies})
rosidl_target_interfaces(turtlesim_node ${PROJECT_NAME} "rosidl_typesupport_cpp")
add_executable(turtle_teleop_key tutorials/teleop_turtle_key.cpp)
ament_target_dependencies(turtle_teleop_key ${dependencies})
rosidl_target_interfaces(turtle_teleop_key ${PROJECT_NAME} "rosidl_typesupport_cpp")
add_executable(draw_square tutorials/draw_square.cpp)
ament_target_dependencies(draw_square ${dependencies})
rosidl_target_interfaces(draw_square ${PROJECT_NAME} "rosidl_typesupport_cpp")
add_executable(mimic tutorials/mimic.cpp)
ament_target_dependencies(mimic ${dependencies})
rosidl_target_interfaces(mimic ${PROJECT_NAME} "rosidl_typesupport_cpp")
install(TARGETS turtlesim_node turtle_teleop_key draw_square mimic
DESTINATION lib/${PROJECT_NAME})
install(DIRECTORY images
DESTINATION share/${PROJECT_NAME}
FILES_MATCHING PATTERN "*.png" PATTERN "*.svg")
install(DIRECTORY launch
DESTINATION share/${PROJECT_NAME})
ament_package()
1条答案
按热度按时间2izufjch1#
好吧,所以解决方案是通过微软IOT的ROS2 windows setup安装ROS2。可悲的是,我不知道问题是什么开始,但这是一个体面的变通办法,任何人有问题安装ROS 2 foxy fitzroy在windows上。