Skip to content

Commit 61dcfad

Browse files
authored
Merge branch 'feat/add-mrm-v0.6-launch-based-on-v3.0.0' into feat/add-leader-election-converter
2 parents dc817fa + c826a19 commit 61dcfad

7 files changed

+203
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
cmake_minimum_required(VERSION 3.14)
2+
project(trajectory_repeater)
3+
4+
find_package(autoware_cmake REQUIRED)
5+
autoware_package()
6+
7+
ament_auto_add_library(trajectory_repeater SHARED
8+
src/trajectory_repeater.cpp
9+
)
10+
ament_target_dependencies(trajectory_repeater)
11+
12+
rclcpp_components_register_node(${PROJECT_NAME}
13+
PLUGIN "trajectory_repeater::TrajectoryRepeater"
14+
EXECUTABLE ${PROJECT_NAME}_node
15+
)
16+
17+
ament_auto_package(
18+
INSTALL_TO_SHARE
19+
launch
20+
config
21+
)
+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Trajectory Repeater
2+
3+
## Purpose
4+
5+
## Inner-workings / Algorithms
6+
7+
## Inputs / Outputs
8+
9+
### Input
10+
11+
### Output
12+
13+
## Parameters
14+
15+
## Assumptions / Known limits
16+
17+
## (Optional) Error detection and handling
18+
19+
## (Optional) Performance characterization
20+
21+
## (Optional) References/External links
22+
23+
## (Optional) Future extensions / Unimplemented parts
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/**:
2+
ros__parameters:
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<launch>
2+
<arg name="trajectory_repeater_param_path" default="$(find-pkg-share trajectory_repeater)/config/trajectory_repeater.param.yaml"/>
3+
4+
<node pkg="trajectory_repeater" exec="trajectory_repeater_node" name="trajectory_repeater" output="screen">
5+
<remap from="~/input/trajectory" to="/main/planning/scenario_planning/trajectory"/>
6+
<remap from="~/output/trajectory" to="/planning/scenario_planning/trajectory"/>
7+
</node>
8+
</launch>
+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<?xml version="1.0"?>
2+
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
3+
<package format="3">
4+
<name>trajectory_repeater</name>
5+
<version>0.1.0</version>
6+
<description>The trajectory_repeater package</description>
7+
<maintainer email="makoto.kurihara@tier4.jp">Makoto Kurihara</maintainer>
8+
<license>Apache License 2.0</license>
9+
10+
<buildtool_depend>ament_cmake_auto</buildtool_depend>
11+
12+
<build_depend>autoware_cmake</build_depend>
13+
14+
<!-- depend -->
15+
<depend>autoware_auto_planning_msgs</depend>
16+
<depend>rclcpp</depend>
17+
<depend>rclcpp_components</depend>
18+
19+
<test_depend>ament_lint_auto</test_depend>
20+
<test_depend>autoware_lint_common</test_depend>
21+
22+
<export>
23+
<build_type>ament_cmake</build_type>
24+
</export>
25+
</package>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
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 "trajectory_repeater.hpp"
16+
17+
namespace trajectory_repeater
18+
{
19+
20+
TrajectoryRepeater::TrajectoryRepeater(const rclcpp::NodeOptions & node_options)
21+
: Node("trajectory_repeater", node_options)
22+
{
23+
// Parameter
24+
25+
// Subscriber
26+
sub_trajectory_ = create_subscription<autoware_auto_planning_msgs::msg::Trajectory>(
27+
"~/input/trajectory", 10, std::bind(&TrajectoryRepeater::onTrajectory, this, std::placeholders::_1));
28+
29+
// Publisher
30+
pub_trajectory_ = create_publisher<autoware_auto_planning_msgs::msg::Trajectory>("~/output/trajectory", 10);
31+
32+
// Service
33+
34+
// Client
35+
36+
// Timer
37+
using namespace std::literals::chrono_literals;
38+
timer_ = rclcpp::create_timer(this, get_clock(), 100ms, std::bind(&TrajectoryRepeater::onTimer, this));
39+
40+
// State
41+
42+
// Diagnostics
43+
44+
}
45+
46+
void TrajectoryRepeater::onTrajectory(const autoware_auto_planning_msgs::msg::Trajectory::ConstSharedPtr msg)
47+
{
48+
last_trajectory_ = msg;
49+
}
50+
51+
void TrajectoryRepeater::onTimer()
52+
{
53+
if (!last_trajectory_) {
54+
RCLCPP_DEBUG(get_logger(), "No trajectory received");
55+
return;
56+
}
57+
58+
pub_trajectory_->publish(*last_trajectory_);
59+
}
60+
61+
} // namespace trajectory_repeater
62+
63+
#include <rclcpp_components/register_node_macro.hpp>
64+
RCLCPP_COMPONENTS_REGISTER_NODE(trajectory_repeater::TrajectoryRepeater)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
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+
#ifndef TRAJECTORY_REPEATER__TRAJECTORY_REPEATER_HPP_
16+
#define TRAJECTORY_REPEATER__TRAJECTORY_REPEATER_HPP_
17+
18+
// include
19+
#include <rclcpp/rclcpp.hpp>
20+
21+
#include <autoware_auto_planning_msgs/msg/trajectory.hpp>
22+
23+
namespace trajectory_repeater
24+
{
25+
26+
class TrajectoryRepeater : public rclcpp::Node
27+
{
28+
public:
29+
explicit TrajectoryRepeater(const rclcpp::NodeOptions & node_options);
30+
~TrajectoryRepeater() = default;
31+
32+
private:
33+
// Parameter
34+
35+
// Subscriber
36+
rclcpp::Subscription<autoware_auto_planning_msgs::msg::Trajectory>::SharedPtr sub_trajectory_;
37+
38+
void onTrajectory(const autoware_auto_planning_msgs::msg::Trajectory::ConstSharedPtr msg);
39+
40+
// Publisher
41+
rclcpp::Publisher<autoware_auto_planning_msgs::msg::Trajectory>::SharedPtr pub_trajectory_;
42+
43+
// Service
44+
45+
// Client
46+
47+
// Timer
48+
rclcpp::TimerBase::SharedPtr timer_;
49+
50+
void onTimer();
51+
52+
// State
53+
autoware_auto_planning_msgs::msg::Trajectory::ConstSharedPtr last_trajectory_;
54+
55+
// Diagnostics
56+
57+
};
58+
} // namespace trajectory_repeater
59+
60+
#endif // TRAJECTORY_REPEATER__TRAJECTORY_REPEATER_HPP_

0 commit comments

Comments
 (0)