Skip to content

Commit 3c37332

Browse files
authored
Merge branch 'main' into chore/object_recognition_utils_maintainer
2 parents 9801d93 + e54c4e2 commit 3c37332

File tree

1,014 files changed

+15400
-5008
lines changed

Some content is hidden

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

1,014 files changed

+15400
-5008
lines changed

.cppcheck_suppressions

-4
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,9 @@
22

33
checkersReport
44
constParameterReference
5-
constVariableReference
6-
// cspell: ignore cstyle
7-
cstyleCast
85
funcArgNamesDifferent
96
functionConst
107
functionStatic
11-
invalidPointerCast
128
knownConditionTrueFalse
139
missingInclude
1410
missingIncludeSystem

.github/CODEOWNERS

+41-40
Large diffs are not rendered by default.

.github/workflows/build-and-test-differential.yaml

+8
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,14 @@ jobs:
7070
restore-keys: |
7171
ccache-main-${{ runner.arch }}-${{ matrix.rosdistro }}-
7272
73+
# Limit ccache size only for CUDA builds to avoid running out of disk space
74+
- name: Limit ccache size
75+
if: ${{ matrix.container-suffix == '-cuda' }}
76+
run: |
77+
rm -f "${CCACHE_DIR}/ccache.conf"
78+
echo -e "# Set maximum cache size\nmax_size = 1MB" >> "${CCACHE_DIR}/ccache.conf"
79+
shell: bash
80+
7381
- name: Show ccache stats before build
7482
run: du -sh ${CCACHE_DIR} && ccache -s
7583
shell: bash

.github/workflows/cppcheck-differential.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ jobs:
5858
run: |
5959
filtered_paths=""
6060
for dir in ${{ steps.get-full-paths.outputs.full-paths }}; do
61-
if [ -d "$dir" ] && find "$dir" -name "*.cpp" -o -name "*.hpp" | grep -q .; then
61+
if [ -d "$dir" ] && find "$dir" -name "*.cpp" | grep -q .; then
6262
filtered_paths="$filtered_paths $dir"
6363
fi
6464
done

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

