ros2_control - foxy
Loading...
Searching...
No Matches
base_interface.hpp
1// Copyright 2020 ros2_control Development Team
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15#ifndef HARDWARE_INTERFACE__BASE_INTERFACE_HPP_
16#define HARDWARE_INTERFACE__BASE_INTERFACE_HPP_
17
18#include <string>
19
20#include "hardware_interface/hardware_info.hpp"
21#include "hardware_interface/types/hardware_interface_return_values.hpp"
22#include "hardware_interface/types/hardware_interface_status_values.hpp"
23
24namespace hardware_interface
25{
26template <class InterfaceType>
27class BaseInterface : public InterfaceType
28{
29public:
30 return_type configure(const HardwareInfo & info) override
31 {
32 info_ = info;
33 status_ = status::CONFIGURED;
34 return return_type::OK;
35 }
36
37 return_type configure_default(const HardwareInfo & info)
38 {
40 }
41
42 std::string get_name() const final { return info_.name; }
43
44 status get_status() const final { return status_; }
45
46protected:
47 HardwareInfo info_;
48 status status_;
49};
50
51} // namespace hardware_interface
52
53#endif // HARDWARE_INTERFACE__BASE_INTERFACE_HPP_
Definition base_interface.hpp:28
This structure stores information about hardware defined in a robot's URDF.
Definition hardware_info.hpp:103
std::string name
Name of the hardware.
Definition hardware_info.hpp:105