Skip to content

Commit

Permalink
Refactor: Moved TriggerType enum to dedicated file to avoid repetitio…
Browse files Browse the repository at this point in the history
…n across classes
  • Loading branch information
kumar-sanjeeev committed Dec 19, 2024
1 parent 612b30b commit 8a82145
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 @@ -26,6 +26,7 @@
#include "hardware_interface/handle.hpp"
#include "hardware_interface/hardware_info.hpp"
#include "hardware_interface/types/hardware_interface_return_values.hpp"
#include "hardware_interface/types/hardware_interface_trigger_type.hpp"
#include "hardware_interface/types/lifecycle_state_names.hpp"
#include "lifecycle_msgs/msg/state.hpp"
#include "rclcpp/duration.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 @@ -26,6 +26,7 @@
#include "hardware_interface/handle.hpp"
#include "hardware_interface/hardware_info.hpp"
#include "hardware_interface/types/hardware_interface_return_values.hpp"
#include "hardware_interface/types/hardware_interface_trigger_type.hpp"
#include "hardware_interface/types/hardware_interface_type_values.hpp"
#include "hardware_interface/types/lifecycle_state_names.hpp"
#include "lifecycle_msgs/msg/state.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 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_TRIGGER_TYPE_HPP_
#define HARDWARE_INTERFACE__TYPES__HARDWARE_INTERFACE_TRIGGER_TYPE_HPP_

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

} // namespace hardware_interface

#endif // HARDWARE_INTERFACE__TYPES__HARDWARE_INTERFACE_TRIGGER_TYPE_HPP_

0 comments on commit 8a82145

Please sign in to comment.