ros2_control - galactic
Loading...
Searching...
No Matches
sine_wave_tier1_node.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_TIER1_NODE_HPP_
16#define SINE_WAVE_CONTROLLER__SINE_WAVE_TIER1_NODE_HPP_
17
18#include <chrono>
19#include <cmath>
20#include <memory>
21#include <string>
22
23#include "control_msgs/msg/joint_command.hpp"
24#include "rclcpp/rclcpp.hpp"
25
26namespace sine_wave_controller
27{
28
33class SineWaveTier1Node : public rclcpp::Node
34{
35public:
36 explicit SineWaveTier1Node(const rclcpp::NodeOptions & options = rclcpp::NodeOptions());
37 virtual ~SineWaveTier1Node() = default;
38
39private:
40 void timer_callback();
41
42 std::string topic_name_;
43 std::string joint_name_;
44 std::string interface_name_;
45 double amplitude_;
46 double frequency_;
47 double offset_;
48 double publish_rate_;
49
50 rclcpp::Time start_time_;
51 bool start_time_set_{false};
52
53 rclcpp::Publisher<control_msgs::msg::JointCommand>::SharedPtr publisher_;
54 rclcpp::TimerBase::SharedPtr timer_;
55};
56
57} // namespace sine_wave_controller
58
59#endif // SINE_WAVE_CONTROLLER__SINE_WAVE_TIER1_NODE_HPP_