Skip to content

Commit eadd0a5

Browse files
authored
Merge branch 'main' into fix/ignore_spell_check
2 parents c775c9b + d5c7e61 commit eadd0a5

File tree

134 files changed

+5787
-579
lines changed

Some content is hidden

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

134 files changed

+5787
-579
lines changed

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

-36
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ jobs:
2424
rosdistro:
2525
- humble
2626
container-suffix:
27-
- ""
2827
- -cuda
2928
include:
3029
- rosdistro: humble
@@ -74,38 +73,3 @@ jobs:
7473

7574
- name: Check disk space after build
7675
run: df -h
77-
78-
clang-tidy-differential:
79-
runs-on: [self-hosted, linux, X64]
80-
container: ghcr.io/autowarefoundation/autoware-universe:humble-latest-cuda
81-
needs: build-and-test-differential
82-
steps:
83-
- name: Check out repository
84-
uses: actions/checkout@v3
85-
with:
86-
fetch-depth: 0
87-
88-
- name: Remove exec_depend
89-
uses: autowarefoundation/autoware-github-actions/remove-exec-depend@v1
90-
91-
- name: Get modified packages
92-
id: get-modified-packages
93-
uses: autowarefoundation/autoware-github-actions/get-modified-packages@v1
94-
95-
- name: Get modified files
96-
id: get-modified-files
97-
uses: tj-actions/changed-files@v35
98-
with:
99-
files: |
100-
**/*.cpp
101-
**/*.hpp
102-
103-
- name: Run clang-tidy
104-
if: ${{ steps.get-modified-files.outputs.all_changed_files != '' }}
105-
uses: autowarefoundation/autoware-github-actions/clang-tidy@v1
106-
with:
107-
rosdistro: humble
108-
target-packages: ${{ steps.get-modified-packages.outputs.modified-packages }}
109-
target-files: ${{ steps.get-modified-files.outputs.all_changed_files }}
110-
clang-tidy-config-url: https://raw.githubusercontent.com/autowarefoundation/autoware/main/.clang-tidy
111-
build-depends-repos: build_depends.repos

README.md

+13-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,16 @@
1-
# autoware.universe
1+
# Autoware Universe
22

3-
For Autoware's general documentation, see [Autoware Documentation](https://autowarefoundation.github.io/autoware-documentation/).
3+
## Welcome to Autoware Universe
44

