Skip to content

Commit 367707b

Browse files
committed
Resolve conflict
Signed-off-by: kminoda <koji.minoda@tier4.jp>
2 parents c59de3d + 6d8f026 commit 367707b

File tree

202 files changed

+9366
-5554
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

202 files changed

+9366
-5554
lines changed

.github/CODEOWNERS

+1-1
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ planning/behavior_velocity_occlusion_spot_module/** shumpei.wakabayashi@tier4.jp
175175
planning/behavior_velocity_out_of_lane_module/** maxime.clement@tier4.jp shumpei.wakabayashi@tier4.jp takayuki.murooka@tier4.jp tomoya.kimura@tier4.jp
176176
planning/behavior_velocity_planner/** kosuke.takeuchi@tier4.jp kyoichi.sugahara@tier4.jp makoto.kurihara@tier4.jp mamoru.sobue@tier4.jp maxime.clement@tier4.jp satoshi.ota@tier4.jp shumpei.wakabayashi@tier4.jp taiki.tanaka@tier4.jp takayuki.murooka@tier4.jp tomohito.ando@tier4.jp tomoya.kimura@tier4.jp
177177
planning/behavior_velocity_planner_common/** fumiya.watanabe@tier4.jp isamu.takagi@tier4.jp mamoru.sobue@tier4.jp shumpei.wakabayashi@tier4.jp tomoya.kimura@tier4.jp
178-
planning/behavior_velocity_run_out_module/** makoto.kurihara@tier4.jp shumpei.wakabayashi@tier4.jp takayuki.murooka@tier4.jp tomohito.ando@tier4.jp tomoya.kimura@tier4.jp
178+
planning/behavior_velocity_run_out_module/** kosuke.takeuchi@tier4.jp makoto.kurihara@tier4.jp shumpei.wakabayashi@tier4.jp takayuki.murooka@tier4.jp tomohito.ando@tier4.jp tomoya.kimura@tier4.jp
179179
planning/behavior_velocity_speed_bump_module/** mdogru@leodrive.ai shumpei.wakabayashi@tier4.jp tomoya.kimura@tier4.jp
180180
planning/behavior_velocity_stop_line_module/** fumiya.watanabe@tier4.jp shumpei.wakabayashi@tier4.jp tomoya.kimura@tier4.jp zhe.shen@tier4.jp
181181
planning/behavior_velocity_template_module/** daniel.sanchez@tier4.jp

common/tensorrt_common/include/tensorrt_common/logger.hpp

+56-7
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,15 @@
1919

2020
#include "NvInferRuntimeCommon.h"
2121

22+
#include <atomic>
2223
#include <cassert>
2324
#include <ctime>
2425
#include <iomanip>
2526
#include <iostream>
2627
#include <ostream>
2728
#include <sstream>
2829
#include <string>
30+
#include <thread>
2931

3032
namespace tensorrt_common
3133
{
@@ -200,7 +202,15 @@ class Logger : public nvinfer1::ILogger // NOLINT
200202
public:
201203
// Logger(Severity severity = Severity::kWARNING)
202204
// Logger(Severity severity = Severity::kVERBOSE)
203-
explicit Logger(Severity severity = Severity::kINFO) : mReportableSeverity(severity) {}
205+
explicit Logger(Severity severity = Severity::kINFO)
206+
: mReportableSeverity(severity), mVerbose(true), mThrottleStopFlag(false)
207+
{
208+
}
209+
210+
explicit Logger(const bool verbose, Severity severity = Severity::kINFO)
211+
: mReportableSeverity(severity), mVerbose(verbose), mThrottleStopFlag(false)
212+
{
213+
}
204214

205215
//!
206216
//! \enum TestResult
@@ -234,7 +244,44 @@ class Logger : public nvinfer1::ILogger // NOLINT
234244
//!
235245
void log(Severity severity, const char * msg) noexcept override
236246
{
237-
LogStreamConsumer(mReportableSeverity, severity) << "[TRT] " << std::string(msg) << std::endl;
247+
if (mVerbose) {
248+
LogStreamConsumer(mReportableSeverity, severity) << "[TRT] " << std::string(msg) << std::endl;
249+
}
250+
}
251+
252+
/**
253+
* @brief Logging with throttle.
254+
*
255+
* @example
256+
* Logger logger();
257+
* auto log_thread = logger.log_throttle(nvinfer1::ILogger::Severity::kINFO, "SOME MSG", 1);
258+
* // some operation
259+
* logger.stop_throttle(log_thread);
260+
*
261+
* @param severity
262+
* @param msg
263+
* @param duration
264+
* @return std::thread
265+
*
266+
*/
267+
std::thread log_throttle(Severity severity, const char * msg, const int duration) noexcept
268+
{
269+
mThrottleStopFlag.store(false);
270+
auto log_func = [this](Severity s, const char * m, const int d) {
271+
while (!mThrottleStopFlag.load()) {
272+
this->log(s, m);
273+
std::this_thread::sleep_for(std::chrono::seconds(d));
274+
}
275+
};
276+
277+
std::thread log_thread(log_func, severity, msg, duration);
278+
return log_thread;
279+
}
280+
281+
void stop_throttle(std::thread & log_thread) noexcept
282+
{
283+
mThrottleStopFlag.store(true);
284+
log_thread.join();
238285
}
239286

