Skip to content

Commit 5f385e1

Browse files
authored
Merge branch 'main' into fix/fix_sensing_docs
2 parents c92e191 + c476676 commit 5f385e1

File tree

14 files changed

+114
-48
lines changed

14 files changed

+114
-48
lines changed

perception/autoware_tensorrt_classifier/src/tensorrt_classifier.cpp

+9-3
Original file line numberDiff line numberDiff line change
@@ -193,9 +193,15 @@ TrtClassifier::TrtClassifier(
193193

194194
TrtClassifier::~TrtClassifier()
195195
{
196-
if (m_cuda) {
197-
if (h_img_) CHECK_CUDA_ERROR(cudaFreeHost(h_img_));
198-
if (d_img_) CHECK_CUDA_ERROR(cudaFree(d_img_));
196+
try {
197+
if (m_cuda) {
198+
if (h_img_) CHECK_CUDA_ERROR(cudaFreeHost(h_img_));
199+
if (d_img_) CHECK_CUDA_ERROR(cudaFree(d_img_));
200+
}
201+
} catch (const std::exception & e) {
202+
std::cerr << "Exception in TrtClassifier destructor: " << e.what() << std::endl;
203+
} catch (...) {
204+
std::cerr << "Unknown exception in TrtClassifier destructor" << std::endl;
199205
}
200206
}
201207

perception/autoware_tensorrt_yolox/src/tensorrt_yolox.cpp

+15-9
Original file line numberDiff line numberDiff line change
@@ -341,16 +341,22 @@ TrtYoloX::TrtYoloX(
341341

342342
TrtYoloX::~TrtYoloX()
343343
{
344-
if (use_gpu_preprocess_) {
345-
if (image_buf_h_) {
346-
image_buf_h_.reset();
347-
}
348-
if (image_buf_d_) {
349-
image_buf_d_.reset();
350-
}
351-
if (argmax_buf_d_) {
352-
argmax_buf_d_.reset();
344+
try {
345+
if (use_gpu_preprocess_) {
346+
if (image_buf_h_) {
347+
image_buf_h_.reset();
348+
}
349+
if (image_buf_d_) {
350+
image_buf_d_.reset();
351+
}
352+
if (argmax_buf_d_) {
353+
argmax_buf_d_.reset();
354+
}
353355
}
356+
} catch (const std::exception & e) {
357+
std::cerr << "Exception in TrtYoloX destructor: " << e.what() << std::endl;
358+
} catch (...) {
359+
std::cerr << "Unknown exception in TrtYoloX destructor" << std::endl;
354360
}
355361
}
356362

perception/autoware_traffic_light_arbiter/README.md

+3-2
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@ The table below outlines how the matching process determines the output based on
4343

4444
| Name | Type | Default Value | Description |
4545
| --------------------------- | ------ | ------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
46-
| `external_time_tolerance` | double | 5.0 | The duration in seconds an external message is considered valid for merging |
47-
| `perception_time_tolerance` | double | 1.0 | The duration in seconds a perception message is considered valid for merging |
46+
| `external_delay_tolerance` | double | 5.0 | The duration in seconds an external message is considered valid for merging in comparison with current time |
47+
| `external_time_tolerance` | double | 5.0 | The duration in seconds an external message is considered valid for merging in comparison with a timestamp of perception message |
48+
| `perception_time_tolerance` | double | 1.0 | The duration in seconds a perception message is considered valid for merging in comparison with a timestamp of external message |
4849
| `external_priority` | bool | false | Whether or not externals signals take precedence over perception-based ones. If false, the merging uses confidence as a criteria |
4950
| `enable_signal_matching` | bool | false | Decide whether to validate the match between perception signals and external signals. If set to true, verify that the colors match and only publish them if they are identical |

perception/autoware_traffic_light_arbiter/config/traffic_light_arbiter.param.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
/**:
22
ros__parameters:
3+
external_delay_tolerance: 5.0
34
external_time_tolerance: 5.0
45
perception_time_tolerance: 1.0
56
external_priority: false

perception/autoware_traffic_light_arbiter/include/autoware/traffic_light_arbiter/traffic_light_arbiter.hpp

+1
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ class TrafficLightArbiter : public rclcpp::Node
5151

5252
std::unique_ptr<std::unordered_set<lanelet::Id>> map_regulatory_elements_set_;
5353

54+
double external_delay_tolerance_;
5455
double external_time_tolerance_;
5556
double perception_time_tolerance_;
5657
bool external_priority_;

perception/autoware_traffic_light_arbiter/src/traffic_light_arbiter.cpp

+17-2
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#include <lanelet2_core/LaneletMap.h>
2121
#include <lanelet2_core/primitives/BasicRegulatoryElements.h>
2222

23+
#include <algorithm>
2324
#include <map>
2425
#include <memory>
2526
#include <tuple>
@@ -70,6 +71,7 @@ namespace autoware
7071
TrafficLightArbiter::TrafficLightArbiter(const rclcpp::NodeOptions & options)
7172
: Node("traffic_light_arbiter", options)
7273
{
74+
external_delay_tolerance_ = this->declare_parameter<double>("external_delay_tolerance", 5.0);
7375
external_time_tolerance_ = this->declare_parameter<double>("external_time_tolerance", 5.0);
7476
perception_time_tolerance_ = this->declare_parameter<double>("perception_time_tolerance", 1.0);
7577
external_priority_ = this->declare_parameter<bool>("external_priority", false);
@@ -119,7 +121,7 @@ void TrafficLightArbiter::onPerceptionMsg(const TrafficSignalArray::ConstSharedP
119121
latest_perception_msg_ = *msg;
120122

121123
if (
122-
(rclcpp::Time(msg->stamp) - rclcpp::Time(latest_external_msg_.stamp)).seconds() >
124+
std::abs((rclcpp::Time(msg->stamp) - rclcpp::Time(latest_external_msg_.stamp)).seconds()) >
123125
external_time_tolerance_) {
124126
latest_external_msg_.traffic_light_groups.clear();
125127
}
@@ -129,10 +131,16 @@ void TrafficLightArbiter::onPerceptionMsg(const TrafficSignalArray::ConstSharedP
129131

130132
void TrafficLightArbiter::onExternalMsg(const TrafficSignalArray::ConstSharedPtr msg)
131133
{
134+
if (std::abs((this->now() - rclcpp::Time(msg->stamp)).seconds()) > external_delay_tolerance_) {
135+
RCLCPP_WARN_THROTTLE(
136+
get_logger(), *get_clock(), 5000, "Received outdated V2X traffic signal messages");
137+
return;
138+
}
139+
132140
latest_external_msg_ = *msg;
133141

134142
if (
135-
(rclcpp::Time(msg->stamp) - rclcpp::Time(latest_perception_msg_.stamp)).seconds() >
143+
std::abs((rclcpp::Time(msg->stamp) - rclcpp::Time(latest_perception_msg_.stamp)).seconds()) >
136144
perception_time_tolerance_) {
137145
latest_perception_msg_.traffic_light_groups.clear();
138146
}
@@ -229,6 +237,13 @@ void TrafficLightArbiter::arbitrateAndPublish(const builtin_interfaces::msg::Tim
229237
}
230238

231239
pub_->publish(output_signals_msg);
240+
241+
const auto latest_time =
242+
std::max(rclcpp::Time(latest_perception_msg_.stamp), rclcpp::Time(latest_external_msg_.stamp));
243+
if (rclcpp::Time(output_signals_msg.stamp) < latest_time) {
244+
RCLCPP_WARN_THROTTLE(
245+
get_logger(), *get_clock(), 5000, "Published traffic signal messages are not latest");
246+
}
232247
}
233248
} // namespace autoware
234249

perception/autoware_traffic_light_arbiter/test/test_node.cpp

+10
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,9 @@ TEST(TrafficLightArbiterTest, testTrafficSignalOnlyPerceptionMsg)
196196
};
197197
test_manager->set_subscriber<TrafficSignalArray>(output_topic, callback);
198198

199+
// stamp preparation
200+
perception_msg.stamp = test_target_node->now();
201+
199202
test_manager->test_pub_msg<LaneletMapBin>(
200203
test_target_node, input_map_topic, vector_map_msg, rclcpp::QoS(1).transient_local());
201204
test_manager->test_pub_msg<TrafficSignalArray>(
@@ -229,6 +232,9 @@ TEST(TrafficLightArbiterTest, testTrafficSignalOnlyExternalMsg)
229232
};
230233
test_manager->set_subscriber<TrafficSignalArray>(output_topic, callback);
231234

235+
// stamp preparation
236+
external_msg.stamp = test_target_node->now();
237+
232238
test_manager->test_pub_msg<LaneletMapBin>(
233239
test_target_node, input_map_topic, vector_map_msg, rclcpp::QoS(1).transient_local());
234240
test_manager->test_pub_msg<TrafficSignalArray>(
@@ -268,6 +274,10 @@ TEST(TrafficLightArbiterTest, testTrafficSignalBothMsg)
268274
};
269275
test_manager->set_subscriber<TrafficSignalArray>(output_topic, callback);
270276

277+
// stamp preparation
278+
external_msg.stamp = test_target_node->now();
279+
perception_msg.stamp = test_target_node->now();
280+
271281
test_manager->test_pub_msg<LaneletMapBin>(
272282
test_target_node, input_map_topic, vector_map_msg, rclcpp::QoS(1).transient_local());
273283
test_manager->test_pub_msg<TrafficSignalArray>(

planning/behavior_path_planner/autoware_behavior_path_lane_change_module/include/autoware/behavior_path_lane_change_module/utils/markers.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ using autoware::behavior_path_planner::lane_change::Debug;
3535
using autoware::behavior_path_planner::utils::path_safety_checker::ExtendedPredictedObjects;
3636
using visualization_msgs::msg::MarkerArray;
3737
MarkerArray showAllValidLaneChangePath(
38-
const std::vector<LaneChangePath> & lanes, std::string && ns);
38+
const std::vector<LaneChangePath> & lane_change_paths, std::string && ns);
3939
MarkerArray createLaneChangingVirtualWallMarker(
4040
const geometry_msgs::msg::Pose & lane_changing_pose, const std::string & module_name,
4141
const rclcpp::Time & now, const std::string & ns);

planning/behavior_path_planner/autoware_behavior_path_lane_change_module/src/utils/markers.cpp

+50-10
Original file line numberDiff line numberDiff line change
@@ -38,34 +38,74 @@ using autoware::universe_utils::createDefaultMarker;
3838
using autoware::universe_utils::createMarkerScale;
3939
using geometry_msgs::msg::Point;
4040

41-
MarkerArray showAllValidLaneChangePath(const std::vector<LaneChangePath> & lanes, std::string && ns)
41+
MarkerArray showAllValidLaneChangePath(
42+
const std::vector<LaneChangePath> & lane_change_paths, std::string && ns)
4243
{
43-
if (lanes.empty()) {
44+
if (lane_change_paths.empty()) {
4445
return MarkerArray{};
4546
}
4647

4748
MarkerArray marker_array;
48-
int32_t id{0};
4949
const auto current_time{rclcpp::Clock{RCL_ROS_TIME}.now()};
5050

5151
const auto colors = colors::colors_list();
52-
const auto loop_size = std::min(lanes.size(), colors.size());
52+
const auto loop_size = std::min(lane_change_paths.size(), colors.size());
5353
marker_array.markers.reserve(loop_size);
5454

55+
const auto info_prep_to_string =
56+
[](const autoware::behavior_path_planner::lane_change::Info & info) -> std::string {
57+
std::ostringstream ss_text;
58+
ss_text << std::setprecision(3) << "vel: " << info.velocity.prepare
59+
<< "[m/s] | lon_acc: " << info.longitudinal_acceleration.prepare
60+
<< "[m/s2] | t: " << info.duration.prepare << "[s] | L: " << info.length.prepare
61+
<< "[m]";
62+
return ss_text.str();
63+
};
64+
65+
const auto info_lc_to_string =
66+
[](const autoware::behavior_path_planner::lane_change::Info & info) -> std::string {
67+
std::ostringstream ss_text;
68+
ss_text << std::setprecision(3) << "vel: " << info.velocity.lane_changing
69+
<< "[m/s] | lon_acc: " << info.longitudinal_acceleration.lane_changing
70+
<< "[m/s2] | lat_acc: " << info.lateral_acceleration
71+
<< "[m/s2] | t: " << info.duration.lane_changing
72+
<< "[s] | L: " << info.length.lane_changing << "[m]";
73+
return ss_text.str();
74+
};
75+
5576
for (std::size_t idx = 0; idx < loop_size; ++idx) {
56-
if (lanes.at(idx).path.points.empty()) {
77+
int32_t id{0};
78+
const auto & lc_path = lane_change_paths.at(idx);
79+
if (lc_path.path.points.empty()) {
5780
continue;
5881
}
59-
82+
std::string ns_with_idx = ns + "[" + std::to_string(idx) + "]";
6083
const auto & color = colors.at(idx);
61-
Marker marker = createDefaultMarker(
62-
"map", current_time, ns, ++id, Marker::LINE_STRIP, createMarkerScale(0.1, 0.1, 0.0), color);
63-
marker.points.reserve(lanes.at(idx).path.points.size());
84+
const auto & points = lc_path.path.points;
85+
auto marker = createDefaultMarker(
86+
"map", current_time, ns_with_idx, ++id, Marker::LINE_STRIP, createMarkerScale(0.1, 0.1, 0.0),
87+
color);
88+
marker.points.reserve(points.size());
6489

65-
for (const auto & point : lanes.at(idx).path.points) {
90+
for (const auto & point : points) {
6691
marker.points.push_back(point.point.pose.position);
6792
}
6893

94+
auto text_marker = createDefaultMarker(
95+
"map", current_time, ns_with_idx, ++id, visualization_msgs::msg::Marker::TEXT_VIEW_FACING,
96+
createMarkerScale(0.1, 0.1, 0.8), colors::yellow());
97+
const auto prep_idx = points.size() / 4;
98+
text_marker.pose = points.at(prep_idx).point.pose;
99+
text_marker.pose.position.z += 2.0;
100+
text_marker.text = info_prep_to_string(lc_path.info);
101+
marker_array.markers.push_back(text_marker);
102+
103+
const auto lc_idx = points.size() / 2;
104+
text_marker.id = ++id;
105+
text_marker.pose = points.at(lc_idx).point.pose;
106+
text_marker.text = info_lc_to_string(lc_path.info);
107+
marker_array.markers.push_back(text_marker);
108+
69109
marker_array.markers.push_back(marker);
70110
}
71111
return marker_array;

planning/behavior_path_planner/autoware_behavior_path_static_obstacle_avoidance_module/src/scene.cpp

+1-5
Original file line numberDiff line numberDiff line change
@@ -233,11 +233,7 @@ void StaticObstacleAvoidanceModule::fillFundamentalData(
233233

234234
std::for_each(
235235
data.current_lanelets.begin(), data.current_lanelets.end(), [&](const auto & lanelet) {
236-
if (!not_use_adjacent_lane) {
237-
data.drivable_lanes.push_back(
238-
utils::static_obstacle_avoidance::generateExpandedDrivableLanes(
239-
lanelet, planner_data_, parameters_));
240-
} else if (red_signal_lane_itr->id() != lanelet.id()) {
236+
if (!not_use_adjacent_lane || red_signal_lane_itr->id() != lanelet.id()) {
241237
data.drivable_lanes.push_back(
242238
utils::static_obstacle_avoidance::generateExpandedDrivableLanes(
243239
lanelet, planner_data_, parameters_));

planning/behavior_path_planner/autoware_behavior_path_static_obstacle_avoidance_module/src/shift_line_generator.cpp

+1-3
Original file line numberDiff line numberDiff line change
@@ -264,9 +264,7 @@ AvoidOutlines ShiftLineGenerator::generateAvoidOutline(
264264
AvoidOutlines outlines;
265265
for (auto & o : data.target_objects) {
266266
if (!o.avoid_margin.has_value()) {
267-
if (!data.red_signal_lane.has_value()) {
268-
o.info = ObjectInfo::INSUFFICIENT_DRIVABLE_SPACE;
269-
} else if (data.red_signal_lane.value().id() == o.overhang_lanelet.id()) {
267+
if (data.red_signal_lane.value().id() == o.overhang_lanelet.id()) {
270268
o.info = ObjectInfo::LIMIT_DRIVABLE_SPACE_TEMPORARY;
271269
} else {
272270
o.info = ObjectInfo::INSUFFICIENT_DRIVABLE_SPACE;

sensing/autoware_pointcloud_preprocessor/docs/distortion-corrector.md

+3-10
Original file line numberDiff line numberDiff line change
@@ -55,16 +55,9 @@ ros2 launch autoware_pointcloud_preprocessor distortion_corrector.launch.xml
5555
- `hesai`: (x: 90 degrees, y: 0 degrees)
5656
- `others`: (x: 0 degrees, y: 90 degrees) and (x: 270 degrees, y: 0 degrees)
5757

58-
<table>
59-
<tr>
60-
<td><img src="./image/velodyne.drawio.png" alt="velodyne azimuth coordinate"></td>
61-
<td><img src="./image/hesai.drawio.png" alt="hesai azimuth coordinate"></td>
62-
</tr>
63-
<tr>
64-
<td><p style="text-align: center;">Velodyne azimuth coordinate</p></td>
65-
<td><p style="text-align: center;">Hesai azimuth coordinate</p></td>
66-
</tr>
67-
</table>
58+
| ![Velodyne Azimuth Coordinate](./image/velodyne.drawio.png) | ![Hesai Azimuth Coordinate](./image/hesai.drawio.png) |
59+
| :---------------------------------------------------------: | :---------------------------------------------------: |
60+
| **Velodyne azimuth coordinate** | **Hesai azimuth coordinate** |
6861

6962
## References/External links
7063

system/autoware_default_adapi/src/utils/route_conversion.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -115,13 +115,13 @@ ExternalState convert_state(const InternalState & internal)
115115
const auto convert = [](InternalState::_state_type state) {
116116
switch(state) {
117117
// TODO(Takagi, Isamu): Add adapi state.
118-
case InternalState::INITIALIZING: return ExternalState::UNSET;
118+
case InternalState::INITIALIZING: return ExternalState::UNSET; // NOLINT
119119
case InternalState::UNSET: return ExternalState::UNSET;
120120
case InternalState::ROUTING: return ExternalState::UNSET;
121121
case InternalState::SET: return ExternalState::SET;
122122
case InternalState::REROUTING: return ExternalState::CHANGING;
123123
case InternalState::ARRIVED: return ExternalState::ARRIVED;
124-
case InternalState::ABORTED: return ExternalState::SET;
124+
case InternalState::ABORTED: return ExternalState::SET; // NOLINT
125125
case InternalState::INTERRUPTED: return ExternalState::SET;
126126
default: return ExternalState::UNKNOWN;
127127
}

system/diagnostic_graph_aggregator/test/src/test2.cpp

-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ using namespace diagnostic_graph_aggregator; // NOLINT(build/namespaces)
2929

3030
using diagnostic_msgs::msg::DiagnosticArray;
3131
using diagnostic_msgs::msg::DiagnosticStatus;
32-
using tier4_system_msgs::msg::DiagnosticGraph;
3332

3433
constexpr auto OK = DiagnosticStatus::OK;
3534
constexpr auto WARN = DiagnosticStatus::WARN;

0 commit comments

Comments
 (0)