Skip to content

Commit

Permalink
Reuse TriggerType enum in hardware components (#1962)
Browse files Browse the repository at this point in the history
  • Loading branch information
kumar-sanjeeev authored Dec 20, 2024
1 parent 62b1908 commit 4439bc7
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
#include "hardware_interface/hardware_info.hpp"
#include "hardware_interface/types/hardware_interface_return_values.hpp"
#include "hardware_interface/types/lifecycle_state_names.hpp"
#include "hardware_interface/types/trigger_type.hpp"
#include "lifecycle_msgs/msg/state.hpp"
#include "rclcpp/duration.hpp"
#include "rclcpp/logger.hpp"
Expand Down Expand Up @@ -546,11 +547,6 @@ class ActuatorInterface : public rclcpp_lifecycle::node_interfaces::LifecycleNod
// interface names to Handle accessed through getters/setters
std::unordered_map<std::string, StateInterface::SharedPtr> actuator_states_;
std::unordered_map<std::string, CommandInterface::SharedPtr> actuator_commands_;
enum class TriggerType
{
READ,
WRITE
};
std::atomic<TriggerType> next_trigger_ = TriggerType::READ;
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#include "hardware_interface/types/hardware_interface_return_values.hpp"
#include "hardware_interface/types/hardware_interface_type_values.hpp"
#include "hardware_interface/types/lifecycle_state_names.hpp"
#include "hardware_interface/types/trigger_type.hpp"
#include "lifecycle_msgs/msg/state.hpp"
#include "rclcpp/duration.hpp"
#include "rclcpp/logger.hpp"
Expand Down Expand Up @@ -585,11 +586,6 @@ class SystemInterface : public rclcpp_lifecycle::node_interfaces::LifecycleNodeI
// interface names to Handle accessed through getters/setters
std::unordered_map<std::string, StateInterface::SharedPtr> system_states_;
std::unordered_map<std::string, CommandInterface::SharedPtr> system_commands_;
enum class TriggerType
{
READ,
WRITE
};
std::atomic<TriggerType> next_trigger_ = TriggerType::READ;
};

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// Copyright 2024 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__TYPES__TRIGGER_TYPE_HPP_
#define HARDWARE_INTERFACE__TYPES__TRIGGER_TYPE_HPP_

namespace hardware_interface
{
enum class TriggerType
{
READ,
WRITE
};

} // namespace hardware_interface

#endif // HARDWARE_INTERFACE__TYPES__TRIGGER_TYPE_HPP_

0 comments on commit 4439bc7

Please sign in to comment.