240287
//!
@@ -430,6 +477,8 @@ class Logger : public nvinfer1::ILogger // NOLINT
430477
}
431478

432479
Severity mReportableSeverity;
480+
bool mVerbose;
481+
std::atomic<bool> mThrottleStopFlag;
433482
};
434483

435484
namespace
@@ -444,7 +493,7 @@ namespace
444493
//!
445494
inline LogStreamConsumer LOG_VERBOSE(const Logger & logger)
446495
{
447-
return LogStreamConsumer(logger.getReportableSeverity(), Severity::kVERBOSE);
496+
return LogStreamConsumer(logger.getReportableSeverity(), Severity::kVERBOSE) << "[TRT] ";
448497
}
449498

450499
//!
@@ -456,7 +505,7 @@ inline LogStreamConsumer LOG_VERBOSE(const Logger & logger)
456505
//!
457506
inline LogStreamConsumer LOG_INFO(const Logger & logger)
458507
{
459-
return LogStreamConsumer(logger.getReportableSeverity(), Severity::kINFO);
508+
return LogStreamConsumer(logger.getReportableSeverity(), Severity::kINFO) << "[TRT] ";
460509
}
461510

462511
//!
@@ -468,7 +517,7 @@ inline LogStreamConsumer LOG_INFO(const Logger & logger)
468517
//!
469518
inline LogStreamConsumer LOG_WARN(const Logger & logger)
470519
{
471-
return LogStreamConsumer(logger.getReportableSeverity(), Severity::kWARNING);
520+
return LogStreamConsumer(logger.getReportableSeverity(), Severity::kWARNING) << "[TRT] ";
472521
}
473522

474523
//!
@@ -480,7 +529,7 @@ inline LogStreamConsumer LOG_WARN(const Logger & logger)
480529
//!
481530
inline LogStreamConsumer LOG_ERROR(const Logger & logger)
482531
{
483-
return LogStreamConsumer(logger.getReportableSeverity(), Severity::kERROR);
532+
return LogStreamConsumer(logger.getReportableSeverity(), Severity::kERROR) << "[TRT] ";
484533
}
485534

486535
//!
@@ -494,7 +543,7 @@ inline LogStreamConsumer LOG_ERROR(const Logger & logger)
494543
//!
495544
inline LogStreamConsumer LOG_FATAL(const Logger & logger)
496545
{
497-
return LogStreamConsumer(logger.getReportableSeverity(), Severity::kINTERNAL_ERROR);
546+
return LogStreamConsumer(logger.getReportableSeverity(), Severity::kINTERNAL_ERROR) << "[TRT] ";
498547
}
499548

