Skip to content

Commit 64a9b04

Browse files
authored
Merge branch 'main' into add-gtest-to-tensorrt-common
2 parents fe616bd + c4b72eb commit 64a9b04

File tree

844 files changed

+42983
-15642
lines changed

Some content is hidden

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

844 files changed

+42983
-15642
lines changed

.cspell-partial.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@
55
"perception/bytetrack/lib/**"
66
],
77
"ignoreRegExpList": [],
8-
"words": []
8+
"words": ["dltype", "tvmgen", "quantizer", "imageio", "mimsave"]
99
}

.github/CODEOWNERS

+34-26
Large diffs are not rendered by default.

.github/dependabot.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@ updates:
66
interval: daily
77
open-pull-requests-limit: 1
88
labels:
9-
- bot
10-
- github-actions
9+
- tag:bot
10+
- type:github-actions

.github/labeler.yaml

+15-15
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,41 @@
1-
ci:
1+
"type:ci":
22
- .github/**/*
33
- "*.json"
44
- "*.yaml"
55
- "*.cfg"
66
- .clang-format
77
- .gitignore
88
- .prettierignore
9-
documentation:
9+
"type:documentation":
1010
- docs/**/*
1111
- "**/*.md"
1212
- "**/*.rst"
1313
- "**/*.jpg"
1414
- "**/*.png"
1515
- "**/*.svg"
16-
common:
16+
"component:common":
1717
- common/**/*
18-
control:
18+
"component:control":
1919
- control/**/*
20-
evaluator:
20+
"component:evaluator":
2121
- evaluator/**/*
22-
launch:
22+
"component:launch":
2323
- launch/**/*
24-
localization:
24+
"component:localization":
2525
- localization/**/*
26-
map:
26+
"component:map":
2727
- map/**/*
28-
perception:
28+
"component:perception":
2929
- perception/**/*
30-
planning:
30+
"component:planning":
3131
- planning/**/*
32-
sensing:
32+
"component:sensing":
3333
- sensing/**/*
34-
simulator:
34+
"component:simulation":
3535
- simulator/**/*
36-
system:
36+
"component:system":
3737
- system/**/*
38-
tools:
38+
"component:tools":
3939
- tools/**/*
40-
vehicle:
40+
"component:vehicle":
4141
- vehicle/**/*

.github/stale.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
daysUntilClose: false
55

66
# Label to use when marking as stale
7-
staleLabel: stale
7+
staleLabel: status:stale
88

99
# Comment to post when marking as stale
1010
markComment: >

.github/sync-files.yaml

+4-14
Original file line numberDiff line numberDiff line change
@@ -42,20 +42,6 @@
4242
- \"\"
4343
- -cuda
4444
include:" {source}
45-
- source: .github/workflows/build-and-test-differential.yaml
46-
pre-commands: |
47-
sd "container: ros:(\w+)" "container: ghcr.io/autowarefoundation/autoware-universe:\$1-latest" {source}
48-
49-
sd -s 'container: ${{ matrix.container }}' 'container: ${{ matrix.container }}${{ matrix.container-suffix }}' {source}
50-
sd -- \
51-
" include:" \
52-
" container-suffix:
53-
- \"\"
54-
- -cuda
55-
include:" {source}
56-
57-
sd "^ container: ghcr.io/autowarefoundation/autoware-universe:(\w+)-latest\$" \
58-
" container: ghcr.io/autowarefoundation/autoware-universe:\$1-latest-cuda" {source}
5945
- source: .github/workflows/build-and-test-differential-self-hosted.yaml
6046
pre-commands: |
6147
sd "container: ros:(\w+)" "container: ghcr.io/autowarefoundation/autoware-universe:\$1-latest" {source}
@@ -98,4 +84,8 @@
9884
sd "/edit/main/docs/" "/edit/main/" {source}
9985
sd "docs_dir: .*" "docs_dir: ." {source}
10086
sd "assets/(\w+)" "docs/assets/\$1" {source}
87+
sd -- \
88+
" - macros" \
89+
" - macros:
90+
module_name: mkdocs_macros" {source}
10191
- source: docs/assets/js/mathjax.js

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
prevent-no-label-execution:
1212
uses: autowarefoundation/autoware-github-actions/.github/workflows/prevent-no-label-execution.yaml@v1
1313
with:
14-
label: run-build-and-test-differential
14+
label: tag:run-build-and-test-differential
1515

1616
build-and-test-differential:
1717
needs: prevent-no-label-execution

.github/workflows/deploy-docs.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
prevent-no-label-execution:
2323
uses: autowarefoundation/autoware-github-actions/.github/workflows/prevent-no-label-execution.yaml@v1
2424
with:
25-
label: deploy-docs
25+
label: tag:deploy-docs
2626

2727
deploy-docs:
2828
needs: prevent-no-label-execution

