forked from ros-controls/ros2_control
-
Notifications
You must be signed in to change notification settings - Fork 1
move interfaces into hardware_interface package #1
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
destogl
merged 1 commit into
destogl:hardware_control_components-design
from
ros-controls:hardware_control_components-design-kk
Jun 22, 2020
Merged
Changes from all commits
Commits
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
87 changes: 87 additions & 0 deletions
87
hardware_interface/include/hardware_interface/actuator.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,87 @@ | ||
| // Copyright 2020 ROS2-Control Development Team | ||
| // | ||
| // 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 HARDWARE_INTERFACE__ACTUATOR_HPP_ | ||
| #define HARDWARE_INTERFACE__ACTUATOR_HPP_ | ||
|
|
||
| #include <algorithm> | ||
| #include <memory> | ||
| #include <string> | ||
| #include <utility> | ||
|
|
||
| #include "hardware_interface/component_info.hpp" | ||
| #include "hardware_interface/component_interfaces/actuator_interface.hpp" | ||
| #include "hardware_interface/types/hardware_interface_return_values.hpp" | ||
| #include "hardware_interface/visibility_control.h" | ||
|
|
||
| namespace hardware_interface | ||
| { | ||
|
|
||
| class Actuator final | ||
| { | ||
| public: | ||
| explicit Actuator(std::unique_ptr<ActuatorInterface> impl) | ||
| : impl_(std::move(impl)) | ||
| {} | ||
|
|
||
| ~Actuator() = default; | ||
|
|
||
| HARDWARE_INTERFACE_PUBLIC | ||
| hardware_interface_ret_t configure(const ComponentInfo & actuator_info) | ||
| { | ||
| return impl_->configure(actuator_info); | ||
| } | ||
|
|
||
| HARDWARE_INTERFACE_PUBLIC | ||
| hardware_interface_ret_t start() | ||
| { | ||
| return impl_->start(); | ||
| } | ||
|
|
||
| HARDWARE_INTERFACE_PUBLIC | ||
| hardware_interface_ret_t stop() | ||
| { | ||
| return impl_->stop(); | ||
| } | ||
|
|
||
| HARDWARE_INTERFACE_PUBLIC | ||
| bool is_started() const | ||
| { | ||
| return impl_->is_started(); | ||
| } | ||
|
|
||
| HARDWARE_INTERFACE_PUBLIC | ||
| hardware_interface_ret_t read(double & data) | ||
| { | ||
| return impl_->read(data); | ||
| } | ||
|
|
||
| HARDWARE_INTERFACE_PUBLIC | ||
| hardware_interface_ret_t write(const double & data) | ||
| { | ||
| return impl_->write(data); | ||
| } | ||
|
|
||
| HARDWARE_INTERFACE_PUBLIC | ||
| std::string get_interface_name() const | ||
| { | ||
| return impl_->get_interface_name(); | ||
| } | ||
|
|
||
|
destogl marked this conversation as resolved.
|
||
| private: | ||
| std::unique_ptr<ActuatorInterface> impl_; | ||
| }; | ||
|
|
||
| } // namespace hardware_interface | ||
| #endif // HARDWARE_INTERFACE__ACTUATOR_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
70 changes: 70 additions & 0 deletions
70
hardware_interface/include/hardware_interface/component_interfaces/actuator_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,70 @@ | ||
| // Copyright 2020 ROS2-Control Development Team | ||
| // | ||
| // 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 HARDWARE_INTERFACE__COMPONENT_INTERFACES__ACTUATOR_INTERFACE_HPP_ | ||
| #define HARDWARE_INTERFACE__COMPONENT_INTERFACES__ACTUATOR_INTERFACE_HPP_ | ||
|
|
||
| #include <algorithm> | ||
| #include <array> | ||
| #include <string> | ||
| #include <vector> | ||
|
|
||
| #include "hardware_interface/component_info.hpp" | ||
| #include "hardware_interface/types/hardware_interface_return_values.hpp" | ||
|
Karsten1987 marked this conversation as resolved.
|
||
| #include "hardware_interface/visibility_control.h" | ||
|
|
||
| namespace hardware_interface | ||
| { | ||
|
|
||
| class ActuatorInterface | ||
|
destogl marked this conversation as resolved.
|
||
| { | ||
| public: | ||
| HARDWARE_INTERFACE_PUBLIC | ||
| ActuatorInterface() = default; | ||
|
|
||
| HARDWARE_INTERFACE_PUBLIC | ||
| virtual | ||
| ~ActuatorInterface() = default; | ||
|
|
||
| HARDWARE_INTERFACE_PUBLIC | ||
| virtual | ||
| hardware_interface_ret_t configure(const ComponentInfo & actuator_info) = 0; | ||
|
|
||
| HARDWARE_INTERFACE_PUBLIC | ||
| virtual | ||
| std::string get_interface_name() const = 0; | ||
|
|
||
| HARDWARE_INTERFACE_PUBLIC | ||
| virtual | ||
| hardware_interface_ret_t start() = 0; | ||
|
|
||
| HARDWARE_INTERFACE_PUBLIC | ||
| virtual | ||
| hardware_interface_ret_t stop() = 0; | ||
|
|
||
| HARDWARE_INTERFACE_PUBLIC | ||
| virtual | ||
| bool is_started() const = 0; | ||
|
|
||
| HARDWARE_INTERFACE_PUBLIC | ||
| virtual | ||
| hardware_interface_ret_t read(double & data) = 0; | ||
|
|
||
| HARDWARE_INTERFACE_PUBLIC | ||
| virtual | ||
| hardware_interface_ret_t write(const double & data) = 0; | ||
| }; | ||
|
|
||
| } // namespace hardware_interface | ||
| #endif // HARDWARE_INTERFACE__COMPONENT_INTERFACES__ACTUATOR_INTERFACE_HPP_ | ||
63 changes: 63 additions & 0 deletions
63
hardware_interface/include/hardware_interface/component_interfaces/sensor_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 ROS2-Control Development Team | ||
| // | ||
| // 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 HARDWARE_INTERFACE__COMPONENT_INTERFACES__SENSOR_INTERFACE_HPP_ | ||
| #define HARDWARE_INTERFACE__COMPONENT_INTERFACES__SENSOR_INTERFACE_HPP_ | ||
|
|
||
| #include <string> | ||
|
|
||
| #include "hardware_interface/component_info.hpp" | ||
| #include "hardware_interface/types/hardware_interface_return_values.hpp" | ||
| #include "hardware_interface/visibility_control.h" | ||
|
|
||
| namespace hardware_interface | ||
| { | ||
|
|
||
| class SensorInterface | ||
|
destogl marked this conversation as resolved.
|
||
| { | ||
| public: | ||
| HARDWARE_INTERFACE_PUBLIC | ||
| SensorInterface() = default; | ||
|
|
||
| HARDWARE_INTERFACE_PUBLIC | ||
| virtual | ||
| ~SensorInterface() = default; | ||
|
|
||
| HARDWARE_INTERFACE_PUBLIC | ||
| virtual | ||
| hardware_interface_ret_t configure(const ComponentInfo & sensor_info) = 0; | ||
|
|
||
| HARDWARE_INTERFACE_PUBLIC | ||
| virtual | ||
| std::string get_interface_name() const = 0; | ||
|
|
||
| HARDWARE_INTERFACE_PUBLIC | ||
| virtual | ||
| hardware_interface_ret_t start() = 0; | ||
|
|
||
| HARDWARE_INTERFACE_PUBLIC | ||
| virtual | ||
| hardware_interface_ret_t stop() = 0; | ||
|
|
||
| HARDWARE_INTERFACE_PUBLIC | ||
| virtual | ||
| bool is_started() const = 0; | ||
|
|
||
| HARDWARE_INTERFACE_PUBLIC | ||
| virtual | ||
| hardware_interface_ret_t read(double & data) = 0; | ||
| }; | ||
|
|
||
| } // namespace hardware_interface | ||
| #endif // HARDWARE_INTERFACE__COMPONENT_INTERFACES__SENSOR_INTERFACE_HPP_ | ||
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.