Skip to content

Commit 7b24969

Browse files
committed
fix for ROS < NOETIC
1 parent 8d909c0 commit 7b24969

File tree

2 files changed

+15
-5
lines changed

2 files changed

+15
-5
lines changed

CMakeLists.txt

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,13 @@ ADD_PROJECT_DEPENDENCY(control_toolbox REQUIRED)
5656

5757
# Detect the controller interface version to switch code
5858
if(controller_interface_FOUND)
59-
if (${controller_interface_VERSION} VERSION_GREATER "0.2.5")
59+
if(${controller_interface_VERSION} VERSION_GREATER "0.2.5")
6060
add_definitions(-DCONTROLLER_INTERFACE_KINETIC)
61-
endif(${controller_interface_VERSION} VERSION_GREATER "0.2.5")
62-
endif(controller_interface_FOUND)
61+
if(${controller_interface_VERSION} VERSION_GREATER "0.19.0")
62+
add_definitions(-DCONTROLLER_INTERFACE_NOETIC)
63+
endif()
64+
endif()
65+
endif()
6366

6467
# Detect if temperature sensor controller package is found
6568
# if yes then it is a PAL Robotics Forked code.
@@ -77,7 +80,7 @@ target_link_libraries(rcsot_controller
7780
sot-core::sot-core
7881
dynamic_graph_bridge::sot_loader
7982
${control_toolbox_LIBRARIES})
80-
if (temperature_sensor_controller_FOUND)
83+
if(temperature_sensor_controller_FOUND)
8184
target_compile_definitions(rcsot_controller PUBLIC TEMPERATURE_SENSOR_CONTROLLER)
8285
message("temperature_sensor_controller_LIBRARIES: ${temperature_sensor_controller_LIBRARIES}")
8386
target_include_directories(rcsot_controller SYSTEM PUBLIC ${temperature_sensor_controller_INCLUDE_DIRS})

src/roscontrol-sot-controller.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,11 @@ bool RCSotController::initInterfaces(lhi::RobotHW *robot_hw, ros::NodeHandle &,
172172
lns = "hardware_interface";
173173

174174
// Check if construction finished cleanly
175+
#ifdef CONTROLLER_INTERFACE_NOETIC
175176
if (state_ != ControllerState::CONSTRUCTED) {
177+
#else
178+
if (state_ != CONSTRUCTED) {
179+
#endif
176180
ROS_ERROR("Cannot initialize this controller because it "
177181
"failed to be constructed");
178182
}
@@ -319,8 +323,11 @@ bool RCSotController::initInterfaces(lhi::RobotHW *robot_hw, ros::NodeHandle &,
319323
if (verbosity_level_ > 0)
320324
ROS_INFO_STREAM("Initialization of sot-controller Ok !");
321325
// success
326+
#ifdef CONTROLLER_INTERFACE_NOETIC
322327
state_ = ControllerState::INITIALIZED;
323-
328+
#else
329+
state_ = INITIALIZED;
330+
#endif
324331
return true;
325332
}
326333

0 commit comments

Comments
 (0)