-
Notifications
You must be signed in to change notification settings - Fork 466
resource loaning #224
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
Merged
Merged
resource loaning #224
Changes from 17 commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
5c0f0a7
introducing handles
Karsten1987 2549beb
component interfaces & tests
Karsten1987 a0979c0
linters
Karsten1987 223f211
import resource manager
Karsten1987 059f96a
correct year
Karsten1987 891e3c6
import handles from loaded components
Karsten1987 68dadd7
wip / debug
Karsten1987 b87640c
parse components
Karsten1987 37fc3d8
changes after rebase
Karsten1987 f2e9432
component parser as shared library
Karsten1987 184fc24
validate urdf configuratin
Karsten1987 9f632e3
documentation
Karsten1987 56b11f4
remove default constructor
Karsten1987 f6f682a
resource loaning
Karsten1987 3deba8d
loan state interface
Karsten1987 7ac53d5
import externally declared components
Karsten1987 d09d5a4
Merge remote-tracking branch 'origin/master' into resource_loaning
Karsten1987 76a8e5c
move resource manager to hardware interface (#226)
Karsten1987 39e87e6
address review comments
Karsten1987 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
68 changes: 68 additions & 0 deletions
68
controller_manager/include/controller_manager/loaned_command_interface.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,68 @@ | ||
| // Copyright 2020 Open Source Robotics Foundation, Inc. | ||
| // | ||
| // 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 CONTROLLER_MANAGER__LOANED_COMMAND_INTERFACE_HPP_ | ||
| #define CONTROLLER_MANAGER__LOANED_COMMAND_INTERFACE_HPP_ | ||
|
|
||
| #include <utility> | ||
|
|
||
| #include "hardware_interface/handle.hpp" | ||
|
|
||
| namespace controller_manager | ||
| { | ||
|
|
||
| class LoanedCommandInterface | ||
| { | ||
| public: | ||
| using Deleter = std::function<void (void)>; | ||
|
|
||
| explicit LoanedCommandInterface(hardware_interface::CommandInterface & command_interface) | ||
| : LoanedCommandInterface(command_interface, nullptr) | ||
| {} | ||
|
|
||
| LoanedCommandInterface( | ||
| hardware_interface::CommandInterface & command_interface, | ||
| Deleter && deleter) | ||
| : command_interface_(command_interface), | ||
| deleter_(std::forward<Deleter>(deleter)) | ||
| {} | ||
|
|
||
| LoanedCommandInterface(const LoanedCommandInterface & other) = delete; | ||
|
|
||
| LoanedCommandInterface(LoanedCommandInterface && other) = default; | ||
|
|
||
| virtual ~LoanedCommandInterface() | ||
| { | ||
| if (deleter_) { | ||
| deleter_(); | ||
| } | ||
| } | ||
|
|
||
| void set_value(double val) | ||
| { | ||
| command_interface_.set_value(val); | ||
| } | ||
|
|
||
| double get_value() | ||
|
Karsten1987 marked this conversation as resolved.
Outdated
|
||
| { | ||
| return command_interface_.get_value(); | ||
| } | ||
|
|
||
| private: | ||
|
Karsten1987 marked this conversation as resolved.
Outdated
|
||
| hardware_interface::CommandInterface & command_interface_; | ||
| Deleter deleter_; | ||
| }; | ||
|
|
||
| } // namespace controller_manager | ||
| #endif // CONTROLLER_MANAGER__LOANED_COMMAND_INTERFACE_HPP_ | ||
63 changes: 63 additions & 0 deletions
63
controller_manager/include/controller_manager/loaned_state_interface.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,63 @@ | ||
| // Copyright 2020 Open Source Robotics Foundation, Inc. | ||
| // | ||
| // 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 CONTROLLER_MANAGER__LOANED_STATE_INTERFACE_HPP_ | ||
| #define CONTROLLER_MANAGER__LOANED_STATE_INTERFACE_HPP_ | ||
|
|
||
| #include <utility> | ||
|
|
||
| #include "hardware_interface/handle.hpp" | ||
|
|
||
| namespace controller_manager | ||
| { | ||
|
|
||
| class LoanedStateInterface | ||
| { | ||
| public: | ||
| using Deleter = std::function<void (void)>; | ||
|
|
||
| explicit LoanedStateInterface(hardware_interface::StateInterface & state_interface) | ||
| : LoanedStateInterface(state_interface, nullptr) | ||
| {} | ||
|
|
||
| LoanedStateInterface( | ||
| hardware_interface::StateInterface & state_interface, | ||
| Deleter && deleter) | ||
| : state_interface_(state_interface), | ||
| deleter_(std::forward<Deleter>(deleter)) | ||
| {} | ||
|
|
||
| LoanedStateInterface(const LoanedStateInterface & other) = delete; | ||
|
|
||
| LoanedStateInterface(LoanedStateInterface && other) = default; | ||
|
|
||
| virtual ~LoanedStateInterface() | ||
| { | ||
| if (deleter_) { | ||
| deleter_(); | ||
| } | ||
| } | ||
|
|
||
| double get_value() | ||
| { | ||
| return state_interface_.get_value(); | ||
| } | ||
|
|
||
| private: | ||
| hardware_interface::StateInterface & state_interface_; | ||
| Deleter deleter_; | ||
| }; | ||
|
|
||
| } // namespace controller_manager | ||
| #endif // CONTROLLER_MANAGER__LOANED_STATE_INTERFACE_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
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.