Reputation: 1
Setup Ros2 on a windows device using binaries and following the Ros installation guide upon attempting the first tutorials on the page. when attempting to build the package using the following command I get the below error.
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)
I can see setuptools 65.6.3 in pip list which contains pkg_resources.
I have tested on another computer and other examples from the Ros 2 documentation and I get the same error every time. the error is identical to the problem discussed here. however both of the links provided were ultimately unfruitful. any insight into what the problem is and how it could be solved would be helpful.
edit: here is the CMakeList.txt file that seems to be the problem
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()
Upvotes: 0
Views: 614
Reputation: 1
Okay, so the solution was to install ROS2 via Microsoft IOT's ROS2 windows setup. Sadly I don't know what the problem was to begin with, but this is a decent workaround for anyone having problems installing ROS 2 foxy fitzroy on windows.
Upvotes: 0