Skip to content

Commit 18a2306

Browse files
authored
Merge branch 'main' into feat/add_dynamic_lanelet_to_planning
2 parents 0833903 + a64566e commit 18a2306

File tree

168 files changed

+1956
-2232
lines changed

Some content is hidden

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

168 files changed

+1956
-2232
lines changed

.cppcheck_suppressions

-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ missingIncludeSystem
66
noConstructor
77
unknownMacro
88
unmatchedSuppression
9-
unreadVariable
109
unusedFunction
1110
useInitializationList
1211
useStlAlgorithm

.github/CODEOWNERS

+3-2
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ perception/autoware_raindrop_cluster_filter/** dai.nguyen@tier4.jp yoshi.ri@tier
134134
perception/autoware_shape_estimation/** kcolak@leodrive.ai yoshi.ri@tier4.jp yukihiro.saito@tier4.jp
135135
perception/autoware_simple_object_merger/** satoshi.tanaka@tier4.jp shunsuke.miura@tier4.jp yoshi.ri@tier4.jp
136136
perception/autoware_tensorrt_classifier/** kotaro.uetake@tier4.jp shunsuke.miura@tier4.jp
137-
perception/autoware_tensorrt_yolox/** dan.umeda@tier4.jp manato.hirabayashi@tier4.jp
137+
perception/autoware_tensorrt_yolox/** dan.umeda@tier4.jp manato.hirabayashi@tier4.jp kotaro.uetake@tier4.jp
138138
perception/autoware_tracking_object_merger/** taekjin.lee@tier4.jp yoshi.ri@tier4.jp yukihiro.saito@tier4.jp
139139
perception/autoware_traffic_light_arbiter/** kenzo.lobos@tier4.jp shunsuke.miura@tier4.jp
140140
perception/autoware_traffic_light_classifier/** shunsuke.miura@tier4.jp tao.zhong@tier4.jp yukihiro.saito@tier4.jp
@@ -200,6 +200,7 @@ planning/sampling_based_planner/autoware_frenet_planner/** maxime.clement@tier4.
200200
planning/sampling_based_planner/autoware_path_sampler/** maxime.clement@tier4.jp
201201
planning/sampling_based_planner/autoware_sampler_common/** maxime.clement@tier4.jp
202202
sensing/autoware_image_diagnostics/** dai.nguyen@tier4.jp yoshi.ri@tier4.jp
203+
sensing/autoware_imu_corrector/** taiki.yamada@tier4.jp yamato.ando@tier4.jp
203204
sensing/autoware_image_transport_decompressor/** kenzo.lobos@tier4.jp yukihiro.saito@tier4.jp
204205
sensing/autoware_pcl_extensions/** david.wong@tier4.jp kenzo.lobos@tier4.jp ryu.yamamoto@tier4.jp
205206
sensing/autoware_pointcloud_preprocessor/** abrahammonrroy@yahoo.com dai.nguyen@tier4.jp david.wong@tier4.jp kenzo.lobos@tier4.jp kyoichi.sugahara@tier4.jp melike@leodrive.ai shunsuke.miura@tier4.jp yihsiang.fang@tier4.jp yoshi.ri@tier4.jp yukihiro.saito@tier4.jp
@@ -221,7 +222,7 @@ system/autoware_component_monitor/** memin@leodrive.ai
221222
system/autoware_processing_time_checker/** kosuke.takeuchi@tier4.jp takayuki.murooka@tier4.jp
222223
system/bluetooth_monitor/** fumihito.ito@tier4.jp
223224
system/component_state_monitor/** isamu.takagi@tier4.jp
224-
system/default_ad_api/** isamu.takagi@tier4.jp ryohsuke.mitsudome@tier4.jp yukihiro.saito@tier4.jp
225+
system/autoware_default_adapi/** isamu.takagi@tier4.jp ryohsuke.mitsudome@tier4.jp yukihiro.saito@tier4.jp
225226
system/default_ad_api_helpers/ad_api_adaptors/** isamu.takagi@tier4.jp ryohsuke.mitsudome@tier4.jp yukihiro.saito@tier4.jp
226227
system/default_ad_api_helpers/ad_api_visualizers/** isamu.takagi@tier4.jp ryohsuke.mitsudome@tier4.jp yukihiro.saito@tier4.jp
227228
system/default_ad_api_helpers/automatic_pose_initializer/** isamu.takagi@tier4.jp ryohsuke.mitsudome@tier4.jp yukihiro.saito@tier4.jp

common/autoware_motion_utils/include/autoware/motion_utils/trajectory/trajectory.hpp

+9
Original file line numberDiff line numberDiff line change
@@ -2504,6 +2504,15 @@ extern template bool isTargetPointFront<std::vector<autoware_planning_msgs::msg:
25042504
const geometry_msgs::msg::Point & base_point, const geometry_msgs::msg::Point & target_point,
25052505
const double threshold = 0.0);
25062506

2507+
/// @brief calculate the time_from_start fields of the given trajectory points
2508+
/// @details this function assumes constant longitudinal velocity between points
2509+
/// @param trajectory trajectory for which to calculate the time_from_start
2510+
/// @param current_ego_point current ego position
2511+
/// @param min_velocity minimum velocity used for a trajectory point
2512+
void calculate_time_from_start(
2513+
std::vector<autoware_planning_msgs::msg::TrajectoryPoint> & trajectory,
2514+
const geometry_msgs::msg::Point & current_ego_point, const float min_velocity = 1.0f);
2515+
25072516
} // namespace autoware::motion_utils
25082517

25092518
#endif // AUTOWARE__MOTION_UTILS__TRAJECTORY__TRAJECTORY_HPP_

common/autoware_motion_utils/src/trajectory/trajectory.cpp

+23
Original file line numberDiff line numberDiff line change
@@ -599,4 +599,27 @@ template bool isTargetPointFront<std::vector<autoware_planning_msgs::msg::Trajec
599599
const geometry_msgs::msg::Point & base_point, const geometry_msgs::msg::Point & target_point,
600600
const double threshold);
601601

602+
void calculate_time_from_start(
603+
std::vector<autoware_planning_msgs::msg::TrajectoryPoint> & trajectory,
604+
const geometry_msgs::msg::Point & current_ego_point, const float min_velocity)
605+
{
606+
const auto nearest_segment_idx = findNearestSegmentIndex(trajectory, current_ego_point);
607+
if (nearest_segment_idx + 1 == trajectory.size()) {
608+
return;
609+
}
610+
for (auto & p : trajectory) {
611+
p.time_from_start = rclcpp::Duration::from_seconds(0);
612+
}
613+
// TODO(Maxime): some points can have very low velocities which introduce huge time errors
614+
// Temporary solution: use a minimum velocity
615+
for (auto idx = nearest_segment_idx + 1; idx < trajectory.size(); ++idx) {
616+
const auto & from = trajectory[idx - 1];
617+
const auto velocity = std::max(min_velocity, from.longitudinal_velocity_mps);
618+
if (velocity != 0.0) {
619+
auto & to = trajectory[idx];
620+
const auto t = universe_utils::calcDistance2d(from, to) / velocity;
621+
to.time_from_start = rclcpp::Duration::from_seconds(t) + from.time_from_start;
622+
}
623+
}
624+
}
602625
} // namespace autoware::motion_utils

common/autoware_universe_utils/include/autoware/universe_utils/system/time_keeper.hpp

+2
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
#include <memory>
2626
#include <ostream>
2727
#include <string>
28+
#include <thread>
2829
#include <vector>
2930

3031
namespace autoware::universe_utils
@@ -169,6 +170,7 @@ class TimeKeeper
169170
std::shared_ptr<ProcessingTimeNode>
170171
current_time_node_; //!< Shared pointer to the current time node
171172
std::shared_ptr<ProcessingTimeNode> root_node_; //!< Shared pointer to the root time node
173+
std::thread::id root_node_thread_id_; //!< ID of the thread that started the tracking
172174
autoware::universe_utils::StopWatch<
173175
std::chrono::milliseconds, std::chrono::microseconds, std::chrono::steady_clock>
174176
stop_watch_; //!< StopWatch object for tracking the processing time

common/autoware_universe_utils/src/system/time_keeper.cpp

+14-1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@
1414

1515
#include "autoware/universe_utils/system/time_keeper.hpp"
1616

17+
#include <rclcpp/logging.hpp>
18+
#include <rclcpp/rclcpp.hpp>
19+
1720
#include <fmt/format.h>
1821

1922
#include <stdexcept>
@@ -129,7 +132,14 @@ void TimeKeeper::start_track(const std::string & func_name)
129132
if (current_time_node_ == nullptr) {
130133
current_time_node_ = std::make_shared<ProcessingTimeNode>(func_name);
131134
root_node_ = current_time_node_;
135+
root_node_thread_id_ = std::this_thread::get_id();
132136
} else {
137+
if (root_node_thread_id_ != std::this_thread::get_id()) {
138+
RCLCPP_WARN(
139+
rclcpp::get_logger("TimeKeeper"),
140+
"TimeKeeper::start_track() is called from a different thread. Ignoring the call.");
141+
return;
142+
}
133143
current_time_node_ = current_time_node_->add_child(func_name);
134144
}
135145
stop_watch_.tic(func_name);
@@ -145,6 +155,9 @@ void TimeKeeper::comment(const std::string & comment)
145155

146156
void TimeKeeper::end_track(const std::string & func_name)
147157
{
158+
if (root_node_thread_id_ != std::this_thread::get_id()) {
159+
return;
160+
}
148161
if (current_time_node_->get_name() != func_name) {
149162
throw std::runtime_error(fmt::format(
150163
"You must call end_track({}) first, but end_track({}) is called",
@@ -178,7 +191,7 @@ ScopedTimeTrack::ScopedTimeTrack(const std::string & func_name, TimeKeeper & tim
178191
time_keeper_.start_track(func_name_);
179192
}
180193

181-
ScopedTimeTrack::~ScopedTimeTrack()
194+
ScopedTimeTrack::~ScopedTimeTrack() // NOLINT
182195
{
183196
time_keeper_.end_track(func_name_);
184197
}

common/autoware_universe_utils/test/src/system/test_time_keeper.cpp

+60-21
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
14-
1514
#include "autoware/universe_utils/system/time_keeper.hpp"
1615

1716
#include <rclcpp/node.hpp>
@@ -20,34 +19,74 @@
2019
#include <gtest/gtest.h>
2120

2221
#include <chrono>
23-
#include <iostream>
22+
#include <sstream>
2423
#include <thread>
2524

26-
TEST(system, TimeKeeper)
25+
class TimeKeeperTest : public ::testing::Test
2726
{
28-
using autoware::universe_utils::ScopedTimeTrack;
29-
using autoware::universe_utils::TimeKeeper;
27+
protected:
28+
std::ostringstream oss;
29+
rclcpp::Node::SharedPtr node;
30+
rclcpp::Publisher<autoware::universe_utils::ProcessingTimeDetail>::SharedPtr publisher;
31+
std::unique_ptr<autoware::universe_utils::TimeKeeper> time_keeper;
3032

31-
rclcpp::Node node{"sample_node"};
32-
33-
auto publisher = node.create_publisher<autoware::universe_utils::ProcessingTimeDetail>(
34-
"~/debug/processing_time_tree", 1);
33+
void SetUp() override
34+
{
35+
node = std::make_shared<rclcpp::Node>("test_node");
36+
publisher = node->create_publisher<autoware::universe_utils::ProcessingTimeDetail>(
37+
"~/debug/processing_time_tree", 1);
38+
time_keeper = std::make_unique<autoware::universe_utils::TimeKeeper>(&oss, publisher);
39+
}
40+
};
3541

36-
TimeKeeper time_keeper(&std::cerr, publisher);
42+
TEST_F(TimeKeeperTest, BasicFunctionality)
43+
{
44+
using autoware::universe_utils::ScopedTimeTrack;
3745

38-
ScopedTimeTrack st{"main_func", time_keeper};
46+
{
47+
ScopedTimeTrack st{"main_func", *time_keeper};
3948

40-
{ // funcA
41-
ScopedTimeTrack st{"funcA", time_keeper};
42-
std::this_thread::sleep_for(std::chrono::seconds(1));
43-
}
49+
{ // funcA
50+
ScopedTimeTrack st{"funcA", *time_keeper};
51+
std::this_thread::sleep_for(std::chrono::milliseconds(100));
52+
}
4453

45-
{ // funcB
46-
ScopedTimeTrack st{"funcB", time_keeper};
47-
std::this_thread::sleep_for(std::chrono::seconds(1));
48-
{ // funcC
49-
ScopedTimeTrack st{"funcC", time_keeper};
50-
std::this_thread::sleep_for(std::chrono::seconds(1));
54+
{ // funcB
55+
ScopedTimeTrack st{"funcB", *time_keeper};
56+
std::this_thread::sleep_for(std::chrono::milliseconds(100));
57+
{ // funcC
58+
ScopedTimeTrack st{"funcC", *time_keeper};
59+
std::this_thread::sleep_for(std::chrono::milliseconds(100));
60+
}
5161
}
5262
}
63+
64+
// Check if the output contains all function names
65+
std::string output = oss.str();
66+
EXPECT_TRUE(output.find("main_func") != std::string::npos);
67+
EXPECT_TRUE(output.find("funcA") != std::string::npos);
68+
EXPECT_TRUE(output.find("funcB") != std::string::npos);
69+
EXPECT_TRUE(output.find("funcC") != std::string::npos);
70+
}
71+
72+
TEST_F(TimeKeeperTest, MultiThreadWarning)
73+
{
74+
testing::internal::CaptureStderr();
75+
76+
std::thread t([this]() {
77+
time_keeper->start_track("ThreadFunction");
78+
std::this_thread::sleep_for(std::chrono::milliseconds(10));
79+
time_keeper->end_track("ThreadFunction");
80+
});
81+
82+
time_keeper->start_track("MainFunction");
83+
std::this_thread::sleep_for(std::chrono::milliseconds(20));
84+
time_keeper->end_track("MainFunction");
85+
86+
t.join();
87+
88+
std::string err = testing::internal::GetCapturedStderr();
89+
EXPECT_TRUE(
90+
err.find("TimeKeeper::start_track() is called from a different thread. Ignoring the call.") !=
91+
std::string::npos);
5392
}

common/tier4_camera_view_rviz_plugin/src/bird_eye_view_controller.cpp

+3
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ void BirdEyeViewController::reset()
9999
y_property_->setFloat(0);
100100
}
101101

102+
// cppcheck-suppress unusedFunction
102103
void BirdEyeViewController::handleMouseEvent(rviz_common::ViewportMouseEvent & event)
103104
{
104105
if (event.shift()) {
@@ -178,11 +179,13 @@ void BirdEyeViewController::update(float dt, float ros_dt)
178179
updateCamera();
179180
}
180181

182+
// cppcheck-suppress unusedFunction
181183
void BirdEyeViewController::lookAt(const Ogre::Vector3 & point)
182184
{
183185
setPosition(point - target_scene_node_->getPosition());
184186
}
185187

188+
// cppcheck-suppress unusedFunction
186189
void BirdEyeViewController::onTargetFrameChanged(
187190
const Ogre::Vector3 & old_reference_position,
188191
const Ogre::Quaternion & /*old_reference_orientation*/)

