Skip to content

Commit

Permalink
Improve comparison (#590)
Browse files Browse the repository at this point in the history
* Improve

* Minor

* Fix
  • Loading branch information
ad-daniel authored Jan 5, 2023
1 parent e85b00d commit db38ed5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
7 changes: 2 additions & 5 deletions webots_ros2_control/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,8 @@ find_package(rclcpp REQUIRED)
find_package(rclcpp_lifecycle REQUIRED)
find_package(webots_ros2_driver REQUIRED)

# Necessary hotfix for renamed variables present in "hardware_interface" package for versions above 3.5 (https://github.com/cyberbotics/webots_ros2/pull/584)
if(${hardware_interface_VERSION_MAJOR} GREATER_EQUAL "3" AND ${hardware_interface_VERSION_MINOR} GREATER_EQUAL "5")
message("Using hardware_interface version ${hardware_interface_VERSION}")
add_compile_definitions(HARDWARE_INTERFACE_VARIABLE_RENAMING)
endif()
add_compile_definitions(HARDWARE_INTERFACE_VERSION_MAJOR=${hardware_interface_VERSION_MAJOR})
add_compile_definitions(HARDWARE_INTERFACE_VERSION_MINOR=${hardware_interface_VERSION_MINOR})

if (MSVC OR MSYS OR MINGW OR WIN32)
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
Expand Down
3 changes: 2 additions & 1 deletion webots_ros2_control/src/Ros2Control.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,8 @@ namespace webots_ros2_control
for (unsigned int i = 0; i < controlHardware.size(); i++)
{

#if HARDWARE_INTERFACE_VARIABLE_RENAMING
// Necessary hotfix for renamed variables present in "hardware_interface" package for versions above 3.5 (#590)
#if HARDWARE_INTERFACE_VERSION_MAJOR >= 3 && HARDWARE_INTERFACE_VERSION_MINOR >= 5
const std::string pluginName = controlHardware[i].hardware_plugin_name;
auto webotsSystem = std::unique_ptr<webots_ros2_control::Ros2ControlSystemInterface>(
mHardwareLoader->createUnmanagedInstance(pluginName));
Expand Down

0 comments on commit db38ed5

Please sign in to comment.