Migrate tests to use new Handle API#2369
Open
saikishor wants to merge 6 commits into
Open
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #2369 +/- ##
==========================================
- Coverage 86.71% 86.66% -0.05%
==========================================
Files 148 148
Lines 15832 15818 -14
Branches 1347 1347
==========================================
- Hits 13728 13709 -19
- Misses 1609 1612 +3
- Partials 495 497 +2
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
e7655aa to
6e69ff6
Compare
christophfroehlich
requested changes
Jun 19, 2026
christophfroehlich
left a comment
Member
There was a problem hiding this comment.
In principle LGTM, but I suppose another cleanup round, using the member variables with std::to_string() if they are used in the test assertions later.
Comment on lines
+57
to
+60
| const std::vector<double> joint_states_ = {1.1}; | ||
|
|
||
| StateInterface::SharedPtr joint_1_pos_ = | ||
| std::make_shared<StateInterface>(joint_names_[0], HW_IF_POSITION, &joint_states_[0]); | ||
| std::make_shared<StateInterface>(joint_names_[0], HW_IF_POSITION, "double", "1.1"); |
Member
There was a problem hiding this comment.
Suggested change
| const std::vector<double> joint_states_ = {1.1}; | |
| StateInterface::SharedPtr joint_1_pos_ = | |
| std::make_shared<StateInterface>(joint_names_[0], HW_IF_POSITION, &joint_states_[0]); | |
| std::make_shared<StateInterface>(joint_names_[0], HW_IF_POSITION, "double", "1.1"); | |
| const std::vector<double> joint_states_ = {1.1}; | |
| StateInterface::SharedPtr joint_1_pos_ = std::make_shared<StateInterface>( | |
| joint_names_[0], HW_IF_POSITION, "double", std::to_string(joint_states_[0])); |
or remove the joint_states_ member (used twice in cpp)
Comment on lines
+50
to
56
| const std::vector<double> joint_states_ = {1.1, 2.2}; | ||
|
|
||
| StateInterface::SharedPtr joint_1_pos_ = | ||
| std::make_shared<StateInterface>(joint_names_[0], HW_IF_POSITION, &joint_states_[0]); | ||
| std::make_shared<StateInterface>(joint_names_[0], HW_IF_POSITION, "double", "1.1"); | ||
| StateInterface::SharedPtr joint_2_pos_ = | ||
| std::make_shared<StateInterface>(joint_names_[1], HW_IF_POSITION, &joint_states_[1]); | ||
| std::make_shared<StateInterface>(joint_names_[1], HW_IF_POSITION, "double", "2.2"); | ||
| rclcpp::executors::SingleThreadedExecutor executor; |
Member
There was a problem hiding this comment.
Suggested change
| const std::vector<double> joint_states_ = {1.1, 2.2}; | |
| StateInterface::SharedPtr joint_1_pos_ = | |
| std::make_shared<StateInterface>(joint_names_[0], HW_IF_POSITION, &joint_states_[0]); | |
| std::make_shared<StateInterface>(joint_names_[0], HW_IF_POSITION, "double", "1.1"); | |
| StateInterface::SharedPtr joint_2_pos_ = | |
| std::make_shared<StateInterface>(joint_names_[1], HW_IF_POSITION, &joint_states_[1]); | |
| std::make_shared<StateInterface>(joint_names_[1], HW_IF_POSITION, "double", "2.2"); | |
| rclcpp::executors::SingleThreadedExecutor executor; | |
| const std::vector<double> joint_states_ = {1.1, 2.2}; | |
| StateInterface::SharedPtr joint_1_pos_ = std::make_shared<StateInterface>( | |
| joint_names_[0], HW_IF_POSITION, "double", std::to_string(joint_states_[0])); | |
| StateInterface::SharedPtr joint_2_pos_ = std::make_shared<StateInterface>( | |
| joint_names_[0], HW_IF_POSITION, "double", std::to_string(joint_states_[1])); |
Member
There was a problem hiding this comment.
hardware_interface::StateInterface::SharedPtr range_ =
std::make_shared<hardware_interface::StateInterface>(
sensor_name_, "range", "double", std::to_string(sensor_range_));
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This changes the StateInterface and CommandInterfaces used inside the tests to use the new Handles API and to move away from the deprecated API, so it'll be easier to break the API of the Handle where it needed a variable reference parsed. This is the first step toward that direction