-
Notifications
You must be signed in to change notification settings - Fork 363
Fix exclusive hardware control mode switching on controller failed activation #1522
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
saikishor
wants to merge
31
commits into
ros-controls:master
Choose a base branch
from
saikishor:fix/exclusive_hw_interface_switching
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+267
−12
Open
Changes from 18 commits
Commits
Show all changes
31 commits
Select commit
Hold shift + click to select a range
6170d85
added an actuator interface with exclusive interface handling
813c1d8
ran precommit
943329e
renamed into test_actuator_exclusive_interfaces
34c5435
added a test controller that fails at activation
a57c700
forgot to run pre-commit
65a8f0d
Fix issues in the setup of the test controller that fails on activate
saikishor ea39ab7
Added test to reproduce the failure of switching with exclusive inter…
saikishor f9e7502
add the perform switching logic to fix the issue with exclusive inter…
saikishor 0a18994
remove the scoping
saikishor c0cb32f
Collect all failed activated controllers and perform command switch a…
saikishor b03e680
added some documentation about the determinism
saikishor 7a9ad21
add naming changes from state to lifecycle_state
saikishor 710e5ea
remove copy pasta remnants from comments
bmagyar 213737f
Fix pre-commit
saikishor 1c513a7
Remove visibility macros from the test controller
saikishor 31191b4
Fix the switch return to ERROR due to recent change in return state o…
saikishor 0cee0ca
Update controller_manager/doc/userdoc.rst
saikishor 001a322
remove duplicated descriptions
saikishor 38f9505
Merge branch 'master' into fix/exclusive_hw_interface_switching
saikishor e52fd3a
Fix pre-commit
christophfroehlich 3141a50
Merge branch 'master' into fix/exclusive_hw_interface_switching
saikishor 1977792
Merge branch 'master' into fix/exclusive_hw_interface_switching
saikishor a6b613d
Merge branch 'master' into fix/exclusive_hw_interface_switching
saikishor 28c39b0
Apply suggestions from code review
saikishor b8e157b
Merge branch 'master' into fix/exclusive_hw_interface_switching
saikishor a57c717
Merge branch 'master' into fix/exclusive_hw_interface_switching
saikishor b15cbcc
Merge branch 'master' into fix/exclusive_hw_interface_switching
saikishor 6584d6c
Merge branch 'master' into fix/exclusive_hw_interface_switching
saikishor dc348e0
Merge branch 'master' into fix/exclusive_hw_interface_switching
saikishor 57c0673
Merge branch 'master' into fix/exclusive_hw_interface_switching
saikishor 2d47d41
Merge branch 'master' into fix/exclusive_hw_interface_switching
saikishor File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
66 changes: 66 additions & 0 deletions
66
controller_manager/test/test_controller_failed_activate/test_controller_failed_activate.cpp
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
// Copyright 2021 Department of Engineering Cybernetics, NTNU. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
#include "test_controller_failed_activate.hpp" | ||
|
||
#include <memory> | ||
#include <string> | ||
|
||
#include "lifecycle_msgs/msg/transition.hpp" | ||
|
||
namespace test_controller_failed_activate | ||
{ | ||
TestControllerFailedActivate::TestControllerFailedActivate() | ||
: controller_interface::ControllerInterface() | ||
{ | ||
} | ||
|
||
rclcpp_lifecycle::node_interfaces::LifecycleNodeInterface::CallbackReturn | ||
TestControllerFailedActivate::on_init() | ||
{ | ||
return rclcpp_lifecycle::node_interfaces::LifecycleNodeInterface::CallbackReturn::SUCCESS; | ||
} | ||
|
||
controller_interface::return_type TestControllerFailedActivate::update( | ||
const rclcpp::Time & /*time*/, const rclcpp::Duration & /*period*/) | ||
{ | ||
return controller_interface::return_type::OK; | ||
} | ||
|
||
rclcpp_lifecycle::node_interfaces::LifecycleNodeInterface::CallbackReturn | ||
TestControllerFailedActivate::on_configure(const rclcpp_lifecycle::State & /*previous_state&*/) | ||
{ | ||
return rclcpp_lifecycle::node_interfaces::LifecycleNodeInterface::CallbackReturn::SUCCESS; | ||
} | ||
|
||
rclcpp_lifecycle::node_interfaces::LifecycleNodeInterface::CallbackReturn | ||
TestControllerFailedActivate::on_activate(const rclcpp_lifecycle::State & /*previous_state&*/) | ||
{ | ||
// Simply simulate a controller that can not be activated | ||
return rclcpp_lifecycle::node_interfaces::LifecycleNodeInterface::CallbackReturn::FAILURE; | ||
} | ||
|
||
rclcpp_lifecycle::node_interfaces::LifecycleNodeInterface::CallbackReturn | ||
TestControllerFailedActivate::on_cleanup(const rclcpp_lifecycle::State & /*previous_state*/) | ||
{ | ||
return rclcpp_lifecycle::node_interfaces::LifecycleNodeInterface::CallbackReturn::SUCCESS; | ||
} | ||
|
||
} // namespace test_controller_failed_activate | ||
|
||
#include "pluginlib/class_list_macros.hpp" | ||
|
||
PLUGINLIB_EXPORT_CLASS( | ||
test_controller_failed_activate::TestControllerFailedActivate, | ||
controller_interface::ControllerInterface) |
67 changes: 67 additions & 0 deletions
67
controller_manager/test/test_controller_failed_activate/test_controller_failed_activate.hpp
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
// Copyright 2020 Department of Engineering Cybernetics, NTNU | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
#ifndef TEST_CONTROLLER_FAILED_ACTIVATE__TEST_CONTROLLER_FAILED_ACTIVATE_HPP_ | ||
#define TEST_CONTROLLER_FAILED_ACTIVATE__TEST_CONTROLLER_FAILED_ACTIVATE_HPP_ | ||
|
||
#include <memory> | ||
#include <string> | ||
|
||
#include "controller_manager/controller_manager.hpp" | ||
|
||
namespace test_controller_failed_activate | ||
{ | ||
// Corresponds to the name listed within the pluginglib xml | ||
constexpr char TEST_CONTROLLER_WITH_INTERFACES_CLASS_NAME[] = | ||
"controller_manager/test_controller_failed_activate"; | ||
// Corresponds to the command interface to claim | ||
constexpr char TEST_CONTROLLER_COMMAND_INTERFACE[] = "joint2/velocity"; | ||
class TestControllerFailedActivate : public controller_interface::ControllerInterface | ||
{ | ||
public: | ||
TestControllerFailedActivate(); | ||
|
||
virtual ~TestControllerFailedActivate() = default; | ||
|
||
controller_interface::InterfaceConfiguration command_interface_configuration() const override | ||
{ | ||
return controller_interface::InterfaceConfiguration{ | ||
controller_interface::interface_configuration_type::INDIVIDUAL, | ||
{TEST_CONTROLLER_COMMAND_INTERFACE}}; | ||
} | ||
|
||
controller_interface::InterfaceConfiguration state_interface_configuration() const override | ||
{ | ||
return controller_interface::InterfaceConfiguration{ | ||
controller_interface::interface_configuration_type::NONE}; | ||
} | ||
|
||
controller_interface::return_type update( | ||
const rclcpp::Time & time, const rclcpp::Duration & period) override; | ||
|
||
rclcpp_lifecycle::node_interfaces::LifecycleNodeInterface::CallbackReturn on_init() override; | ||
|
||
rclcpp_lifecycle::node_interfaces::LifecycleNodeInterface::CallbackReturn on_configure( | ||
const rclcpp_lifecycle::State & previous_state) override; | ||
|
||
rclcpp_lifecycle::node_interfaces::LifecycleNodeInterface::CallbackReturn on_activate( | ||
const rclcpp_lifecycle::State & previous_state) override; | ||
|
||
rclcpp_lifecycle::node_interfaces::LifecycleNodeInterface::CallbackReturn on_cleanup( | ||
const rclcpp_lifecycle::State & previous_state) override; | ||
}; | ||
|
||
} // namespace test_controller_failed_activate | ||
|
||
#endif // TEST_CONTROLLER_FAILED_ACTIVATE__TEST_CONTROLLER_FAILED_ACTIVATE_HPP_ |
9 changes: 9 additions & 0 deletions
9
controller_manager/test/test_controller_failed_activate/test_controller_failed_activate.xml
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<library path="test_controller_failed_activate"> | ||
|
||
<class name="controller_manager/test_controller_failed_activate" type="test_controller_failed_activate::TestControllerFailedActivate" base_class_type="controller_interface::ControllerInterface"> | ||
<description> | ||
Controller used for testing | ||
</description> | ||
</class> | ||
|
||
</library> |
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
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
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.