diff --git a/hardware_interface/include/hardware_interface/actuator_interface.hpp b/hardware_interface/include/hardware_interface/actuator_interface.hpp index 9ffa7bc436..48dae9c1e7 100644 --- a/hardware_interface/include/hardware_interface/actuator_interface.hpp +++ b/hardware_interface/include/hardware_interface/actuator_interface.hpp @@ -25,7 +25,10 @@ #include "hardware_interface/component_parser.hpp" #include "hardware_interface/handle.hpp" #include "hardware_interface/hardware_info.hpp" +#include "hardware_interface/types/hardware_interface_emergency_stop_signal.hpp" +#include "hardware_interface/types/hardware_interface_error_signals.hpp" #include "hardware_interface/types/hardware_interface_return_values.hpp" +#include "hardware_interface/types/hardware_interface_warning_signals.hpp" #include "hardware_interface/types/lifecycle_state_names.hpp" #include "lifecycle_msgs/msg/state.hpp" #include "rclcpp/duration.hpp" @@ -103,6 +106,9 @@ class ActuatorInterface : public rclcpp_lifecycle::node_interfaces::LifecycleNod info_ = hardware_info; import_state_interface_descriptions(info_); import_command_interface_descriptions(info_); + create_emergency_stop_interface(); + create_error_interfaces(); + create_warning_interfaces(); return CallbackReturn::SUCCESS; }; @@ -134,6 +140,41 @@ class ActuatorInterface : public rclcpp_lifecycle::node_interfaces::LifecycleNod } } + void create_emergency_stop_interface() + { + InterfaceInfo interface_info; + interface_info.name = hardware_interface::EMERGENCY_STOP_SIGNAL; + interface_info.data_type = "bool"; + InterfaceDescription interface_descr(info_.name, interface_info); + emergency_stop_ = std::make_shared(interface_descr); + } + + void create_error_interfaces() + { + for (const auto error_signal : hardware_interface::ERROR_SIGNALS) + { + InterfaceInfo interface_info; + interface_info.name = error_signal; + interface_info.data_type = "uint8_t"; + InterfaceDescription interface_descr(info_.name, interface_info); + error_signals_.insert(std::make_pair( + interface_descr.get_name(), std::make_shared(interface_descr))); + } + } + + void create_warning_interfaces() + { + for (const auto warning_signal : hardware_interface::WARNING_SIGNALS) + { + InterfaceInfo interface_info; + interface_info.name = warning_signal; + interface_info.data_type = "int8_t"; + InterfaceDescription interface_descr(info_.name, interface_info); + warning_signals_.insert(std::make_pair( + interface_descr.get_name(), std::make_shared(interface_descr))); + } + } + /// Exports all state interfaces for this hardware interface. /** * Default implementation for exporting the StateInterfaces. The StateInterfaces are created @@ -310,34 +351,31 @@ class ActuatorInterface : public rclcpp_lifecycle::node_interfaces::LifecycleNod return actuator_commands_.at(interface_name)->get_value(); } - void set_warning_code(const std::string & interface_name, const double & warning_code) + void set_emergency_stop(const double & emergency_stop) { - actuator_states_.at(interface_name)->warning_code(warning_code); + emergency_stop_->emergency_stop(emergency_stop); } - double get_warning_code(const std::string & interface_name) const - { - return actuator_states_.at(interface_name)->warning_code(); - } + double get_emergency_stop() const { return emergency_stop_->emergency_stop(); } - void set_error_code(const std::string & interface_name, const double & error_code) + void set_warning_code(const std::string & warning_signal, const int8_t & warning_code) { - actuator_states_.at(interface_name)->error_code(error_code); + warning_signals_.at(warning_signal)->warning_code(warning_code); } - double get_error_code(const std::string & interface_name) const + int8_t get_warning_code(const std::string & warning_signal) const { - return actuator_states_.at(interface_name)->error_code(); + return warning_signals_.at(warning_signal)->warning_code(); } - void set_report_message(const std::string & interface_name, const double & report_message) + void set_error_code(const std::string & error_signal, const uint8_t & error_code) { - actuator_states_.at(interface_name)->report_message(report_message); + warning_signals_.at(error_signal)->error_code(error_code); } - double get_report_message(const std::string & interface_name) const + uint8_t get_error_code(const std::string & error_signal) const { - return actuator_states_.at(interface_name)->report_message(); + return warning_signals_.at(error_signal)->error_code(); } protected: @@ -348,6 +386,9 @@ class ActuatorInterface : public rclcpp_lifecycle::node_interfaces::LifecycleNod private: std::map> actuator_states_; std::map> actuator_commands_; + std::shared_ptr emergency_stop_; + std::map> error_signals_; + std::map> warning_signals_; rclcpp_lifecycle::State lifecycle_state_; }; diff --git a/hardware_interface/include/hardware_interface/handle.hpp b/hardware_interface/include/hardware_interface/handle.hpp index dd4e2c3ccf..900ea2b1e4 100644 --- a/hardware_interface/include/hardware_interface/handle.hpp +++ b/hardware_interface/include/hardware_interface/handle.hpp @@ -27,7 +27,7 @@ namespace hardware_interface { -typedef std::variant HANDLE_DATATYPE; +typedef std::variant HANDLE_DATATYPE; /// A handle used to get and set a value on a given interface. class Handle @@ -132,31 +132,31 @@ class StateInterface : public Handle StateInterface(StateInterface && other) = default; - double emergency_stop() const + bool emergency_stop() const { - const double * emergency_stop = std::get_if(&value_); + const auto emergency_stop = std::get_if(&value_); // This means the value does not store the expected datatype. How should we handle this // properly? THROW_ON_NOT_NULLPTR(emergency_stop); return *emergency_stop; } - void emergency_stop(const double & emergency_stop) { value_ = emergency_stop; } + void emergency_stop(const bool & emergency_stop) { value_ = emergency_stop; } - double warning_code() const + int8_t warning_code() const { - const double * warning_code = std::get_if(&value_); + const auto warning_code = std::get_if(&value_); // This means the value does not store the expected datatype. How should we handle this // properly? THROW_ON_NOT_NULLPTR(warning_code); return *warning_code; } - void warning_code(const double & warning_code) { value_ = warning_code; } + void warning_code(const int8_t & warning_code) { value_ = warning_code; } - double error_code() const + uint8_t error_code() const { - const auto error_code = std::get_if(&value_); + const auto error_code = std::get_if(&value_); // This means the value does not store the expected datatype. How should we handle this // properly? THROW_ON_NOT_NULLPTR(error_code); @@ -165,17 +165,6 @@ class StateInterface : public Handle void error_code(const double & error_code) { value_ = error_code; } - double report_message() const - { - const auto report_message = std::get_if(&value_); - // This means the value does not store the expected datatype. How should we handle this - // properly? - THROW_ON_NOT_NULLPTR(report_message); - return *report_message; - } - - void report_message(const double & report_message) { value_ = report_message; } - using Handle::Handle; }; diff --git a/hardware_interface/include/hardware_interface/loaned_state_interface.hpp b/hardware_interface/include/hardware_interface/loaned_state_interface.hpp index 4261d4e64c..0e9c8148bb 100644 --- a/hardware_interface/include/hardware_interface/loaned_state_interface.hpp +++ b/hardware_interface/include/hardware_interface/loaned_state_interface.hpp @@ -65,13 +65,11 @@ class LoanedStateInterface double get_value() const { return state_interface_.get_value(); } - double has_emergency_stop() const { return state_interface_.emergency_stop(); } + bool has_emergency_stop() const { return state_interface_.emergency_stop(); } - double get_warning_code() const { return state_interface_.warning_code(); } + int8_t get_warning_code() const { return state_interface_.warning_code(); } - double get_error_code() const { return state_interface_.error_code(); } - - double get_report_message() const { return state_interface_.report_message(); } + uint8_t get_error_code() const { return state_interface_.error_code(); } protected: StateInterface & state_interface_; diff --git a/hardware_interface/include/hardware_interface/sensor_interface.hpp b/hardware_interface/include/hardware_interface/sensor_interface.hpp index 3ee3d0bc16..0510aabe6d 100644 --- a/hardware_interface/include/hardware_interface/sensor_interface.hpp +++ b/hardware_interface/include/hardware_interface/sensor_interface.hpp @@ -25,7 +25,9 @@ #include "hardware_interface/component_parser.hpp" #include "hardware_interface/handle.hpp" #include "hardware_interface/hardware_info.hpp" +#include "hardware_interface/types/hardware_interface_error_signals.hpp" #include "hardware_interface/types/hardware_interface_return_values.hpp" +#include "hardware_interface/types/hardware_interface_warning_signals.hpp" #include "hardware_interface/types/lifecycle_state_names.hpp" #include "lifecycle_msgs/msg/state.hpp" #include "rclcpp/duration.hpp" @@ -102,6 +104,8 @@ class SensorInterface : public rclcpp_lifecycle::node_interfaces::LifecycleNodeI { info_ = hardware_info; import_state_interface_descriptions(info_); + create_error_interfaces(); + create_warning_interfaces(); return CallbackReturn::SUCCESS; }; @@ -119,6 +123,32 @@ class SensorInterface : public rclcpp_lifecycle::node_interfaces::LifecycleNodeI } } + void create_error_interfaces() + { + for (const auto error_signal : hardware_interface::ERROR_SIGNALS) + { + InterfaceInfo interface_info; + interface_info.name = error_signal; + interface_info.data_type = "uint8_t"; + InterfaceDescription interface_descr(info_.name, interface_info); + error_signals_.insert(std::make_pair( + interface_descr.get_name(), std::make_shared(interface_descr))); + } + } + + void create_warning_interfaces() + { + for (const auto warning_signal : hardware_interface::WARNING_SIGNALS) + { + InterfaceInfo interface_info; + interface_info.name = warning_signal; + interface_info.data_type = "int8_t"; + InterfaceDescription interface_descr(info_.name, interface_info); + warning_signals_.insert(std::make_pair( + interface_descr.get_name(), std::make_shared(interface_descr))); + } + } + /// Exports all state interfaces for this hardware interface. /** * Default implementation for exporting the StateInterfaces. The StateInterfaces are created @@ -200,44 +230,24 @@ class SensorInterface : public rclcpp_lifecycle::node_interfaces::LifecycleNodeI return sensor_states_.at(interface_name)->get_value(); } - void set_emergency_stop(const std::string & interface_name, const double & emergency_stop) - { - sensor_states_.at(interface_name)->emergency_stop(emergency_stop); - } - - double get_emergency_stop(const std::string & interface_name) const - { - return sensor_states_.at(interface_name)->emergency_stop(); - } - - void set_warning_code(const std::string & interface_name, const double & warning_code) - { - sensor_states_.at(interface_name)->warning_code(warning_code); - } - - double get_warning_code(const std::string & interface_name) const - { - return sensor_states_.at(interface_name)->warning_code(); - } - - void set_error_code(const std::string & interface_name, const double & error_code) + void set_warning_code(const std::string & warning_signal, const int8_t & warning_code) { - sensor_states_.at(interface_name)->error_code(error_code); + warning_signals_.at(warning_signal)->warning_code(warning_code); } - double get_error_code(const std::string & interface_name) const + int8_t get_warning_code(const std::string & warning_signal) const { - return sensor_states_.at(interface_name)->error_code(); + return warning_signals_.at(warning_signal)->warning_code(); } - void set_report_message(const std::string & interface_name, const double & report_message) + void set_error_code(const std::string & error_signal, const uint8_t & error_code) { - sensor_states_.at(interface_name)->report_message(report_message); + warning_signals_.at(error_signal)->error_code(error_code); } - double get_report_message(const std::string & interface_name) const + uint8_t get_error_code(const std::string & error_signal) const { - return sensor_states_.at(interface_name)->report_message(); + return warning_signals_.at(error_signal)->error_code(); } protected: @@ -247,6 +257,8 @@ class SensorInterface : public rclcpp_lifecycle::node_interfaces::LifecycleNodeI private: std::map> sensor_states_; + std::map> error_signals_; + std::map> warning_signals_; rclcpp_lifecycle::State lifecycle_state_; }; diff --git a/hardware_interface/include/hardware_interface/system_interface.hpp b/hardware_interface/include/hardware_interface/system_interface.hpp index 847712b9d6..31f26aa684 100644 --- a/hardware_interface/include/hardware_interface/system_interface.hpp +++ b/hardware_interface/include/hardware_interface/system_interface.hpp @@ -25,8 +25,11 @@ #include "hardware_interface/component_parser.hpp" #include "hardware_interface/handle.hpp" #include "hardware_interface/hardware_info.hpp" +#include "hardware_interface/types/hardware_interface_emergency_stop_signal.hpp" +#include "hardware_interface/types/hardware_interface_error_signals.hpp" #include "hardware_interface/types/hardware_interface_return_values.hpp" #include "hardware_interface/types/hardware_interface_type_values.hpp" +#include "hardware_interface/types/hardware_interface_warning_signals.hpp" #include "hardware_interface/types/lifecycle_state_names.hpp" #include "lifecycle_msgs/msg/state.hpp" #include "rclcpp/duration.hpp" @@ -105,6 +108,9 @@ class SystemInterface : public rclcpp_lifecycle::node_interfaces::LifecycleNodeI info_ = hardware_info; import_state_interface_descriptions(info_); import_command_interface_descriptions(info_); + create_emergency_stop_interface(); + create_error_interfaces(); + create_warning_interfaces(); return CallbackReturn::SUCCESS; }; @@ -154,6 +160,41 @@ class SystemInterface : public rclcpp_lifecycle::node_interfaces::LifecycleNodeI } } + void create_emergency_stop_interface() + { + InterfaceInfo interface_info; + interface_info.name = hardware_interface::EMERGENCY_STOP_SIGNAL; + interface_info.data_type = "bool"; + InterfaceDescription interface_descr(info_.name, interface_info); + emergency_stop_ = std::make_shared(interface_descr); + } + + void create_error_interfaces() + { + for (const auto error_signal : hardware_interface::ERROR_SIGNALS) + { + InterfaceInfo interface_info; + interface_info.name = error_signal; + interface_info.data_type = "uint8_t"; + InterfaceDescription interface_descr(info_.name, interface_info); + error_signals_.insert(std::make_pair( + interface_descr.get_name(), std::make_shared(interface_descr))); + } + } + + void create_warning_interfaces() + { + for (const auto warning_signal : hardware_interface::WARNING_SIGNALS) + { + InterfaceInfo interface_info; + interface_info.name = warning_signal; + interface_info.data_type = "int8_t"; + InterfaceDescription interface_descr(info_.name, interface_info); + warning_signals_.insert(std::make_pair( + interface_descr.get_name(), std::make_shared(interface_descr))); + } + } + /// Exports all state interfaces for this hardware interface. /** * Default implementation for exporting the StateInterfaces. The StateInterfaces are created @@ -348,44 +389,31 @@ class SystemInterface : public rclcpp_lifecycle::node_interfaces::LifecycleNodeI return system_commands_.at(interface_name)->get_value(); } - void set_emergency_stop(const std::string & interface_name, const double & emergency_stop) - { - system_states_.at(interface_name)->emergency_stop(emergency_stop); - } - - double get_emergency_stop(const std::string & interface_name) const + void set_emergency_stop(const double & emergency_stop) { - return system_states_.at(interface_name)->emergency_stop(); + emergency_stop_->emergency_stop(emergency_stop); } - void set_warning_code(const std::string & interface_name, const double & warning_code) - { - system_states_.at(interface_name)->warning_code(warning_code); - } - - double get_warning_code(const std::string & interface_name) const - { - return system_states_.at(interface_name)->warning_code(); - } + double get_emergency_stop() const { return emergency_stop_->emergency_stop(); } - void set_error_code(const std::string & interface_name, const double & error_code) + void set_warning_code(const std::string & warning_signal, const int8_t & warning_code) { - system_states_.at(interface_name)->error_code(error_code); + warning_signals_.at(warning_signal)->warning_code(warning_code); } - double get_error_code(const std::string & interface_name) const + int8_t get_warning_code(const std::string & warning_signal) const { - return system_states_.at(interface_name)->error_code(); + return warning_signals_.at(warning_signal)->warning_code(); } - void set_report_message(const std::string & interface_name, const double & report_message) + void set_error_code(const std::string & error_signal, const uint8_t & error_code) { - system_states_.at(interface_name)->report_message(report_message); + warning_signals_.at(error_signal)->error_code(error_code); } - double get_report_message(const std::string & interface_name) const + uint8_t get_error_code(const std::string & error_signal) const { - return system_states_.at(interface_name)->report_message(); + return warning_signals_.at(error_signal)->error_code(); } protected: @@ -400,6 +428,9 @@ class SystemInterface : public rclcpp_lifecycle::node_interfaces::LifecycleNodeI private: std::map> system_states_; + std::shared_ptr emergency_stop_; + std::map> error_signals_; + std::map> warning_signals_; std::map> system_commands_; rclcpp_lifecycle::State lifecycle_state_; diff --git a/hardware_interface/include/hardware_interface/types/hardware_interface_emergency_stop_signal.hpp b/hardware_interface/include/hardware_interface/types/hardware_interface_emergency_stop_signal.hpp new file mode 100644 index 0000000000..433ee80740 --- /dev/null +++ b/hardware_interface/include/hardware_interface/types/hardware_interface_emergency_stop_signal.hpp @@ -0,0 +1,26 @@ +// Copyright 2017 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 HARDWARE_INTERFACE__TYPES__HARDWARE_INTERFACE_EMERGENCY_STOP_SIGNAL_HPP_ +#define HARDWARE_INTERFACE__TYPES__HARDWARE_INTERFACE_EMERGENCY_STOP_SIGNAL_HPP_ + +#include +#include + +namespace hardware_interface +{ +constexpr char EMERGENCY_STOP_SIGNAL[] = "EMERGENCY_STOP_SIGNAL"; +} // namespace hardware_interface + +#endif // HARDWARE_INTERFACE__TYPES__HARDWARE_INTERFACE_EMERGENCY_STOP_SIGNAL_HPP_ diff --git a/hardware_interface/include/hardware_interface/types/hardware_interface_error_codes.hpp b/hardware_interface/include/hardware_interface/types/hardware_interface_error_codes.hpp deleted file mode 100644 index 77fc1aa713..0000000000 --- a/hardware_interface/include/hardware_interface/types/hardware_interface_error_codes.hpp +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright 2017 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 HARDWARE_INTERFACE__TYPES__HARDWARE_INTERFACE_ERROR_CODES_HPP_ -#define HARDWARE_INTERFACE__TYPES__HARDWARE_INTERFACE_ERROR_CODES_HPP_ - -#include - -namespace hardware_interface -{ -enum class error_code : std::uint8_t -{ - ERROR_CODE_0 = 0, - ERROR_CODE_1 = 1, - ERROR_CODE_2 = 2, - ERROR_CODE_3 = 3, - ERROR_CODE_4 = 4, - ERROR_CODE_5 = 5, - ERROR_CODE_6 = 6, - ERROR_CODE_7 = 7, - ERROR_CODE_8 = 8, - ERROR_CODE_9 = 9, - ERROR_CODE_10 = 10, - ERROR_CODE_11 = 11, - ERROR_CODE_12 = 12, - ERROR_CODE_13 = 13, - ERROR_CODE_14 = 14, - ERROR_CODE_15 = 15, - ERROR_CODE_16 = 16, - ERROR_CODE_17 = 17, - ERROR_CODE_18 = 18, - ERROR_CODE_19 = 19, - ERROR_CODE_20 = 20, - ERROR_CODE_21 = 21, - ERROR_CODE_22 = 22, - ERROR_CODE_23 = 23, - ERROR_CODE_24 = 24, - ERROR_CODE_25 = 25, - ERROR_CODE_26 = 26, - ERROR_CODE_27 = 27, - ERROR_CODE_28 = 28, - ERROR_CODE_29 = 29, - ERROR_CODE_30 = 30, - ERROR_CODE_31 = 31, -}; - -} // namespace hardware_interface - -#endif // HARDWARE_INTERFACE__TYPES__HARDWARE_INTERFACE_ERROR_CODES_HPP_ diff --git a/hardware_interface/include/hardware_interface/types/hardware_interface_error_signals.hpp b/hardware_interface/include/hardware_interface/types/hardware_interface_error_signals.hpp new file mode 100644 index 0000000000..4821381a83 --- /dev/null +++ b/hardware_interface/include/hardware_interface/types/hardware_interface_error_signals.hpp @@ -0,0 +1,66 @@ +// Copyright 2017 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 HARDWARE_INTERFACE__TYPES__HARDWARE_INTERFACE_ERROR_SIGNALS_HPP_ +#define HARDWARE_INTERFACE__TYPES__HARDWARE_INTERFACE_ERROR_SIGNALS_HPP_ + +#include +#include + +namespace hardware_interface +{ +constexpr char ERROR_SIGNAL_0[] = "ERROR_SIGNAL_0"; +constexpr char ERROR_SIGNAL_1[] = "ERROR_SIGNAL_1"; +constexpr char ERROR_SIGNAL_2[] = "ERROR_SIGNAL_2"; +constexpr char ERROR_SIGNAL_3[] = "ERROR_SIGNAL_3"; +constexpr char ERROR_SIGNAL_4[] = "ERROR_SIGNAL_4"; +constexpr char ERROR_SIGNAL_5[] = "ERROR_SIGNAL_5"; +constexpr char ERROR_SIGNAL_6[] = "ERROR_SIGNAL_6"; +constexpr char ERROR_SIGNAL_7[] = "ERROR_SIGNAL_7"; +constexpr char ERROR_SIGNAL_8[] = "ERROR_SIGNAL_8"; +constexpr char ERROR_SIGNAL_9[] = "ERROR_SIGNAL_9"; +constexpr char ERROR_SIGNAL_10[] = "ERROR_SIGNAL_10"; +constexpr char ERROR_SIGNAL_11[] = "ERROR_SIGNAL_11"; +constexpr char ERROR_SIGNAL_12[] = "ERROR_SIGNAL_12"; +constexpr char ERROR_SIGNAL_13[] = "ERROR_SIGNAL_13"; +constexpr char ERROR_SIGNAL_14[] = "ERROR_SIGNAL_14"; +constexpr char ERROR_SIGNAL_15[] = "ERROR_SIGNAL_15"; +constexpr char ERROR_SIGNAL_16[] = "ERROR_SIGNAL_16"; +constexpr char ERROR_SIGNAL_17[] = "ERROR_SIGNAL_17"; +constexpr char ERROR_SIGNAL_18[] = "ERROR_SIGNAL_18"; +constexpr char ERROR_SIGNAL_19[] = "ERROR_SIGNAL_19"; +constexpr char ERROR_SIGNAL_20[] = "ERROR_SIGNAL_20"; +constexpr char ERROR_SIGNAL_21[] = "ERROR_SIGNAL_21"; +constexpr char ERROR_SIGNAL_22[] = "ERROR_SIGNAL_22"; +constexpr char ERROR_SIGNAL_23[] = "ERROR_SIGNAL_23"; +constexpr char ERROR_SIGNAL_24[] = "ERROR_SIGNAL_24"; +constexpr char ERROR_SIGNAL_25[] = "ERROR_SIGNAL_25"; +constexpr char ERROR_SIGNAL_26[] = "ERROR_SIGNAL_26"; +constexpr char ERROR_SIGNAL_27[] = "ERROR_SIGNAL_27"; +constexpr char ERROR_SIGNAL_28[] = "ERROR_SIGNAL_28"; +constexpr char ERROR_SIGNAL_29[] = "ERROR_SIGNAL_29"; +constexpr char ERROR_SIGNAL_30[] = "ERROR_SIGNAL_30"; +constexpr char ERROR_SIGNAL_31[] = "ERROR_SIGNAL_31"; + +const std::vector ERROR_SIGNALS = { + ERROR_SIGNAL_0, ERROR_SIGNAL_1, ERROR_SIGNAL_2, ERROR_SIGNAL_3, ERROR_SIGNAL_4, + ERROR_SIGNAL_5, ERROR_SIGNAL_6, ERROR_SIGNAL_7, ERROR_SIGNAL_8, ERROR_SIGNAL_9, + ERROR_SIGNAL_10, ERROR_SIGNAL_11, ERROR_SIGNAL_12, ERROR_SIGNAL_13, ERROR_SIGNAL_14, + ERROR_SIGNAL_15, ERROR_SIGNAL_16, ERROR_SIGNAL_17, ERROR_SIGNAL_18, ERROR_SIGNAL_19, + ERROR_SIGNAL_20, ERROR_SIGNAL_21, ERROR_SIGNAL_22, ERROR_SIGNAL_23, ERROR_SIGNAL_24, + ERROR_SIGNAL_25, ERROR_SIGNAL_26, ERROR_SIGNAL_27, ERROR_SIGNAL_28, ERROR_SIGNAL_29, + ERROR_SIGNAL_30, ERROR_SIGNAL_31}; +} // namespace hardware_interface + +#endif // HARDWARE_INTERFACE__TYPES__HARDWARE_INTERFACE_ERROR_SIGNALS_HPP_ diff --git a/hardware_interface/include/hardware_interface/types/hardware_interface_warning_codes.hpp b/hardware_interface/include/hardware_interface/types/hardware_interface_warning_codes.hpp deleted file mode 100644 index 8fef45531d..0000000000 --- a/hardware_interface/include/hardware_interface/types/hardware_interface_warning_codes.hpp +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright 2017 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 HARDWARE_INTERFACE__TYPES__HARDWARE_INTERFACE_WARNING_CODES_HPP_ -#define HARDWARE_INTERFACE__TYPES__HARDWARE_INTERFACE_WARNING_CODES_HPP_ - -#include - -namespace hardware_interface -{ -enum class warning_code : std::int8_t -{ - WARNING_CODE_0 = 0, - WARNING_CODE_1 = 1, - WARNING_CODE_2 = 2, - WARNING_CODE_3 = 3, - WARNING_CODE_4 = 4, - WARNING_CODE_5 = 5, - WARNING_CODE_6 = 6, - WARNING_CODE_7 = 7, - WARNING_CODE_8 = 8, - WARNING_CODE_9 = 9, - WARNING_CODE_10 = 10, - WARNING_CODE_11 = 11, - WARNING_CODE_12 = 12, - WARNING_CODE_13 = 13, - WARNING_CODE_14 = 14, - WARNING_CODE_15 = 15, - WARNING_CODE_16 = 16, - WARNING_CODE_17 = 17, - WARNING_CODE_18 = 18, - WARNING_CODE_19 = 19, - WARNING_CODE_20 = 20, - WARNING_CODE_21 = 21, - WARNING_CODE_22 = 22, - WARNING_CODE_23 = 23, - WARNING_CODE_24 = 24, - WARNING_CODE_25 = 25, - WARNING_CODE_26 = 26, - WARNING_CODE_27 = 27, - WARNING_CODE_28 = 28, - WARNING_CODE_29 = 29, - WARNING_CODE_30 = 30, - WARNING_CODE_31 = 31, -}; - -} // namespace hardware_interface - -#endif // HARDWARE_INTERFACE__TYPES__HARDWARE_INTERFACE_WARNING_CODES_HPP_ diff --git a/hardware_interface/include/hardware_interface/types/hardware_interface_warning_signals.hpp b/hardware_interface/include/hardware_interface/types/hardware_interface_warning_signals.hpp new file mode 100644 index 0000000000..fb1237b35f --- /dev/null +++ b/hardware_interface/include/hardware_interface/types/hardware_interface_warning_signals.hpp @@ -0,0 +1,67 @@ +// Copyright 2017 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 HARDWARE_INTERFACE__TYPES__HARDWARE_INTERFACE_WARNING_SIGNALS_HPP_ +#define HARDWARE_INTERFACE__TYPES__HARDWARE_INTERFACE_WARNING_SIGNALS_HPP_ + +#include +#include + +namespace hardware_interface +{ +constexpr char WARNING_SIGNAL_0[] = "WARNING_SIGNAL_0"; +constexpr char WARNING_SIGNAL_1[] = "WARNING_SIGNAL_1"; +constexpr char WARNING_SIGNAL_2[] = "WARNING_SIGNAL_2"; +constexpr char WARNING_SIGNAL_3[] = "WARNING_SIGNAL_3"; +constexpr char WARNING_SIGNAL_4[] = "WARNING_SIGNAL_4"; +constexpr char WARNING_SIGNAL_5[] = "WARNING_SIGNAL_5"; +constexpr char WARNING_SIGNAL_6[] = "WARNING_SIGNAL_6"; +constexpr char WARNING_SIGNAL_7[] = "WARNING_SIGNAL_7"; +constexpr char WARNING_SIGNAL_8[] = "WARNING_SIGNAL_8"; +constexpr char WARNING_SIGNAL_9[] = "WARNING_SIGNAL_9"; +constexpr char WARNING_SIGNAL_10[] = "WARNING_SIGNAL_10"; +constexpr char WARNING_SIGNAL_11[] = "WARNING_SIGNAL_11"; +constexpr char WARNING_SIGNAL_12[] = "WARNING_SIGNAL_12"; +constexpr char WARNING_SIGNAL_13[] = "WARNING_SIGNAL_13"; +constexpr char WARNING_SIGNAL_14[] = "WARNING_SIGNAL_14"; +constexpr char WARNING_SIGNAL_15[] = "WARNING_SIGNAL_15"; +constexpr char WARNING_SIGNAL_16[] = "WARNING_SIGNAL_16"; +constexpr char WARNING_SIGNAL_17[] = "WARNING_SIGNAL_17"; +constexpr char WARNING_SIGNAL_18[] = "WARNING_SIGNAL_18"; +constexpr char WARNING_SIGNAL_19[] = "WARNING_SIGNAL_19"; +constexpr char WARNING_SIGNAL_20[] = "WARNING_SIGNAL_20"; +constexpr char WARNING_SIGNAL_21[] = "WARNING_SIGNAL_21"; +constexpr char WARNING_SIGNAL_22[] = "WARNING_SIGNAL_22"; +constexpr char WARNING_SIGNAL_23[] = "WARNING_SIGNAL_23"; +constexpr char WARNING_SIGNAL_24[] = "WARNING_SIGNAL_24"; +constexpr char WARNING_SIGNAL_25[] = "WARNING_SIGNAL_25"; +constexpr char WARNING_SIGNAL_26[] = "WARNING_SIGNAL_26"; +constexpr char WARNING_SIGNAL_27[] = "WARNING_SIGNAL_27"; +constexpr char WARNING_SIGNAL_28[] = "WARNING_SIGNAL_28"; +constexpr char WARNING_SIGNAL_29[] = "WARNING_SIGNAL_29"; +constexpr char WARNING_SIGNAL_30[] = "WARNING_SIGNAL_30"; +constexpr char WARNING_SIGNAL_31[] = "WARNING_SIGNAL_31"; + +const std::vector WARNING_SIGNALS = { + WARNING_SIGNAL_0, WARNING_SIGNAL_1, WARNING_SIGNAL_2, WARNING_SIGNAL_3, WARNING_SIGNAL_4, + WARNING_SIGNAL_5, WARNING_SIGNAL_6, WARNING_SIGNAL_7, WARNING_SIGNAL_8, WARNING_SIGNAL_9, + WARNING_SIGNAL_10, WARNING_SIGNAL_11, WARNING_SIGNAL_12, WARNING_SIGNAL_13, WARNING_SIGNAL_14, + WARNING_SIGNAL_15, WARNING_SIGNAL_16, WARNING_SIGNAL_17, WARNING_SIGNAL_18, WARNING_SIGNAL_19, + WARNING_SIGNAL_20, WARNING_SIGNAL_21, WARNING_SIGNAL_22, WARNING_SIGNAL_23, WARNING_SIGNAL_24, + WARNING_SIGNAL_25, WARNING_SIGNAL_26, WARNING_SIGNAL_27, WARNING_SIGNAL_28, WARNING_SIGNAL_29, + WARNING_SIGNAL_30, WARNING_SIGNAL_31}; + +} // namespace hardware_interface + +#endif // HARDWARE_INTERFACE__TYPES__HARDWARE_INTERFACE_WARNING_SIGNALS_HPP_