+33-16
Original file line numberDiff line numberDiff line change
@@ -991,34 +991,51 @@ calcCurvature<std::vector<autoware_planning_msgs::msg::TrajectoryPoint>>(
991991
* curvature calculation
992992
*/
993993
template <class T>
994-
std::vector<std::pair<double, double>> calcCurvatureAndArcLength(const T & points)
994+
std::vector<std::pair<double, std::pair<double, double>>> calcCurvatureAndSegmentLength(
995+
const T & points)
995996
{
996-
// Note that arclength is for the segment, not the sum.
997-
std::vector<std::pair<double, double>> curvature_arc_length_vec;
998-
curvature_arc_length_vec.emplace_back(0.0, 0.0);
997+
// segment length is pair of segment length between {p1, p2} and {p2, p3}
998+
std::vector<std::pair<double, std::pair<double, double>>> curvature_and_segment_length_vec;
999+
curvature_and_segment_length_vec.reserve(points.size());
1000+
curvature_and_segment_length_vec.emplace_back(0.0, std::make_pair(0.0, 0.0));
9991001
for (size_t i = 1; i < points.size() - 1; ++i) {
10001002
const auto p1 = autoware::universe_utils::getPoint(points.at(i - 1));
10011003
const auto p2 = autoware::universe_utils::getPoint(points.at(i));
10021004
const auto p3 = autoware::universe_utils::getPoint(points.at(i + 1));
10031005
const double curvature = autoware::universe_utils::calcCurvature(p1, p2, p3);
1004-
const double arc_length =
1005-
autoware::universe_utils::calcDistance2d(points.at(i - 1), points.at(i)) +
1006-
autoware::universe_utils::calcDistance2d(points.at(i), points.at(i + 1));
1007-
curvature_arc_length_vec.emplace_back(curvature, arc_length);
1006+
1007+
// The first point has only the next point, so put the distance to that point.
1008+
// In other words, assign the first segment length at the second point to the
1009+
// second_segment_length at the first point.
1010+
if (i == 1) {
1011+
curvature_and_segment_length_vec.at(0).second.second =
1012+
autoware::universe_utils::calcDistance2d(p1, p2);
1013+
}
1014+
1015+
// The second_segment_length of the previous point and the first segment length of the current
1016+
// point are equal.
1017+
const std::pair<double, double> arc_length{
1018+
curvature_and_segment_length_vec.back().second.second,
1019+
autoware::universe_utils::calcDistance2d(p2, p3)};
1020+
1021+
curvature_and_segment_length_vec.emplace_back(curvature, arc_length);
10081022
}
1009-
curvature_arc_length_vec.emplace_back(0.0, 0.0);
10101023

1011-
return curvature_arc_length_vec;
1024+
// set to the last point
1025+
curvature_and_segment_length_vec.emplace_back(
1026+
0.0, std::make_pair(curvature_and_segment_length_vec.back().second.second, 0.0));
1027+
1028+
return curvature_and_segment_length_vec;
10121029
}
10131030

1014-
extern template std::vector<std::pair<double, double>>
1015-
calcCurvatureAndArcLength<std::vector<autoware_planning_msgs::msg::PathPoint>>(
1031+
extern template std::vector<std::pair<double, std::pair<double, double>>>
1032+
calcCurvatureAndSegmentLength<std::vector<autoware_planning_msgs::msg::PathPoint>>(
10161033
const std::vector<autoware_planning_msgs::msg::PathPoint> & points);
1017-
extern template std::vector<std::pair<double, double>>
1018-
calcCurvatureAndArcLength<std::vector<tier4_planning_msgs::msg::PathPointWithLaneId>>(
1034+
extern template std::vector<std::pair<double, std::pair<double, double>>>
1035+
calcCurvatureAndSegmentLength<std::vector<tier4_planning_msgs::msg::PathPointWithLaneId>>(
10191036
const std::vector<tier4_planning_msgs::msg::PathPointWithLaneId> & points);
1020-
extern template std::vector<std::pair<double, double>>
1021-
calcCurvatureAndArcLength<std::vector<autoware_planning_msgs::msg::TrajectoryPoint>>(
1037+
extern template std::vector<std::pair<double, std::pair<double, double>>>
1038+
calcCurvatureAndSegmentLength<std::vector<autoware_planning_msgs::msg::TrajectoryPoint>>(
10221039
const std::vector<autoware_planning_msgs::msg::TrajectoryPoint> & points);
10231040

10241041
/**

common/autoware_motion_utils/src/trajectory/trajectory.cpp

+6-6
Original file line numberDiff line numberDiff line change
@@ -238,14 +238,14 @@ calcCurvature<std::vector<autoware_planning_msgs::msg::TrajectoryPoint>>(
238238
const std::vector<autoware_planning_msgs::msg::TrajectoryPoint> & points);
239239

240240
//
241-
template std::vector<std::pair<double, double>>
242-
calcCurvatureAndArcLength<std::vector<autoware_planning_msgs::msg::PathPoint>>(
241+
template std::vector<std::pair<double, std::pair<double, double>>>
242+
calcCurvatureAndSegmentLength<std::vector<autoware_planning_msgs::msg::PathPoint>>(
243243
const std::vector<autoware_planning_msgs::msg::PathPoint> & points);
244-
template std::vector<std::pair<double, double>>
245-
calcCurvatureAndArcLength<std::vector<tier4_planning_msgs::msg::PathPointWithLaneId>>(
244+
template std::vector<std::pair<double, std::pair<double, double>>>
245+
calcCurvatureAndSegmentLength<std::vector<tier4_planning_msgs::msg::PathPointWithLaneId>>(
246246
const std::vector<tier4_planning_msgs::msg::PathPointWithLaneId> & points);
247-
template std::vector<std::pair<double, double>>
248-
calcCurvatureAndArcLength<std::vector<autoware_planning_msgs::msg::TrajectoryPoint>>(
247+
template std::vector<std::pair<double, std::pair<double, double>>>
248+
calcCurvatureAndSegmentLength<std::vector<autoware_planning_msgs::msg::TrajectoryPoint>>(
249249
const std::vector<autoware_planning_msgs::msg::TrajectoryPoint> & points);
250250

251251
//

common/autoware_overlay_rviz_plugin/autoware_overlay_rviz_plugin/include/signal_display.hpp

+2-3
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,7 @@ private Q_SLOTS:
103103
turn_signals_sub_;
104104
rclcpp::Subscription<autoware_vehicle_msgs::msg::HazardLightsReport>::SharedPtr
105105
hazard_lights_sub_;
106-
rclcpp::Subscription<autoware_perception_msgs::msg::TrafficLightGroupArray>::SharedPtr
107-
traffic_sub_;
106+
rclcpp::Subscription<autoware_perception_msgs::msg::TrafficLightGroup>::SharedPtr traffic_sub_;
108107
rclcpp::Subscription<tier4_planning_msgs::msg::VelocityLimit>::SharedPtr speed_limit_sub_;
109108

110109
std::mutex property_mutex_;
@@ -118,7 +117,7 @@ private Q_SLOTS:
118117
const autoware_vehicle_msgs::msg::HazardLightsReport::ConstSharedPtr & msg);
119118
void updateSpeedLimitData(const tier4_planning_msgs::msg::VelocityLimit::ConstSharedPtr msg);
120119
void updateTrafficLightData(
121-
const autoware_perception_msgs::msg::TrafficLightGroupArray::ConstSharedPtr msg);
120+
const autoware_perception_msgs::msg::TrafficLightGroup::ConstSharedPtr msg);
122121
void drawWidget(QImage & hud);
123122
};
124123
} // namespace autoware_overlay_rviz_plugin

common/autoware_overlay_rviz_plugin/autoware_overlay_rviz_plugin/include/traffic_display.hpp

+2-3
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525

2626
#include <autoware_perception_msgs/msg/traffic_light_element.hpp>
2727
#include <autoware_perception_msgs/msg/traffic_light_group.hpp>
28-
#include <autoware_perception_msgs/msg/traffic_light_group_array.hpp>
2928

3029
#include <OgreColourValue.h>
3130
#include <OgreMaterial.h>
@@ -40,8 +39,8 @@ class TrafficDisplay
4039
TrafficDisplay();
4140
void drawTrafficLightIndicator(QPainter & painter, const QRectF & backgroundRect);
4241
void updateTrafficLightData(
43-
const autoware_perception_msgs::msg::TrafficLightGroupArray::ConstSharedPtr & msg);
44-
autoware_perception_msgs::msg::TrafficLightGroupArray current_traffic_;
42+
const autoware_perception_msgs::msg::TrafficLightGroup::ConstSharedPtr & msg);
43+
autoware_perception_msgs::msg::TrafficLightGroup current_traffic_;
4544

4645
private:
4746
QImage traffic_light_image_;

common/autoware_overlay_rviz_plugin/autoware_overlay_rviz_plugin/src/signal_display.cpp

+12-12
Original file line numberDiff line numberDiff line change
@@ -112,9 +112,10 @@ void SignalDisplay::onInitialize()
112112
speed_limit_topic_property_->initialize(rviz_ros_node);
113113

114114
traffic_topic_property_ = std::make_unique<rviz_common::properties::RosTopicProperty>(
115-
"Traffic Topic", "/perception/traffic_light_recognition/traffic_signals",
116-
"autoware_perception_msgs/msgs/msg/TrafficLightGroupArray", "Topic for Traffic Light Data",
117-
this, SLOT(topic_updated_traffic()));
115+
"Traffic Topic",
116+
"/planning/scenario_planning/lane_driving/behavior_planning/debug/traffic_signal",
117+
"autoware_perception_msgs/msgs/msg/TrafficLightGroup", "Topic for Traffic Light Data", this,
118+
SLOT(topic_updated_traffic()));
118119
traffic_topic_property_->initialize(rviz_ros_node);
119120
}
120121

@@ -192,7 +193,7 @@ void SignalDisplay::onDisable()
192193
}
193194

194195
void SignalDisplay::updateTrafficLightData(
195-
const autoware_perception_msgs::msg::TrafficLightGroupArray::ConstSharedPtr msg)
196+
const autoware_perception_msgs::msg::TrafficLightGroup::ConstSharedPtr msg)
196197
{
197198
std::lock_guard<std::mutex> lock(property_mutex_);
198199

@@ -458,14 +459,13 @@ void SignalDisplay::topic_updated_traffic()
458459
// resubscribe to the topic
459460
traffic_sub_.reset();
460461
auto rviz_ros_node = context_->getRosNodeAbstraction().lock();
461-
traffic_sub_ =
462-
rviz_ros_node->get_raw_node()
463-
->create_subscription<autoware_perception_msgs::msg::TrafficLightGroupArray>(
464-
traffic_topic_property_->getTopicStd(),
465-
rclcpp::QoS(rclcpp::KeepLast(10)).durability_volatile().reliable(),
466-
[this](const autoware_perception_msgs::msg::TrafficLightGroupArray::SharedPtr msg) {
467-
updateTrafficLightData(msg);
468-
});
462+
traffic_sub_ = rviz_ros_node->get_raw_node()
463+
->create_subscription<autoware_perception_msgs::msg::TrafficLightGroup>(
464+
traffic_topic_property_->getTopicStd(),
465+
rclcpp::QoS(rclcpp::KeepLast(10)).durability_volatile().reliable(),
466+
[this](const autoware_perception_msgs::msg::TrafficLightGroup::SharedPtr msg) {
467+
updateTrafficLightData(msg);
468+
});
469469
}
470470

471471
} // namespace autoware_overlay_rviz_plugin

common/autoware_overlay_rviz_plugin/autoware_overlay_rviz_plugin/src/traffic_display.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ TrafficDisplay::TrafficDisplay()
4848
}
4949

5050
void TrafficDisplay::updateTrafficLightData(
51-
const autoware_perception_msgs::msg::TrafficLightGroupArray::ConstSharedPtr & msg)
51+
const autoware_perception_msgs::msg::TrafficLightGroup::ConstSharedPtr & msg)
5252
{
5353
current_traffic_ = *msg;
5454
}
@@ -68,8 +68,8 @@ void TrafficDisplay::drawTrafficLightIndicator(QPainter & painter, const QRectF
6868
backgroundRect.top() + circleRect.height() / 2));
6969
painter.drawEllipse(circleRect);
7070

71-
if (!current_traffic_.traffic_light_groups.empty()) {
72-
switch (current_traffic_.traffic_light_groups[0].elements[0].color) {
71+
if (!current_traffic_.elements.empty()) {
72+
switch (current_traffic_.elements[0].color) {
7373
case 1:
7474
painter.setBrush(QBrush(tl_red_));
7575
painter.drawEllipse(circleRect);

common/autoware_point_types/include/autoware_point_types/types.hpp

+90-1
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,23 @@ enum ReturnType : uint8_t {
5454
DUAL_ONLY,
5555
};
5656

57+
struct PointXYZIRC
58+
{
59+
float x{0.0F};
60+
float y{0.0F};
61+
float z{0.0F};
62+
std::uint8_t intensity{0U};
63+
std::uint8_t return_type{0U};
64+
std::uint16_t channel{0U};
65+
66+
friend bool operator==(const PointXYZIRC & p1, const PointXYZIRC & p2) noexcept
67+
{
68+
return float_eq<float>(p1.x, p2.x) && float_eq<float>(p1.y, p2.y) &&
69+
float_eq<float>(p1.z, p2.z) && p1.intensity == p2.intensity &&
70+
p1.return_type == p2.return_type && p1.channel == p2.channel;
71+
}
72+
};
73+
5774
struct PointXYZIRADRT
5875
{
5976
float x{0.0F};
@@ -75,25 +92,97 @@ struct PointXYZIRADRT
7592
}
7693
};
7794

78-
enum class PointIndex { X, Y, Z, Intensity, Ring, Azimuth, Distance, ReturnType, TimeStamp };
95+
struct PointXYZIRCAEDT
96+
{
97+
float x{0.0F};
98+
float y{0.0F};
99+
float z{0.0F};
100+
std::uint8_t intensity{0U};
101+
std::uint8_t return_type{0U};
102+
std::uint16_t channel{0U};
103+
float azimuth{0.0F};
104+
float elevation{0.0F};
105+
float distance{0.0F};
106+
std::uint32_t time_stamp{0U};
107+
108+
friend bool operator==(const PointXYZIRCAEDT & p1, const PointXYZIRCAEDT & p2) noexcept
109+
{
110+
return float_eq<float>(p1.x, p2.x) && float_eq<float>(p1.y, p2.y) &&
111+
float_eq<float>(p1.z, p2.z) && p1.intensity == p2.intensity &&
112+
p1.return_type == p2.return_type && p1.channel == p2.channel &&
113+
float_eq<float>(p1.azimuth, p2.azimuth) && float_eq<float>(p1.distance, p2.distance) &&
114+
p1.time_stamp == p2.time_stamp;
115+
}
116+
};
117+
118+
enum class PointXYZIIndex { X, Y, Z, Intensity };
119+
enum class PointXYZIRCIndex { X, Y, Z, Intensity, ReturnType, Channel };
120+
enum class PointXYZIRADRTIndex {
121+
X,
122+
Y,
123+
Z,
124+
Intensity,
125+
Ring,
126+
Azimuth,
127+
Distance,
128+
ReturnType,
129+
TimeStamp
130+
};
131+
enum class PointXYZIRCAEDTIndex {
132+
X,
133+
Y,
134+
Z,
135+
Intensity,
136+
ReturnType,
137+
Channel,
138+
Azimuth,
139+
Elevation,
140+
Distance,
141+
TimeStamp
142+
};
79143

80144
LIDAR_UTILS__DEFINE_FIELD_GENERATOR_FOR_MEMBER(azimuth);
145+
LIDAR_UTILS__DEFINE_FIELD_GENERATOR_FOR_MEMBER(elevation);
81146
LIDAR_UTILS__DEFINE_FIELD_GENERATOR_FOR_MEMBER(distance);
82147
LIDAR_UTILS__DEFINE_FIELD_GENERATOR_FOR_MEMBER(return_type);
83148
LIDAR_UTILS__DEFINE_FIELD_GENERATOR_FOR_MEMBER(time_stamp);
84149

150+
LIDAR_UTILS__DEFINE_FIELD_GENERATOR_FOR_MEMBER(channel);
151+
152+
using PointXYZIRCGenerator = std::tuple<
153+
point_cloud_msg_wrapper::field_x_generator, point_cloud_msg_wrapper::field_y_generator,
154+
point_cloud_msg_wrapper::field_z_generator, point_cloud_msg_wrapper::field_intensity_generator,
155+
field_return_type_generator, field_channel_generator>;
156+
85157
using PointXYZIRADRTGenerator = std::tuple<
86158
point_cloud_msg_wrapper::field_x_generator, point_cloud_msg_wrapper::field_y_generator,
87159
point_cloud_msg_wrapper::field_z_generator, point_cloud_msg_wrapper::field_intensity_generator,
88160
point_cloud_msg_wrapper::field_ring_generator, field_azimuth_generator, field_distance_generator,
89161
field_return_type_generator, field_time_stamp_generator>;
90162

163+
using PointXYZIRCAEDTGenerator = std::tuple<
164+
point_cloud_msg_wrapper::field_x_generator, point_cloud_msg_wrapper::field_y_generator,
165+
point_cloud_msg_wrapper::field_z_generator, point_cloud_msg_wrapper::field_intensity_generator,
166+
field_return_type_generator, field_channel_generator, field_azimuth_generator,
167+
field_elevation_generator, field_distance_generator, field_time_stamp_generator>;
168+
91169
} // namespace autoware_point_types
92170

171+
POINT_CLOUD_REGISTER_POINT_STRUCT(
172+
autoware_point_types::PointXYZIRC,
173+
(float, x, x)(float, y, y)(float, z, z)(std::uint8_t, intensity, intensity)(
174+
std::uint8_t, return_type, return_type)(std::uint16_t, channel, channel))
175+
93176
POINT_CLOUD_REGISTER_POINT_STRUCT(
94177
autoware_point_types::PointXYZIRADRT,
95178
(float, x, x)(float, y, y)(float, z, z)(float, intensity, intensity)(std::uint16_t, ring, ring)(
96179
float, azimuth, azimuth)(float, distance, distance)(std::uint8_t, return_type, return_type)(
97180
double, time_stamp, time_stamp))
98181

182+
POINT_CLOUD_REGISTER_POINT_STRUCT(
183+
autoware_point_types::PointXYZIRCAEDT,
184+
(float, x, x)(float, y, y)(float, z, z)(std::uint8_t, intensity, intensity)(
185+
std::uint8_t, return_type,
186+
return_type)(std::uint16_t, channel, channel)(float, azimuth, azimuth)(
187+
float, elevation, elevation)(float, distance, distance)(std::uint32_t, time_stamp, time_stamp))
99188
#endif // AUTOWARE_POINT_TYPES__TYPES_HPP_

common/autoware_point_types/test/test_point_types.cpp

+9
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,15 @@ TEST(PointEquality, PointXYZIRADRT)
3636
EXPECT_EQ(pt0, pt1);
3737
}
3838

39+
TEST(PointEquality, PointXYZIRCAEDT)
40+
{
41+
using autoware_point_types::PointXYZIRCAEDT;
42+
43+
PointXYZIRCAEDT pt0{0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
44+
PointXYZIRCAEDT pt1{0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
45+
EXPECT_EQ(pt0, pt1);
46+
}
47+
3948
TEST(PointEquality, FloatEq)
4049
{
4150
// test template

common/autoware_universe_utils/CMakeLists.txt

+2
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ ament_auto_add_library(autoware_universe_utils SHARED
1414
src/geometry/geometry.cpp
1515
src/geometry/pose_deviation.cpp
1616
src/geometry/boost_polygon_utils.cpp
17+
src/geometry/random_convex_polygon.cpp
18+
src/geometry/gjk_2d.cpp
1719
src/math/sin_table.cpp
1820
src/math/trigonometry.cpp
1921
src/ros/msg_operation.cpp

0 commit comments

Comments
 (0)