Program Listing for File controller_handler.hpp
↰ Return to documentation for file (include/kuka_drivers_core/controller_handler.hpp
)
// Copyright 2023 Komáromi Sándor
//
// 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 KUKA_DRIVERS_CORE__CONTROLLER_HANDLER_HPP_
#define KUKA_DRIVERS_CORE__CONTROLLER_HANDLER_HPP_
#include <map>
#include <set>
#include <string>
#include <utility>
#include <vector>
#include "control_mode.hpp"
#include "rclcpp/rclcpp.hpp"
namespace kuka_drivers_core
{
class ControllerHandler
{
private:
struct ControllerTypes
{
std::string standard_controller;
std::string impedance_controller;
};
std::set<std::string> fixed_controllers_;
std::set<std::string> active_controllers_;
std::set<std::string> activate_controllers_;
std::set<std::string> deactivate_controllers_;
std::map<ControlMode, ControllerTypes> control_mode_map_;
public:
explicit ControllerHandler(std::vector<std::string> fixed_controllers = {});
~ControllerHandler() = default;
bool UpdateControllerName(
const ControllerType controller_type, const std::string & controller_name);
std::pair<std::vector<std::string>, std::vector<std::string>> GetControllersForSwitch(
ControlMode new_control_mode);
std::vector<std::string> GetControllersForDeactivation();
void ApproveControllerActivation();
bool ApproveControllerDeactivation();
std::vector<std::string> GetControllersForMode(ControlMode control_mode);
};
} // namespace kuka_drivers_core
#endif // KUKA_DRIVERS_CORE__CONTROLLER_HANDLER_HPP_