ros2_control - rolling
Loading...
Searching...
No Matches
sine_wave_tier2_controller.hpp
1// Copyright 2026 Open Source Robotics Foundation, Inc.
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 SINE_WAVE_CONTROLLER__SINE_WAVE_TIER2_CONTROLLER_HPP_
16#define SINE_WAVE_CONTROLLER__SINE_WAVE_TIER2_CONTROLLER_HPP_
17
18#include <string>
19
20#include "controller_interface/controller_interface.hpp"
21#include "rclcpp/rclcpp.hpp"
22#include "rclcpp_lifecycle/state.hpp"
23
24namespace sine_wave_controller
25{
30class SineWaveTier2Controller : public controller_interface::ControllerInterface
31{
32public:
33 SineWaveTier2Controller();
34
35 controller_interface::CallbackReturn on_init() override;
36
39
40 controller_interface::CallbackReturn on_configure(
41 const rclcpp_lifecycle::State & previous_state) override;
42 controller_interface::CallbackReturn on_activate(
43 const rclcpp_lifecycle::State & previous_state) override;
44 controller_interface::CallbackReturn on_deactivate(
45 const rclcpp_lifecycle::State & previous_state) override;
46
47 controller_interface::return_type update(
48 const rclcpp::Time & time, const rclcpp::Duration & period) override;
49
50protected:
51 std::string component_name_;
52 std::string cmd_interface_name_;
53 double amplitude_;
54 double frequency_; // Hz
55 double offset_;
56
57 rclcpp::Time start_time_;
58 bool start_time_set_ = false;
59};
60
61} // namespace sine_wave_controller
62
63#endif // SINE_WAVE_CONTROLLER__SINE_WAVE_TIER2_CONTROLLER_HPP_
Definition controller_interface.hpp:27
controller_interface::CallbackReturn on_init() override
Extending interface with initialization method which is individual for each controller.
Definition sine_wave_tier2.cpp:24
controller_interface::InterfaceConfiguration state_interface_configuration() const override
Get configuration for controller's required state interfaces.
Definition sine_wave_tier2.cpp:52
controller_interface::return_type update(const rclcpp::Time &time, const rclcpp::Duration &period) override
Control step update. Command interfaces are updated based on on reference inputs and current states.
Definition sine_wave_tier2.cpp:91
controller_interface::InterfaceConfiguration command_interface_configuration() const override
Get configuration for controller's required command interfaces.
Definition sine_wave_tier2.cpp:43
Configuring what command/state interfaces to claim.
Definition controller_interface_base.hpp:78