Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(dummy_gear_cmd_publisher): add dummy gear cmd publisher #1680

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions dummy/dummy_gear_cmd_publisher/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
cmake_minimum_required(VERSION 3.14)
project(dummy_gear_cmd_publisher)

find_package(autoware_cmake REQUIRED)
autoware_package()

ament_auto_add_library(dummy_gear_cmd_publisher SHARED
src/dummy_gear_cmd_publisher.cpp
)
ament_target_dependencies(dummy_gear_cmd_publisher)

rclcpp_components_register_node(${PROJECT_NAME}
PLUGIN "dummy_gear_cmd_publisher::DummyGearCmdPublisher"
EXECUTABLE ${PROJECT_NAME}_node
)

ament_auto_package(
INSTALL_TO_SHARE
launch
config
)
23 changes: 23 additions & 0 deletions dummy/dummy_gear_cmd_publisher/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Dummy Gear Cmd Publisher

## Purpose

## Inner-workings / Algorithms

## Inputs / Outputs

### Input

### Output

## Parameters

## Assumptions / Known limits

## (Optional) Error detection and handling

## (Optional) Performance characterization

## (Optional) References/External links

## (Optional) Future extensions / Unimplemented parts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/**:
ros__parameters:
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<launch>
<arg name="dummy_gear_cmd_publisher_param_path" default="$(find-pkg-share dummy_gear_cmd_publisher)/config/dummy_gear_cmd_publisher.param.yaml"/>

<node pkg="dummy_gear_cmd_publisher" exec="dummy_gear_cmd_publisher_node" name="dummy_gear_cmd_publisher" output="screen">
<remap from="~/output/gear_cmd" to="/control/command/gear_cmd"/>
</node>
</launch>
25 changes: 25 additions & 0 deletions dummy/dummy_gear_cmd_publisher/package.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?xml version="1.0"?>
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
<package format="3">
<name>dummy_gear_cmd_publisher</name>
<version>0.1.0</version>
<description>The dummy_gear_cmd_publisher package</description>
<maintainer email="[email protected]">Makoto Kurihara</maintainer>
<license>Apache License 2.0</license>

<buildtool_depend>ament_cmake_auto</buildtool_depend>

<build_depend>autoware_cmake</build_depend>

<!-- depend -->
<depend>autoware_auto_vehicle_msgs</depend>
<depend>rclcpp</depend>
<depend>rclcpp_components</depend>

<test_depend>ament_lint_auto</test_depend>
<test_depend>autoware_lint_common</test_depend>

<export>
<build_type>ament_cmake</build_type>
</export>
</package>
57 changes: 57 additions & 0 deletions dummy/dummy_gear_cmd_publisher/src/dummy_gear_cmd_publisher.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
// Copyright 2024 TIER IV, 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.

#include "dummy_gear_cmd_publisher.hpp"

namespace dummy_gear_cmd_publisher
{

DummyGearCmdPublisher::DummyGearCmdPublisher(const rclcpp::NodeOptions & node_options)
: Node("dummy_gear_cmd_publisher", node_options)
{
// Parameter

// Subscriber

// Publisher
pub_gear_cmd_ =
create_publisher<autoware_auto_vehicle_msgs::msg::GearCommand>("~/output/gear_cmd", 10);

// Service

// Client

// Timer
using namespace std::literals::chrono_literals;
timer_ =
rclcpp::create_timer(this, get_clock(), 1s, std::bind(&DummyGearCmdPublisher::onTimer, this));

// State

// Diagnostics
}

void DummyGearCmdPublisher::onTimer()
{
autoware_auto_vehicle_msgs::msg::GearCommand msg;
msg.stamp = this->now();
msg.command = autoware_auto_vehicle_msgs::msg::GearCommand::DRIVE;

pub_gear_cmd_->publish(msg);
}

} // namespace dummy_gear_cmd_publisher

#include <rclcpp_components/register_node_macro.hpp>
RCLCPP_COMPONENTS_REGISTER_NODE(dummy_gear_cmd_publisher::DummyGearCmdPublisher)
55 changes: 55 additions & 0 deletions dummy/dummy_gear_cmd_publisher/src/dummy_gear_cmd_publisher.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
// Copyright 2024 TIER IV, 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 DUMMY_GEAR_CMD_PUBLISHER_HPP_
#define DUMMY_GEAR_CMD_PUBLISHER_HPP_

// include
#include <rclcpp/rclcpp.hpp>

#include <autoware_auto_vehicle_msgs/msg/gear_command.hpp>

namespace dummy_gear_cmd_publisher
{

class DummyGearCmdPublisher : public rclcpp::Node
{
public:
explicit DummyGearCmdPublisher(const rclcpp::NodeOptions & node_options);
~DummyGearCmdPublisher() = default;

private:
// Parameter

// Subscriber

// Publisher
rclcpp::Publisher<autoware_auto_vehicle_msgs::msg::GearCommand>::SharedPtr pub_gear_cmd_;

// Service

// Client

// Timer
rclcpp::TimerBase::SharedPtr timer_;

void onTimer();

// State

// Diagnostics
};
} // namespace dummy_gear_cmd_publisher

#endif // DUMMY_GEAR_CMD_PUBLISHER_HPP_
Loading