|
| 1 | +// Copyright 2024 TIER IV, 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 | +#include "dummy_gear_cmd_publisher.hpp" |
| 16 | + |
| 17 | +namespace dummy_gear_cmd_publisher |
| 18 | +{ |
| 19 | + |
| 20 | +DummyGearCmdPublisher::DummyGearCmdPublisher(const rclcpp::NodeOptions & node_options) |
| 21 | +: Node("dummy_gear_cmd_publisher", node_options) |
| 22 | +{ |
| 23 | + // Parameter |
| 24 | + |
| 25 | + // Subscriber |
| 26 | + |
| 27 | + // Publisher |
| 28 | + pub_gear_cmd_ = create_publisher<autoware_auto_vehicle_msgs::msg::GearCommand>( |
| 29 | + "~/output/gear_cmd", 10); |
| 30 | + |
| 31 | + // Service |
| 32 | + |
| 33 | + // Client |
| 34 | + |
| 35 | + // Timer |
| 36 | + using namespace std::literals::chrono_literals; |
| 37 | + timer_ = rclcpp::create_timer( |
| 38 | + this, get_clock(), 1s, std::bind(&DummyGearCmdPublisher::onTimer, this)); |
| 39 | + |
| 40 | + // State |
| 41 | + |
| 42 | + // Diagnostics |
| 43 | + |
| 44 | +} |
| 45 | + |
| 46 | +void DummyGearCmdPublisher::onTimer() |
| 47 | +{ |
| 48 | + autoware_auto_vehicle_msgs::msg::GearCommand msg; |
| 49 | + msg.stamp = this->now(); |
| 50 | + msg.command = autoware_auto_vehicle_msgs::msg::GearCommand::DRIVE; |
| 51 | + |
| 52 | + pub_gear_cmd_->publish(msg); |
| 53 | +} |
| 54 | + |
| 55 | +} // namespace dummy_gear_cmd_publisher |
| 56 | + |
| 57 | +#include <rclcpp_components/register_node_macro.hpp> |
| 58 | +RCLCPP_COMPONENTS_REGISTER_NODE(dummy_gear_cmd_publisher::DummyGearCmdPublisher) |
0 commit comments