Skip to content

Commit 372725e

Browse files
[JTC] Fix deprecated header (#610)
* [JTC] Renovate action tests (#603) * Fix deprecation of qos_event.hpp
1 parent 05d7a5e commit 372725e

File tree

5 files changed

+18
-23
lines changed

5 files changed

+18
-23
lines changed

joint_state_broadcaster/src/joint_state_broadcaster.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@
2424
#include "hardware_interface/types/hardware_interface_return_values.hpp"
2525
#include "hardware_interface/types/hardware_interface_type_values.hpp"
2626
#include "rclcpp/clock.hpp"
27+
#include "rclcpp/event_handler.hpp"
2728
#include "rclcpp/qos.hpp"
28-
#include "rclcpp/qos_event.hpp"
2929
#include "rclcpp/time.hpp"
3030
#include "rclcpp_lifecycle/lifecycle_node.hpp"
3131
#include "rcpputils/split.hpp"

joint_trajectory_controller/CMakeLists.txt

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -80,13 +80,12 @@ if(BUILD_TESTING)
8080
ros2_control_test_assets
8181
)
8282

83-
# TODO(andyz): Disabled due to flakiness
84-
# ament_add_gmock(test_trajectory_actions
85-
# test/test_trajectory_actions.cpp
86-
# )
87-
# target_link_libraries(test_trajectory_actions
88-
# joint_trajectory_controller
89-
# )
83+
ament_add_gmock(test_trajectory_actions
84+
test/test_trajectory_actions.cpp
85+
)
86+
target_link_libraries(test_trajectory_actions
87+
joint_trajectory_controller
88+
)
9089
endif()
9190

9291

joint_trajectory_controller/src/joint_trajectory_controller.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,10 @@
3131
#include "hardware_interface/types/hardware_interface_type_values.hpp"
3232
#include "joint_trajectory_controller/trajectory.hpp"
3333
#include "lifecycle_msgs/msg/state.hpp"
34+
#include "rclcpp/event_handler.hpp"
3435
#include "rclcpp/logging.hpp"
3536
#include "rclcpp/parameter.hpp"
3637
#include "rclcpp/qos.hpp"
37-
#include "rclcpp/qos_event.hpp"
3838
#include "rclcpp/time.hpp"
3939
#include "rclcpp_action/create_server.hpp"
4040
#include "rclcpp_action/server_goal_handle.hpp"

joint_trajectory_controller/test/test_trajectory_actions.cpp

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -70,17 +70,13 @@ class TestTrajectoryActions : public TrajectoryControllerTest
7070
{
7171
setup_executor_ = true;
7272

73-
executor_ = std::make_unique<rclcpp::executors::MultiThreadedExecutor>();
74-
75-
SetUpAndActivateTrajectoryController(true, parameters);
76-
77-
executor_->add_node(traj_controller_->get_node()->get_node_base_interface());
73+
SetUpAndActivateTrajectoryController(executor_, true, parameters);
7874

7975
SetUpActionClient();
8076

81-
executor_->add_node(node_->get_node_base_interface());
77+
executor_.add_node(node_->get_node_base_interface());
8278

83-
executor_future_handle_ = std::async(std::launch::async, [&]() -> void { executor_->spin(); });
79+
executor_future_handle_ = std::async(std::launch::async, [&]() -> void { executor_.spin(); });
8480
}
8581

8682
void SetUpControllerHardware()
@@ -132,7 +128,7 @@ class TestTrajectoryActions : public TrajectoryControllerTest
132128
if (setup_executor_)
133129
{
134130
setup_executor_ = false;
135-
executor_->cancel();
131+
executor_.cancel();
136132
executor_future_handle_.wait();
137133
}
138134
}
@@ -169,7 +165,7 @@ class TestTrajectoryActions : public TrajectoryControllerTest
169165
int common_action_result_code_ = control_msgs::action::FollowJointTrajectory_Result::SUCCESSFUL;
170166

171167
bool setup_executor_ = false;
172-
rclcpp::executors::MultiThreadedExecutor::UniquePtr executor_;
168+
rclcpp::executors::MultiThreadedExecutor executor_;
173169
std::future<void> executor_future_handle_;
174170

175171
bool setup_controller_hw_ = false;
@@ -417,7 +413,7 @@ TEST_F(TestTrajectoryActions, test_state_tolerances_fail)
417413
common_action_result_code_);
418414

419415
// run an update, it should be holding
420-
traj_controller_->update(rclcpp::Time(0), rclcpp::Duration::from_seconds(0.01));
416+
updateController(rclcpp::Duration::from_seconds(0.01));
421417

422418
EXPECT_NEAR(INITIAL_POS_JOINT1, joint_pos_[0], COMMON_THRESHOLD);
423419
EXPECT_NEAR(INITIAL_POS_JOINT2, joint_pos_[1], COMMON_THRESHOLD);
@@ -467,7 +463,7 @@ TEST_F(TestTrajectoryActions, test_goal_tolerances_fail)
467463
common_action_result_code_);
468464

469465
// run an update, it should be holding
470-
traj_controller_->update(rclcpp::Time(0), rclcpp::Duration::from_seconds(0.01));
466+
updateController(rclcpp::Duration::from_seconds(0.01));
471467

472468
EXPECT_NEAR(init_pos1, joint_pos_[0], COMMON_THRESHOLD);
473469
EXPECT_NEAR(init_pos2, joint_pos_[1], COMMON_THRESHOLD);
@@ -514,7 +510,7 @@ TEST_F(TestTrajectoryActions, test_no_time_from_start_state_tolerance_fail)
514510
common_action_result_code_);
515511

516512
// run an update, it should be holding
517-
traj_controller_->update(rclcpp::Time(0), rclcpp::Duration::from_seconds(0.01));
513+
updateController(rclcpp::Duration::from_seconds(0.01));
518514

519515
EXPECT_NEAR(init_pos1, joint_pos_[0], COMMON_THRESHOLD);
520516
EXPECT_NEAR(init_pos2, joint_pos_[1], COMMON_THRESHOLD);
@@ -563,7 +559,7 @@ TEST_F(TestTrajectoryActions, test_cancel_hold_position)
563559
const double prev_pos3 = joint_pos_[2];
564560

565561
// run an update, it should be holding
566-
traj_controller_->update(rclcpp::Time(0), rclcpp::Duration::from_seconds(0.01));
562+
updateController(rclcpp::Duration::from_seconds(0.01));
567563

568564
EXPECT_EQ(prev_pos1, joint_pos_[0]);
569565
EXPECT_EQ(prev_pos2, joint_pos_[1]);

joint_trajectory_controller/test/test_trajectory_controller.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,13 @@
3535
#include "lifecycle_msgs/msg/state.hpp"
3636
#include "rclcpp/clock.hpp"
3737
#include "rclcpp/duration.hpp"
38+
#include "rclcpp/event_handler.hpp"
3839
#include "rclcpp/executors/multi_threaded_executor.hpp"
3940
#include "rclcpp/executors/single_threaded_executor.hpp"
4041
#include "rclcpp/node.hpp"
4142
#include "rclcpp/parameter.hpp"
4243
#include "rclcpp/publisher.hpp"
4344
#include "rclcpp/qos.hpp"
44-
#include "rclcpp/qos_event.hpp"
4545
#include "rclcpp/subscription.hpp"
4646
#include "rclcpp/time.hpp"
4747
#include "rclcpp/utilities.hpp"

0 commit comments

Comments
 (0)