5-
For detailed documents of Autoware Universe components, see [Autoware Universe Documentation](https://autowarefoundation.github.io/autoware.universe/).
5+
Autoware Universe serves as a foundational pillar within the Autoware ecosystem, playing a critical role in enhancing the core functionalities of autonomous driving technologies.
6+
This repository is a pivotal element of the Autoware Core/Universe concept, managing a wide array of packages that significantly extend the capabilities of autonomous vehicles.
67

7-
---
8+
![autoware_universe_front](docs/assets/images/autoware_universe_front.png)
9+
10+
## Getting Started
11+
12+
To dive into the vast world of Autoware and understand how Autoware Universe fits into the bigger picture, we recommend starting with the [Autoware Documentation](https://autowarefoundation.github.io/autoware-documentation/). This resource provides a thorough overview of the Autoware ecosystem, guiding you through its components, functionalities, and how to get started with development.
13+
14+
### Explore Autoware Universe documentation
15+
16+
For those looking to explore the specifics of Autoware Universe components, the [Autoware Universe Documentation](https://autowarefoundation.github.io/autoware.universe/), deployed with MKDocs, offers detailed insights.

common/autoware_overlay_rviz_plugin/autoware_overlay_rviz_plugin/package.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
<test_depend>ament_lint_auto</test_depend>
2424
<test_depend>autoware_lint_common</test_depend>
2525

26-
<buildtool_depend>ament_cmake</buildtool_depend>
26+
<buildtool_depend>ament_cmake_auto</buildtool_depend>
2727

2828
<export>
2929
<build_type>ament_cmake</build_type>

common/tensorrt_common/package.xml

-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66

77
<author email="taichi.higashide@tier4.jp">Taichi Higashide</author>
88
<author email="daisuke.nishimatsu@tier4.jp">Daisuke Nishimatsu</author>
9-
<maintainer email="daisuke.nishimatsu@tier4.jp">Daisuke Nishimatsu</maintainer>
109
<maintainer email="dan.umeda@tier4.jp">Dan Umeda</maintainer>
1110
<maintainer email="manato.hirabayashi@tier4.jp">Manato Hirabayashi</maintainer>
1211

common/tier4_autoware_utils/include/tier4_autoware_utils/geometry/boost_geometry.hpp

+2
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
#include <boost/geometry/core/cs.hpp>
1919
#include <boost/geometry/geometries/geometries.hpp>
2020
#include <boost/geometry/geometries/register/point.hpp>
21+
#include <boost/geometry/geometries/register/ring.hpp>
2122

2223
#define EIGEN_MPL2_ONLY
2324
#include <Eigen/Core>
@@ -98,5 +99,6 @@ BOOST_GEOMETRY_REGISTER_POINT_2D( // NOLIN
9899
tier4_autoware_utils::Point2d, double, cs::cartesian, x(), y()) // NOLINT
99100
BOOST_GEOMETRY_REGISTER_POINT_3D( // NOLINT
100101
tier4_autoware_utils::Point3d, double, cs::cartesian, x(), y(), z()) // NOLINT
102+
BOOST_GEOMETRY_REGISTER_RING(tier4_autoware_utils::LinearRing2d) // NOLINT
101103

102104
#endif // TIER4_AUTOWARE_UTILS__GEOMETRY__BOOST_GEOMETRY_HPP_

common/traffic_light_utils/package.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<name>traffic_light_utils</name>
55
<version>0.1.0</version>
66
<description>The traffic_light_utils package</description>
7-
<maintainer email="mingyu.li@tier4.jp">Mingyu Li</maintainer>
7+
<maintainer email="kotaro.uetake@tier4.jp">Kotaro Uetake</maintainer>
88
<maintainer email="shunsuke.miura@tier4.jp">Shunsuke Miura</maintainer>
99
<maintainer email="satoshi.ota@tier4.jp">Satoshi Ota</maintainer>
1010
<license>Apache License 2.0</license>

control/joy_controller/README.md

+15
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,21 @@
44

55
`joy_controller` is the package to convert a joy msg to autoware commands (e.g. steering wheel, shift, turn signal, engage) for a vehicle.
66

7+
## Usage
8+
9+
### ROS 2 launch
10+
11+
```bash
12+
# With default config (ds4)
13+
ros2 launch joy_controller joy_controller.launch.xml
14+
15+
# Default config but select from the existing parameter files
16+
ros2 launch joy_controller joy_controller_param_selection.launch.xml joy_type:=ds4 # or g29, p65, xbox
17+
18+
# Override the param file
19+
ros2 launch joy_controller joy_controller.launch.xml config_file:=/path/to/your/param.yaml
20+
```
21+
722
## Input / Output
823

924
### Input topics

control/joy_controller/config/joy_controller.param.yaml control/joy_controller/config/joy_controller_ds4.param.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**:
22
ros__parameters:
3-
joy_type: $(var joy_type)
3+
joy_type: DS4
44
update_rate: 10.0
55
accel_ratio: 3.0
66
brake_ratio: 5.0
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
/**:
2+
ros__parameters:
3+
joy_type: G29
4+
update_rate: 10.0
5+
accel_ratio: 3.0
6+
brake_ratio: 5.0
7+
steer_ratio: 0.5
8+
steering_angle_velocity: 0.1
9+
accel_sensitivity: 1.0
10+
brake_sensitivity: 1.0
11+
control_command:
12+
raw_control: false
13+
velocity_gain: 3.0
14+
max_forward_velocity: 20.0
15+
max_backward_velocity: 3.0
16+
backward_accel_ratio: 1.0
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
/**:
2+
ros__parameters:
3+
joy_type: P65
4+
update_rate: 10.0
5+
accel_ratio: 3.0
6+
brake_ratio: 5.0
7+
steer_ratio: 0.5
8+
steering_angle_velocity: 0.1
9+
accel_sensitivity: 1.0
10+
brake_sensitivity: 1.0
11+
control_command:
12+
raw_control: false
13+
velocity_gain: 3.0
14+
max_forward_velocity: 20.0
15+
max_backward_velocity: 3.0
16+
backward_accel_ratio: 1.0
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
/**:
2+
ros__parameters:
3+
joy_type: XBOX
4+
update_rate: 10.0
5+
accel_ratio: 3.0
6+
brake_ratio: 5.0
7+
steer_ratio: 0.5
8+
steering_angle_velocity: 0.1
9+
accel_sensitivity: 1.0
10+
brake_sensitivity: 1.0
11+
control_command:
12+
raw_control: false
13+
velocity_gain: 3.0
14+
max_forward_velocity: 20.0
15+
max_backward_velocity: 3.0
16+
backward_accel_ratio: 1.0

control/joy_controller/launch/joy_controller.launch.xml

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
<launch>
2-
<arg name="joy_type" default="DS4" description="options: DS4, G29, P65, XBOX"/>
32
<arg name="external_cmd_source" default="remote" description="options: local, remote"/>
43

54
<arg name="input_joy" default="/joy"/>
@@ -13,7 +12,7 @@
1312
<arg name="output_gate_mode" default="/control/gate_mode_cmd"/>
1413
<arg name="output_vehicle_engage" default="/vehicle/engage"/>
1514

16-
<arg name="config_file" default="$(find-pkg-share joy_controller)/config/joy_controller.param.yaml"/>
15+
<arg name="config_file" default="$(find-pkg-share joy_controller)/config/joy_controller_ds4.param.yaml"/>
1716

1817
<node pkg="joy_controller" exec="joy_controller" name="joy_controller" output="screen">
1918
<remap from="input/joy" to="$(var input_joy)"/>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<launch>
2+
<arg name="joy_type" default="ds4" description="options: ds4, g29, p65, xbox"/>
3+
4+
<include file="$(find-pkg-share joy_controller)/launch/joy_controller.launch.xml">
5+
<arg name="config_file" value="$(find-pkg-share joy_controller)/config/joy_controller_$(var joy_type).param.yaml"/>
6+
</include>
7+
</launch>

control/lane_departure_checker/include/lane_departure_checker/lane_departure_checker.hpp

+20-1
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,20 @@
2929
#include <geometry_msgs/msg/twist_stamped.hpp>
3030
#include <nav_msgs/msg/odometry.hpp>
3131

32+
#include <boost/geometry/algorithms/envelope.hpp>
33+
#include <boost/geometry/algorithms/union.hpp>
3234
#include <boost/geometry/index/rtree.hpp>
33-
#include <boost/optional.hpp>
3435

3536
#include <lanelet2_core/LaneletMap.h>
37+
#include <lanelet2_core/geometry/BoundingBox.h>
38+
#include <lanelet2_core/geometry/LaneletMap.h>
39+
#include <lanelet2_core/geometry/LineString.h>
40+
#include <lanelet2_core/geometry/Polygon.h>
3641

3742
#include <map>
3843
#include <memory>
3944
#include <string>
45+
#include <utility>
4046
#include <vector>
4147

4248
namespace lane_departure_checker
@@ -112,6 +118,19 @@ class LaneDepartureChecker
112118
bool checkPathWillLeaveLane(
113119
const lanelet::ConstLanelets & lanelets, const PathWithLaneId & path) const;
114120

121+
std::vector<std::pair<double, lanelet::Lanelet>> getLaneletsFromPath(
122+
const lanelet::LaneletMapPtr lanelet_map_ptr, const PathWithLaneId & path) const;
123+
124+
std::optional<lanelet::BasicPolygon2d> getFusedLaneletPolygonForPath(
125+
const lanelet::LaneletMapPtr lanelet_map_ptr, const PathWithLaneId & path) const;
126+
127+
bool checkPathWillLeaveLane(
128+
const lanelet::LaneletMapPtr lanelet_map_ptr, const PathWithLaneId & path) const;
129+
130+
PathWithLaneId cropPointsOutsideOfLanes(
131+
const lanelet::LaneletMapPtr lanelet_map_ptr, const PathWithLaneId & path,
132+
const size_t end_index);
133+
115134
static bool isOutOfLane(
116135
const lanelet::ConstLanelets & candidate_lanelets, const LinearRing2d & vehicle_footprint);
117136

control/lane_departure_checker/src/lane_departure_checker_node/lane_departure_checker.cpp

+89
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ using motion_utils::calcArcLength;
3434
using tier4_autoware_utils::LinearRing2d;
3535
using tier4_autoware_utils::LineString2d;
3636
using tier4_autoware_utils::MultiPoint2d;
37+
using tier4_autoware_utils::MultiPolygon2d;
3738
using tier4_autoware_utils::Point2d;
3839

3940
namespace
@@ -92,6 +93,7 @@ lanelet::ConstLanelets getCandidateLanelets(
9293

9394
return candidate_lanelets;
9495
}
96+
9597
} // namespace
9698

9799
namespace lane_departure_checker
@@ -298,6 +300,92 @@ bool LaneDepartureChecker::willLeaveLane(
298300
return false;
299301
}
300302

303+
std::vector<std::pair<double, lanelet::Lanelet>> LaneDepartureChecker::getLaneletsFromPath(
304+
const lanelet::LaneletMapPtr lanelet_map_ptr, const PathWithLaneId & path) const
305+
{
306+
// Get Footprint Hull basic polygon
307+
std::vector<LinearRing2d> vehicle_footprints = createVehicleFootprints(path);
308+
LinearRing2d footprint_hull = createHullFromFootprints(vehicle_footprints);
309+
auto to_basic_polygon = [](const LinearRing2d & footprint_hull) -> lanelet::BasicPolygon2d {
310+
lanelet::BasicPolygon2d basic_polygon;
311+
for (const auto & point : footprint_hull) {
312+
Eigen::Vector2d p(point.x(), point.y());
313+
basic_polygon.push_back(p);
314+
}
315+
return basic_polygon;
316+
};
317+
lanelet::BasicPolygon2d footprint_hull_basic_polygon = to_basic_polygon(footprint_hull);
318+
319+
// Find all lanelets that intersect the footprint hull
320+
return lanelet::geometry::findWithin2d(
321+
lanelet_map_ptr->laneletLayer, footprint_hull_basic_polygon, 0.0);
322+
}
323+
324+
std::optional<lanelet::BasicPolygon2d> LaneDepartureChecker::getFusedLaneletPolygonForPath(
325+
const lanelet::LaneletMapPtr lanelet_map_ptr, const PathWithLaneId & path) const
326+
{
327+
const auto lanelets_distance_pair = getLaneletsFromPath(lanelet_map_ptr, path);
328+
// Fuse lanelets into a single BasicPolygon2d
329+
auto fused_lanelets = [&lanelets_distance_pair]() -> std::optional<lanelet::BasicPolygon2d> {
330+
if (lanelets_distance_pair.empty()) return std::nullopt;
331+
if (lanelets_distance_pair.size() == 1)
332+
return lanelets_distance_pair.at(0).second.polygon2d().basicPolygon();
333+
334+
lanelet::BasicPolygon2d merged_polygon =
335+
lanelets_distance_pair.at(0).second.polygon2d().basicPolygon();
336+
for (size_t i = 1; i < lanelets_distance_pair.size(); ++i) {
337+
const auto & route_lanelet = lanelets_distance_pair.at(i).second;
338+
const auto & poly = route_lanelet.polygon2d().basicPolygon();
339+
340+
std::vector<lanelet::BasicPolygon2d> lanelet_union_temp;
341+
boost::geometry::union_(poly, merged_polygon, lanelet_union_temp);
342+
343+
// Update merged_polygon by accumulating all merged results
344+
merged_polygon.clear();
345+
for (const auto & temp_poly : lanelet_union_temp) {
346+
merged_polygon.insert(merged_polygon.end(), temp_poly.begin(), temp_poly.end());
347+
}
348+
}
349+
if (merged_polygon.empty()) return std::nullopt;
350+
return merged_polygon;
351+
}();
352+
353+
return fused_lanelets;
354+
}
355+
356+
bool LaneDepartureChecker::checkPathWillLeaveLane(
357+
const lanelet::LaneletMapPtr lanelet_map_ptr, const PathWithLaneId & path) const
358+
{
359+
// check if the footprint is not fully contained within the fused lanelets polygon
360+
const std::vector<LinearRing2d> vehicle_footprints = createVehicleFootprints(path);
361+
const auto fused_lanelets_polygon = getFusedLaneletPolygonForPath(lanelet_map_ptr, path);
362+
if (!fused_lanelets_polygon) return true;
363+
return !std::all_of(
364+
vehicle_footprints.begin(), vehicle_footprints.end(),
365+
[&fused_lanelets_polygon](const auto & footprint) {
366+
return boost::geometry::within(footprint, fused_lanelets_polygon.value());
367+
});
368+
}
369+
370+
PathWithLaneId LaneDepartureChecker::cropPointsOutsideOfLanes(
371+
const lanelet::LaneletMapPtr lanelet_map_ptr, const PathWithLaneId & path, const size_t end_index)
372+
{
373+
PathWithLaneId temp_path;
374+
const auto fused_lanelets_polygon = getFusedLaneletPolygonForPath(lanelet_map_ptr, path);
375+
if (path.points.empty() || !fused_lanelets_polygon) return temp_path;
376+
const auto vehicle_footprints = createVehicleFootprints(path);
377+
size_t idx = 0;
378+
std::for_each(vehicle_footprints.begin(), vehicle_footprints.end(), [&](const auto & footprint) {
379+
if (idx > end_index || boost::geometry::within(footprint, fused_lanelets_polygon.value())) {
380+
temp_path.points.push_back(path.points.at(idx));
381+
}
382+
++idx;
383+
});
384+
PathWithLaneId cropped_path = path;
385+
cropped_path.points = temp_path.points;
386+
return cropped_path;
387+
}
388+
301389
bool LaneDepartureChecker::isOutOfLane(
302390
const lanelet::ConstLanelets & candidate_lanelets, const LinearRing2d & vehicle_footprint)
303391
{
@@ -364,4 +452,5 @@ bool LaneDepartureChecker::willCrossBoundary(
364452
}
365453
return false;
366454
}
455+
367456
} // namespace lane_departure_checker
2.07 MB
Loading

0 commit comments

Comments
 (0)