common/tier4_camera_view_rviz_plugin/src/third_person_view_controller.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,7 @@ void ThirdPersonViewController::updateCamera()
226226
distance_property_->getFloat() * CAMERA_OFFSET);
227227
}
228228

229+
// cppcheck-suppress unusedFunction
229230
void ThirdPersonViewController::updateTargetSceneNode()
230231
{
231232
if (FramePositionTrackingViewController::getNewTransform()) {

common/traffic_light_utils/include/traffic_light_utils/traffic_light_utils.hpp

-7
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,6 @@
3030
namespace traffic_light_utils
3131
{
3232

33-
bool isRoiValid(
34-
const tier4_perception_msgs::msg::TrafficLightRoi & roi, uint32_t width, uint32_t height);
35-
36-
void setRoiInvalid(tier4_perception_msgs::msg::TrafficLightRoi & roi);
37-
38-
bool isSignalUnknown(const tier4_perception_msgs::msg::TrafficLight & signal);
39-
4033
void setSignalUnknown(tier4_perception_msgs::msg::TrafficLight & signal, float confidence = -1);
4134

4235
/**

common/traffic_light_utils/src/traffic_light_utils.cpp

-23
Original file line numberDiff line numberDiff line change
@@ -17,29 +17,6 @@
1717
namespace traffic_light_utils
1818
{
1919

20-
bool isRoiValid(
21-
const tier4_perception_msgs::msg::TrafficLightRoi & roi, uint32_t width, uint32_t height)
22-
{
23-
uint32_t x1 = roi.roi.x_offset;
24-
uint32_t x2 = roi.roi.x_offset + roi.roi.width;
25-
uint32_t y1 = roi.roi.y_offset;
26-
uint32_t y2 = roi.roi.y_offset + roi.roi.height;
27-
return roi.roi.width > 0 && roi.roi.height > 0 && x1 < width && y1 < height && x2 < width &&
28-
y2 < height;
29-
}
30-
31-
void setRoiInvalid(tier4_perception_msgs::msg::TrafficLightRoi & roi)
32-
{
33-
roi.roi.height = roi.roi.width = 0;
34-
}
35-
36-
bool isSignalUnknown(const tier4_perception_msgs::msg::TrafficLight & signal)
37-
{
38-
return signal.elements.size() == 1 &&
39-
signal.elements[0].shape == tier4_perception_msgs::msg::TrafficLightElement::UNKNOWN &&
40-
signal.elements[0].color == tier4_perception_msgs::msg::TrafficLightElement::UNKNOWN;
41-
}
42-
4320
void setSignalUnknown(tier4_perception_msgs::msg::TrafficLight & signal, float confidence)
4421
{
4522
signal.elements.resize(1);

common/traffic_light_utils/test/test_traffic_light_utils.cpp

-40
Original file line numberDiff line numberDiff line change
@@ -18,46 +18,6 @@
1818
namespace traffic_light_utils
1919
{
2020

21-
TEST(isRoiValid, roi_validity)
22-
{
23-
tier4_perception_msgs::msg::TrafficLightRoi test_roi;
24-
test_roi.roi.x_offset = 300;
25-
test_roi.roi.y_offset = 200;
26-
test_roi.roi.width = 340;
27-
test_roi.roi.height = 200;
28-
uint32_t img_width = 640;
29-
uint32_t img_heigh = 480;
30-
EXPECT_FALSE(isRoiValid(test_roi, img_width, img_heigh));
31-
test_roi.roi.width = 339;
32-
EXPECT_TRUE(isRoiValid(test_roi, img_width, img_heigh));
33-
}
34-
35-
TEST(setRoiInvalid, set_roi_size)
36-
{
37-
tier4_perception_msgs::msg::TrafficLightRoi test_roi;
38-
test_roi.roi.x_offset = 300;
39-
test_roi.roi.y_offset = 200;
40-
test_roi.roi.width = 300;
41-
test_roi.roi.height = 200;
42-
EXPECT_EQ(test_roi.roi.width, (uint32_t)300);
43-
EXPECT_EQ(test_roi.roi.height, (uint32_t)200);
44-
setRoiInvalid(test_roi);
45-
EXPECT_EQ(test_roi.roi.width, (uint32_t)0);
46-
EXPECT_EQ(test_roi.roi.height, (uint32_t)0);
47-
}
48-
49-
TEST(isSignalUnknown, signal_element)
50-
{
51-
tier4_perception_msgs::msg::TrafficLight test_signal;
52-
tier4_perception_msgs::msg::TrafficLightElement element;
53-
element.color = tier4_perception_msgs::msg::TrafficLightElement::UNKNOWN;
54-
element.shape = tier4_perception_msgs::msg::TrafficLightElement::UNKNOWN;
55-
test_signal.elements.push_back(element);
56-
EXPECT_TRUE(isSignalUnknown(test_signal));
57-
test_signal.elements[0].color = tier4_perception_msgs::msg::TrafficLightElement::RED;
58-
EXPECT_FALSE(isSignalUnknown(test_signal));
59-
}
60-
6121
TEST(setSignalUnknown, set_signal_element)
6222
{
6323
tier4_perception_msgs::msg::TrafficLight test_signal;

control/autoware_autonomous_emergency_braking/README.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88

99
This module has following assumptions.
1010

11-
- It is used when driving at low speeds (about 15 km/h).
12-
1311
- The predicted path of the ego vehicle can be made from either the path created from sensors or the path created from a control module, or both.
1412

1513
- The current speed and angular velocity can be obtained from the sensors of the ego vehicle, and it uses points as obstacles.
@@ -25,7 +23,7 @@ The pros and cons of both approaches are:
2523
IMU angular velocity:
2624

2725
- (+) Usually, it has high accuracy
28-
- (-)Vehicle vibration might introduce noise.
26+
- (-) Vehicle vibration might introduce noise.
2927

3028
Steering angle:
3129

@@ -186,7 +184,7 @@ The AEB module can also prevent collisions when the ego vehicle is moving backwa
186184

187185
When vehicle odometry information is faulty, it is possible that the MPC fails to predict a correct path for the ego vehicle. If the MPC predicted path is wrong, collision avoidance will not work as intended on the planning modules. However, the AEB’s IMU path does not depend on the MPC and could be able to predict a collision when the other modules cannot. As an example you can see a figure of a hypothetical case in which the MPC path is wrong and only the AEB’s IMU path detects a collision.
188186

189-
![backward driving](./image/wrong-mpc.drawio.svg)
187+
![wrong mpc](./image/wrong-mpc.drawio.svg)
190188

191189
## Parameters
192190

@@ -217,6 +215,8 @@ When vehicle odometry information is faulty, it is possible that the MPC fails t
217215

218216
## Limitations
219217

218+
- The distance required to stop after collision detection depends on the ego vehicle's speed and deceleration performance. To avoid collisions, it's necessary to increase the detection distance and set a higher deceleration rate. However, this creates a trade-off as it may also increase the number of unnecessary activations. Therefore, it's essential to consider what role this module should play and adjust the parameters accordingly.
219+
220220
- AEB might not be able to react with obstacles that are close to the ground. It depends on the performance of the pre-processing methods applied to the point cloud.
221221

222222
- Longitudinal acceleration information obtained from sensors is not used due to the high amount of noise.

0 commit comments

Comments
 (0)