.github/workflows/openai-pr-reviewer.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
prevent-no-label-execution:
2222
uses: autowarefoundation/autoware-github-actions/.github/workflows/prevent-no-label-execution.yaml@v1
2323
with:
24-
label: openai-pr-reviewer
24+
label: tag:openai-pr-reviewer
2525
review:
2626
needs: prevent-no-label-execution
2727
if: ${{ needs.prevent-no-label-execution.outputs.run == 'true' }}

.github/workflows/sync-files.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,6 @@ jobs:
2828
with:
2929
token: ${{ steps.generate-token.outputs.token }}
3030
pr-labels: |
31-
bot
32-
sync-files
31+
tag:bot
32+
tag:sync-files
3333
auto-merge-method: squash

.github/workflows/update-codeowners-from-packages.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,6 @@ jobs:
2828
with:
2929
token: ${{ steps.generate-token.outputs.token }}
3030
pr-labels: |
31-
bot
32-
update-codeowners-from-packages
31+
tag:bot
32+
tag:update-codeowners-from-packages
3333
auto-merge-method: squash

common/autoware_auto_perception_rviz_plugin/include/object_detection/predicted_objects_display.hpp

+33
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,11 @@
2424

2525
#include <condition_variable>
2626
#include <list>
27+
#include <queue>
2728
#include <set>
2829
#include <string>
2930
#include <unordered_map>
31+
#include <utility>
3032
#include <vector>
3133

3234
namespace autoware
@@ -45,10 +47,31 @@ class AUTOWARE_AUTO_PERCEPTION_RVIZ_PLUGIN_PUBLIC PredictedObjectsDisplay
4547
using PredictedObjects = autoware_auto_perception_msgs::msg::PredictedObjects;
4648

4749
PredictedObjectsDisplay();
50+
~PredictedObjectsDisplay()
51+
{
52+
{
53+
std::unique_lock<std::mutex> lock(queue_mutex);
54+
should_terminate = true;
55+
}
56+
condition.notify_all();
57+
for (std::thread & active_thread : threads) {
58+
active_thread.join();
59+
}
60+
threads.clear();
61+
}
4862

4963
private:
5064
void processMessage(PredictedObjects::ConstSharedPtr msg) override;
5165

66+
void queueJob(std::function<void()> job)
67+
{
68+
{
69+
std::unique_lock<std::mutex> lock(queue_mutex);
70+
jobs.push(std::move(job));
71+
}
72+
condition.notify_one();
73+
}
74+
5275
boost::uuids::uuid to_boost_uuid(const unique_identifier_msgs::msg::UUID & uuid_msg)
5376
{
5477
const std::string uuid_str = uuid_to_string(uuid_msg);
@@ -100,6 +123,8 @@ class AUTOWARE_AUTO_PERCEPTION_RVIZ_PLUGIN_PUBLIC PredictedObjectsDisplay
100123
PredictedObjects::ConstSharedPtr msg);
101124
void workerThread();
102125

126+
void messageProcessorThreadJob();
127+
103128
void update(float wall_dt, float ros_dt) override;
104129

105130
std::unordered_map<boost::uuids::uuid, int32_t, boost::hash<boost::uuids::uuid>> id_map;
@@ -108,6 +133,14 @@ class AUTOWARE_AUTO_PERCEPTION_RVIZ_PLUGIN_PUBLIC PredictedObjectsDisplay
108133
int32_t marker_id = 0;
109134
const int32_t PATH_ID_CONSTANT = 1e3;
110135

136+
// max_num_threads: number of threads created in the thread pool, hard-coded to be 1;
137+
int max_num_threads;
138+
139+
bool should_terminate{false};
140+
std::mutex queue_mutex;
141+
std::vector<std::thread> threads;
142+
std::queue<std::function<void()>> jobs;
143+
111144
PredictedObjects::ConstSharedPtr msg;
112145
bool consumed{false};
113146
std::mutex mutex;

common/autoware_auto_perception_rviz_plugin/src/object_detection/predicted_objects_display.cpp

