Open SENAI-GilmarCorreia opened 1 month ago
The error messages come already from ros2_control and dependencies like rclcpp_lifecycle. We do not officially support ros2_control compilation on Windows (we don't have CI for that etc..). Were your able to build the ros2_control stack (without gazebo)?
Yes, I was able to build ros2_control, ros2_controllers, and gazebo_ros_pkgs. However, some packages may be broken on Windows, such as pid_controller. I'm just curious to get this working on Windows! :)
But there is a syntax error reported in hardware_interface, how can you compile that in ros2_control? Is gazebo classic running on Windows at all? Just to avoid running into a dead end with this package here.
@christophfroehlich I used the following command:
colcon build --symlink install --packages-select hardware_interface --cmake-args -DCMAKE_PREFIX_PATH="C:/boost" -DBOOST_ROOT="C:/boost" -DBoost_NO_SYSTEM_PATHS=ON -DBUILD_TESTING=OFF -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_WINDOWS_EXPORT_ALL_SYMBOLS=ON -DPython3_EXECUTABLE="C:/Python38/python.exe"
And Gazebo is working like a charm (with a good fps). However, two plugins, gazebo_init
and gazebo_ray_sensor
from gazebo_ros_pkgs, are not working. I'm not using WSL.
Why you should get syntax errors in the file included in gazebo_ros2_control, if it works if compiled separately? Sorry, I can't help you further here, never used ROS on Windows. fyi: You will need the gazebo_ros_init plugin to have the sim_time in the ROS world
I don't know either 🤣. No problem, thank you for your support. If I find any solution to solve this installation on Windows, I'll share it with you all.
Just an update... I was able to minimize some errors using this code in the CMakeLists file:
if(WIN32)
add_compile_definitions(
# For math constants
_USE_MATH_DEFINES
# Minimize Windows namespace collision
NOMINMAX
WIN32_LEAN_AND_MEAN
)
endif()
I have tried to split the build and see which errors are related to each plugin. The log from gazebo_ros2_control
shows the following:
1>Checking Build System
Building Custom Rule C:/path/to/gazebo_ros2_control/CMakeLists.txt
gazebo_ros2_control_plugin.cpp
C:/path/to/gazebo_ros/include/gazebo_ros/node.hpp(44,1): warning C4275: no DLL interface class 'rclcpp::Node' used as the base for DLL interface class 'gazebo_ros::Node' [C:/path/to/gazebo_ros2_control.vcxproj]
C:/opt/ros/humble/include/rclcpp/rclcpp/node.hpp(77): message : see declaration of 'rclcpp::Node' [C:/path/to/gazebo_ros2_control.vcxproj]
C:/path/to/gazebo_ros/include/gazebo_ros/node.hpp(43): message : see declaration of 'gazebo_ros::Node' [C:/path/to/gazebo_ros2_control.vcxproj]
C:/path/to/controller_manager_msgs/controller_manager_msgs/srv/detail/switch_controller__struct.hpp(143,28): error C2059: syntax error: 'constant' [C:/path/to/gazebo_ros2_control.vcxproj]
C:/path/to/controller_manager_msgs/controller_manager_msgs/srv/detail/switch_controller__struct.hpp(216): message : see reference to instantiation of 'controller_manager_msgs::srv::SwitchController_Request_<ContainerAllocator>' being compiled [C:/path/to/gazebo_ros2_control.vcxproj]
C:/path/to/controller_manager_msgs/controller_manager_msgs/srv/detail/switch_controller__struct.hpp(144,1): error C2238: unexpected token(s) preceding ';' [C:/path/to/gazebo_ros2_control.vcxproj]
C:/path/to/controller_manager_msgs/controller_manager_msgs/srv/detail/switch_controller__struct.hpp(231,66): error C2589: 'constant': invalid token on right side of '::' [C:/path/to/gazebo_ros2_control.vcxproj]
C:/path/to/controller_manager_msgs/controller_manager_msgs/srv/detail/switch_controller__struct.hpp(231): error C2062: unexpected type 'unknown-type' [C:/path/to/gazebo_ros2_control.vcxproj]
C:/path/to/controller_manager_msgs/controller_manager_msgs/srv/detail/switch_controller__builder.hpp(28,3): error C2059: syntax error: ':' [C:/path/to/gazebo_ros2_control.vcxproj]
C:/path/to/controller_manager_msgs/controller_manager_msgs/srv/detail/switch_controller__builder.hpp(44,3): error C2059: syntax error: ':' [C:/path/to/gazebo_ros2_control.vcxproj]
C:/path/to/controller_manager_msgs/controller_manager_msgs/srv/detail/switch_controller__builder.hpp(60,3): error C2059: syntax error: ':' [C:/path/to/gazebo_ros2_control.vcxproj]
C:/path/to/controller_manager_msgs/controller_manager_msgs/srv/detail/switch_controller__builder.hpp(76,3): error C2059: syntax error: ':' [C:/path/to/gazebo_ros2_control.vcxproj]
C:/path/to/controller_manager_msgs/controller_manager_msgs/srv/detail/switch_controller__builder.hpp(92,3): error C2059: syntax error: ':' [C:/path/to/gazebo_ros2_control.vcxproj]
C:/path/to/controller_manager_msgs/controller_manager_msgs/srv/detail/switch_controller__builder.hpp(108,3): error C2059: syntax error: ':' [C:/path/to/gazebo_ros2_control.vcxproj]
C:/path/to/controller_manager_msgs/controller_manager_msgs/srv/detail/switch_controller__builder.hpp(124,3): error C2059: syntax error: ':' [C:/path/to/gazebo_ros2_control.vcxproj]
C:/path/to/controller_manager_msgs/controller_manager_msgs/srv/detail/switch_controller__builder.hpp(140,3): error C2059: syntax error: ':' [C:/path/to/gazebo_ros2_control.vcxproj]
C:/vcpkg/installed/x64-windows/include/google/protobuf/map.h(689,19): warning C4244: 'initializing': conversion from 'uintptr_t' to 'google::protobuf::internal::map_index_t', possible loss of data [C:/path/to/gazebo_ros2_control.vcxproj]
And the gazebo_hardware_plugins
shows these:
Building Custom Rule C:/path/to/gazebo_ros2_control/CMakeLists.txt
gazebo_system.cpp
C:/path/to/angles/include/angles/angles.h(38,1): warning C4005: '_USE_MATH_DEFINES': macro redefinition [C:/path/to/gazebo_hardware_plugins.vcxproj]
C:/path/to/gazebo_system.cpp : message : see previous definition of '_USE_MATH_DEFINES' [C:/path/to/gazebo_hardware_plugins.vcxproj]
C:/path/to/anaconda/envs/gazebo/Library/include/google/protobuf/map.h(689,19): warning C4244: 'initializing': conversion from 'uintptr_t' to 'google::protobuf::internal::map_index_t', possible loss of data [C:/path/to/gazebo_hardware_plugins.vcxproj]
C:/path/to/hardware_interface/types/hardware_interface_return_values.hpp(25,3): error C2143: syntax error: missing '}' before 'constant' [C:/path/to/gazebo_hardware_plugins.vcxproj]
C:/path/to/hardware_interface/types/hardware_interface_return_values.hpp(25,3): error C2059: syntax error: 'constant'
...
controller_manager_msgs
are genereated by rosidl, this code is not part of our repos. There must be something different in the cmake file of gazebo_ros2_control compared to ros2_control to make your build fail.
Description:
I am encountering an issue while trying to build the
gazebo_ros2_control
package on a Windows environment. The build fails with the following error log. I've anonymized any user-specific data in the output. Please advise on how to resolve this issue.Error Log (Anonymized):
Environment:
I have already installed all necessary dependencies via
vcpkg
and configured the environment variables. Please let me know if additional details are required.Steps to Reproduce:
gazebo_ros2_control
repository.colcon build
in the workspace on Windows.Expected Behavior: The build should complete successfully without errors.
Actual Behavior: The build fails with the above-mentioned errors.