500549
} // anonymous namespace

common/tensorrt_common/src/tensorrt_common.cpp

+4
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,11 @@ void TrtCommon::setup()
186186
} else {
187187
std::cout << "Building... " << cache_engine_path << std::endl;
188188
logger_.log(nvinfer1::ILogger::Severity::kINFO, "Start build engine");
189+
auto log_thread = logger_.log_throttle(
190+
nvinfer1::ILogger::Severity::kINFO,
191+
"Applying optimizations and building TRT CUDA engine. Please wait for a few minutes...", 5);
189192
buildEngineFromOnnx(model_file_path_, cache_engine_path);
193+
logger_.stop_throttle(log_thread);
190194
logger_.log(nvinfer1::ILogger::Severity::kINFO, "End build engine");
191195
}
192196
engine_path = cache_engine_path;

common/tier4_automatic_goal_rviz_plugin/CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ set(CMAKE_INCLUDE_CURRENT_DIR ON)
1111
add_definitions(-DQT_NO_KEYWORDS)
1212

1313
ament_auto_add_library(${PROJECT_NAME} SHARED
14+
src/automatic_checkpoint_append_tool.cpp
1415
src/automatic_goal_sender.cpp
1516
src/automatic_goal_append_tool.cpp
1617
src/automatic_goal_panel.cpp
Loading

common/tier4_automatic_goal_rviz_plugin/package.xml

+3
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
<description>The autoware automatic goal rviz plugin package</description>
77
<maintainer email="shumpei.wakabayashi@tier4.jp">Shumpei Wakabayashi</maintainer>
88
<maintainer email="dawid.moszynski@robotec.ai">Dawid Moszyński</maintainer>
9+
<maintainer email="kyoichi.sugahara@tier4.jp">Kyoichi Sugahara</maintainer>
10+
<maintainer email="satoshi.ota@tier4.jp">Satoshi Ota</maintainer>
911
<license>Apache License 2.0</license>
1012
<author email="dawid.moszynski@robotec.ai">Dawid Moszyński</author>
1113

@@ -22,6 +24,7 @@
2224
<depend>rviz_default_plugins</depend>
2325
<depend>tf2</depend>
2426
<depend>tf2_geometry_msgs</depend>
27+
<depend>tier4_autoware_utils</depend>
2528
<depend>visualization_msgs</depend>
2629
<depend>yaml-cpp</depend>
2730

common/tier4_automatic_goal_rviz_plugin/plugins/plugin_description.xml

+5
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,9 @@
99
base_class_type="rviz_common::Tool">
1010
<description>AutowareAutomaticGoalTool</description>
1111
</class>
12+
<class name="rviz_plugins/AutowareAutomaticCheckpointTool"
13+
type="rviz_plugins::AutowareAutomaticCheckpointTool"
14+
base_class_type="rviz_common::Tool">
15+
<description>AutowareAutomaticCheckpointTool</description>
16+
</class>
1217
</library>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
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+
* Software License Agreement (BSD License)
16+
*
17+
* Copyright (c) 2012, Willow Garage, Inc.
18+
* All rights reserved.
19+
*
20+
* Redistribution and use in source and binary forms, with or without
21+
* modification, are permitted provided that the following conditions
22+
* are met:
23+
*
24+
* * Redistributions of source code must retain the above copyright
25+
* notice, this list of conditions and the following disclaimer.
26+
* * Redistributions in binary form must reproduce the above
27+
* copyright notice, this list of conditions and the following
28+
* disclaimer in the documentation and/or other materials provided
29+
* with the distribution.
30+
* * Neither the name of Willow Garage, Inc. nor the names of its
31+
* contributors may be used to endorse or promote products derived
32+
* from this software without specific prior written permission.
33+
*
34+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
35+
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
36+
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
37+
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
38+
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
39+
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
40+
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
41+
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
42+
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
43+
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
44+
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
45+
* POSSIBILITY OF SUCH DAMAGE.
46+
*/
47+
48+
#include "automatic_checkpoint_append_tool.hpp"
49+
50+
#ifdef ROS_DISTRO_GALACTIC
51+
#include <tf2_geometry_msgs/tf2_geometry_msgs.h>
52+
#else
53+
#include <tf2_geometry_msgs/tf2_geometry_msgs.hpp>
54+
#endif
55+
#include <tf2_ros/transform_listener.h>
56+
57+
#include <string>
58+
59+
namespace rviz_plugins
60+
{
61+
AutowareAutomaticCheckpointTool::AutowareAutomaticCheckpointTool()
62+
{
63+
shortcut_key_ = 'c';
64+
65+
pose_topic_property_ = new rviz_common::properties::StringProperty(
66+
"Pose Topic", "~/automatic_goal/checkpoint", "The topic on which to publish automatic_goal.",
67+
getPropertyContainer(), SLOT(updateTopic()), this);
68+
std_dev_x_ = new rviz_common::properties::FloatProperty(
69+
"X std deviation", 0.5, "X standard deviation for checkpoint pose [m]", getPropertyContainer());
70+
std_dev_y_ = new rviz_common::properties::FloatProperty(
71+
"Y std deviation", 0.5, "Y standard deviation for checkpoint pose [m]", getPropertyContainer());
72+
std_dev_theta_ = new rviz_common::properties::FloatProperty(
73+
"Theta std deviation", M_PI / 12.0, "Theta standard deviation for checkpoint pose [rad]",
74+
getPropertyContainer());
75+
position_z_ = new rviz_common::properties::FloatProperty(
76+
"Z position", 0.0, "Z position for checkpoint pose [m]", getPropertyContainer());
77+
std_dev_x_->setMin(0);
78+
std_dev_y_->setMin(0);
79+
std_dev_theta_->setMin(0);
80+
position_z_->setMin(0);
81+
}
82+
83+
void AutowareAutomaticCheckpointTool::onInitialize()
84+
{
85+
PoseTool::onInitialize();
86+
setName("2D AppendCheckpoint");
87+
updateTopic();
88+
}
89+
90+
void AutowareAutomaticCheckpointTool::updateTopic()
91+
{
92+
rclcpp::Node::SharedPtr raw_node = context_->getRosNodeAbstraction().lock()->get_raw_node();
93+
pose_pub_ = raw_node->create_publisher<geometry_msgs::msg::PoseStamped>(
94+
pose_topic_property_->getStdString(), 1);
95+
clock_ = raw_node->get_clock();
96+
}
97+
98+
void AutowareAutomaticCheckpointTool::onPoseSet(double x, double y, double theta)
99+
{
100+
// pose
101+
std::string fixed_frame = context_->getFixedFrame().toStdString();
102+
geometry_msgs::msg::PoseStamped pose;
103+
pose.header.frame_id = fixed_frame;
104+
pose.header.stamp = clock_->now();
105+
pose.pose.position.x = x;
106+
pose.pose.position.y = y;
107+
pose.pose.position.z = position_z_->getFloat();
108+
109+
tf2::Quaternion quat;
110+
quat.setRPY(0.0, 0.0, theta);
111+
pose.pose.orientation = tf2::toMsg(quat);
112+
RCLCPP_INFO(
113+
rclcpp::get_logger("AutowareAutomaticCheckpointTool"),
114+
"Setting pose: %.3f %.3f %.3f %.3f [frame=%s]", x, y, position_z_->getFloat(), theta,
115+
fixed_frame.c_str());
116+
pose_pub_->publish(pose);
117+
}
118+
119+
} // end namespace rviz_plugins
120+
121+
#include <pluginlib/class_list_macros.hpp>
122+
PLUGINLIB_EXPORT_CLASS(rviz_plugins::AutowareAutomaticCheckpointTool, rviz_common::Tool)

0 commit comments

Comments
 (0)