Skip to content

Commit 2dcb86e

Browse files
Make ur_controllers compileable on humble (#1207)
No += overload for Duration class on humble
1 parent 89eaadb commit 2dcb86e

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

ur_controllers/src/passthrough_trajectory_controller.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444

4545
#include <controller_interface/controller_interface.hpp>
4646
#include <rclcpp/logging.hpp>
47+
#include <rclcpp/version.h>
4748
#include <builtin_interfaces/msg/duration.hpp>
4849
#include <lifecycle_msgs/msg/state.hpp>
4950

@@ -327,8 +328,12 @@ controller_interface::return_type PassthroughTrajectoryController::update(const
327328
scaling_factor_ = scaling_state_interface_->get().get_value();
328329
}
329330

331+
#if RCLCPP_VERSION_MAJOR >= 17
330332
active_trajectory_elapsed_time_ += period * scaling_factor_;
331-
333+
#else
334+
// This is kept for Humble compatibility
335+
active_trajectory_elapsed_time_ = active_trajectory_elapsed_time_ + period * scaling_factor_;
336+
#endif
332337
// RCLCPP_INFO(get_node()->get_logger(), "Elapsed trajectory time: %f. Scaling factor: %f, period: %f",
333338
// active_trajectory_elapsed_time_.seconds(), scaling_factor_, period.seconds());
334339

0 commit comments

Comments
 (0)