+31-14
Original file line numberDiff line numberDiff line change
@@ -25,27 +25,44 @@ namespace object_detection
2525
{
2626
PredictedObjectsDisplay::PredictedObjectsDisplay() : ObjectPolygonDisplayBase("tracks")
2727
{
28-
std::thread worker(&PredictedObjectsDisplay::workerThread, this);
29-
worker.detach();
28+
max_num_threads = 1; // hard code the number of threads to be created
29+
30+
for (int ii = 0; ii < max_num_threads; ++ii) {
31+
threads.emplace_back(std::thread(&PredictedObjectsDisplay::workerThread, this));
32+
}
3033
}
3134

3235
void PredictedObjectsDisplay::workerThread()
33-
{
36+
{ // A standard working thread that waiting for jobs
3437
while (true) {
35-
std::unique_lock<std::mutex> lock(mutex);
36-
condition.wait(lock, [this] { return this->msg; });
38+
std::function<void()> job;
39+
{
40+
std::unique_lock<std::mutex> lock(queue_mutex);
41+
condition.wait(lock, [this] { return !jobs.empty() || should_terminate; });
42+
if (should_terminate) {
43+
return;
44+
}
45+
job = jobs.front();
46+
jobs.pop();
47+
}
48+
job();
49+
}
50+
}
3751

38-
auto tmp_msg = this->msg;
39-
this->msg.reset();
52+
void PredictedObjectsDisplay::messageProcessorThreadJob()
53+
{
54+
// Receiving
55+
std::unique_lock<std::mutex> lock(mutex);
56+
auto tmp_msg = this->msg;
57+
this->msg.reset();
58+
lock.unlock();
4059

41-
lock.unlock();
60+
auto tmp_markers = createMarkers(tmp_msg);
4261

43-
auto tmp_markers = createMarkers(tmp_msg);
44-
lock.lock();
45-
markers = tmp_markers;
62+
lock.lock();
63+
markers = tmp_markers;
4664

47-
consumed = true;
48-
}
65+
consumed = true;
4966
}
5067

5168
std::vector<visualization_msgs::msg::Marker::SharedPtr> PredictedObjectsDisplay::createMarkers(
@@ -188,7 +205,7 @@ void PredictedObjectsDisplay::processMessage(PredictedObjects::ConstSharedPtr ms
188205
std::unique_lock<std::mutex> lock(mutex);
189206

190207
this->msg = msg;
191-
condition.notify_one();
208+
queueJob(std::bind(&PredictedObjectsDisplay::messageProcessorThreadJob, this));
192209
}
193210

194211
void PredictedObjectsDisplay::update(float wall_dt, float ros_dt)

common/component_interface_specs/CMakeLists.txt

+34
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,38 @@ project(component_interface_specs)
44
find_package(autoware_cmake REQUIRED)
55
autoware_package()
66

7+
include_directories(
8+
include
9+
SYSTEM
10+
${rclcpp_INCLUDE_DIRS}
11+
${rosidl_runtime_cpp_INCLUDE_DIRS}
12+
${rcl_INCLUDE_DIRS}
13+
${autoware_adapi_v1_msgs_INCLUDE_DIRS}
14+
${autoware_auto_planning_msgs_INCLUDE_DIRS}
15+
${autoware_planning_msgs_INCLUDE_DIRS}
16+
${autoware_auto_vehicle_msgs_INCLUDE_DIRS}
17+
${tier4_control_msgs_INCLUDE_DIRS}
18+
${nav_msgs_INCLUDE_DIRS}
19+
${tier4_system_msgs_INCLUDE_DIRS}
20+
${tier4_vehicle_msgs_INCLUDE_DIRS}
21+
${autoware_auto_perception_msgs_INCLUDE_DIRS}
22+
${tier4_map_msgs_INCLUDE_DIRS}
23+
)
24+
25+
if(BUILD_TESTING)
26+
ament_add_ros_isolated_gtest(test_component_interface_specs
27+
test/gtest_main.cpp
28+
test/test_planning.cpp
29+
test/test_control.cpp
30+
test/test_localization.cpp
31+
test/test_system.cpp
32+
test/test_map.cpp
33+
test/test_perception.cpp
34+
test/test_vehicle.cpp
35+
)
36+
target_include_directories(test_component_interface_specs
37+
PRIVATE include
38+
)
39+
endif()
40+
741
ament_auto_package()

common/component_interface_specs/package.xml

+16-1
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,28 @@
1111
<license>Apache License 2.0</license>
1212

1313
<buildtool_depend>ament_cmake_auto</buildtool_depend>
14+
<buildtool_depend>ament_cmake_core</buildtool_depend>
15+
<buildtool_depend>ament_cmake_export_dependencies</buildtool_depend>
16+
<buildtool_depend>ament_cmake_test</buildtool_depend>
1417
<buildtool_depend>autoware_cmake</buildtool_depend>
1518

19+
<buildtool_export_depend>ament_cmake_core</buildtool_export_depend>
20+
<buildtool_export_depend>ament_cmake_test</buildtool_export_depend>
21+
1622
<depend>autoware_adapi_v1_msgs</depend>
23+
<depend>autoware_auto_perception_msgs</depend>
24+
<depend>autoware_auto_planning_msgs</depend>
1725
<depend>autoware_auto_vehicle_msgs</depend>
26+
<depend>autoware_planning_msgs</depend>
27+
<depend>nav_msgs</depend>
28+
<depend>rcl</depend>
29+
<depend>rclcpp</depend>
30+
<depend>rosidl_runtime_cpp</depend>
31+
<depend>tier4_control_msgs</depend>
1832
<depend>tier4_map_msgs</depend>
33+
<depend>tier4_system_msgs</depend>
1934
<depend>tier4_vehicle_msgs</depend>
20-
35+
<test_depend>ament_cmake_ros</test_depend>
2136
<test_depend>ament_lint_auto</test_depend>
2237
<test_depend>autoware_lint_common</test_depend>
2338

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// Copyright 2023 The Autoware Contributors
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 "gtest/gtest.h"
16+
17+
int main(int argc, char * argv[])
18+
{
19+
::testing::InitGoogleTest(&argc, argv);
20+
return RUN_ALL_TESTS();
21+
}

0 commit comments

Comments
 (0)