Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add 'obstacle_velocity_limiter' package #1579

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
98 commits
Select commit Hold shift + click to select a range
2f2ad5e
Initial commit with barebone SafeVelocityAdjustorNode
maxime-clem Mar 22, 2022
8b50531
Add debug topics, launch file, and config file
maxime-clem Mar 22, 2022
1e1c1e6
Fix debug markers
maxime-clem Mar 23, 2022
d0df66d
Fix dynamic parameters
maxime-clem Mar 23, 2022
5e96683
Add proper collision detection and debug footprint
maxime-clem Mar 25, 2022
23414bc
Add script to compare the original and adjusted velocity profiles
maxime-clem Mar 25, 2022
d9ddc2f
Fix calculation of distance to obstacle
maxime-clem Mar 28, 2022
a87c961
Add test for calculation collision distance
maxime-clem Mar 28, 2022
83f2dd7
Add launch file to test the safe_velocity_adjustor with a bag
maxime-clem Mar 29, 2022
756bf54
Cleanup code and add tests for forwardSimulatedVector
maxime-clem Mar 29, 2022
b88abc3
Simplify collision detection by not using a footprint polygon
maxime-clem Mar 30, 2022
04ce926
Add filtering of the dynamic objects from the pointcloud
maxime-clem Mar 31, 2022
9afdaf4
[DEBUG] Print runtimes of expensive functions
maxime-clem Mar 31, 2022
f48df42
Add trajectory downsampling to boost performance + improve debug markers
maxime-clem Apr 1, 2022
c2a5e22
Modify velocity only from ego pose + distance parameter
maxime-clem Apr 5, 2022
50a3c92
Add 1st Eigen version of distanceToClosestCollision + benchmark
maxime-clem Apr 6, 2022
faa33fc
Switch to using contours from occupancy grid for collision checking
maxime-clem Apr 11, 2022
f7543ce
Add buffer around dynamic obstacles to avoid false obstacle detection
maxime-clem Apr 12, 2022
54ec7ba
Add parameter to limit the adjusted velocity
maxime-clem Apr 12, 2022
9a819ba
Use vehicle_info_util to get vehicle footprint
maxime-clem Apr 12, 2022
a1b6e63
Calculate accurate distance to collision + add tests
maxime-clem Apr 12, 2022
022b3fb
Add parameter for the min velocity where a dynamic obstacle is ignored
maxime-clem Apr 13, 2022
18853af
Add README and some pictures to explain the node inner workings
maxime-clem Apr 13, 2022
970c158
Update scenario_planning.launch.xml to run the new node
maxime-clem Apr 13, 2022
c4f666a
Fix format of launch files
maxime-clem Apr 13, 2022
9bd0b7a
Update launcher and rviz config used for debuging with bag
maxime-clem Apr 13, 2022
f53d6c5
Cleanup debug publishing
maxime-clem Apr 14, 2022
f8ffaf7
Complete tests of collision_distance.hpp
maxime-clem Apr 14, 2022
5c1ac73
Add docstring + Small code cleanup
maxime-clem Apr 14, 2022
f881193
Improve test of occupancy_grid_utils
maxime-clem Apr 14, 2022
53afebb
Fix bug when setting parameter callback before getting vehicle parame…
maxime-clem Apr 15, 2022
e7b6c44
Rename safe_velocity_adjustor to apparent_safe_velocity_limiter
maxime-clem Apr 15, 2022
98e5bb6
Move declarations to cpp file (apparent_safe_velocity_limiter_node)
maxime-clem Apr 15, 2022
a8cac68
Move declarations to cpp file (occupancy_grid_utils)
maxime-clem Apr 15, 2022
cd2c1c7
Move declarations to cpp file (collision_distance)
maxime-clem Apr 15, 2022
908fded
Add exec of trajectory_visualizer.py in launch files
maxime-clem Apr 21, 2022
166a2a3
Mask trajectory footprint from the occupancy grid (might be expensive)
maxime-clem Apr 28, 2022
00534ce
Filter out the occupancy grid that is outside the envelope polygon
maxime-clem Apr 28, 2022
e2c3f80
Add improved PolygonIterator using scan line algorithm
maxime-clem May 10, 2022
03a8281
Use autoware_cmake for dependencies
maxime-clem May 12, 2022
308e3e8
Improve performances of PolygonIterator
maxime-clem May 12, 2022
d331e44
Minor cleanup of PolygonIterator
maxime-clem May 14, 2022
6690d59
Use improved iterator + add benchmark (max/avg/med) to node
maxime-clem May 14, 2022
5484d62
Minor code cleanup
maxime-clem May 16, 2022
39d15d4
Switch from set to vector/list in PolygonIterator
maxime-clem May 16, 2022
492842a
Remove PolygonIterator and use implementation from grid_map_utils
maxime-clem May 26, 2022
b6d852e
Add parameter to limit deceleration when adjusting the velocity
maxime-clem Jun 26, 2022
d600185
Code cleanup, move type decl and debug functions to separate files
maxime-clem Jun 26, 2022
9c6b742
Add support for collision detection using pointcloud
maxime-clem Jun 29, 2022
588a6be
Code cleanup
maxime-clem Jul 1, 2022
b14670a
Speedup pointcloud filtering (still ~100ms on bags)
maxime-clem Jul 3, 2022
4156f43
Improve envelope calculation and use separate node for pcd downsampling
maxime-clem Jul 6, 2022
494adfa
Add ProjectionParameters to prepare for the bicycle model projection
maxime-clem Jul 11, 2022
7c0182e
Add bicycle projection with various steering offsets
maxime-clem Jul 12, 2022
cf401ef
Update docstring
maxime-clem Jul 13, 2022
a7087b9
Major refactoring, calculate envelope from footprints
maxime-clem Jul 14, 2022
5d891d8
Add extraction of static obstacles from lanelet map
maxime-clem Jul 19, 2022
e4a3df5
Remove stopwatch
maxime-clem Jul 19, 2022
5f864fc
Add arc distance calculation when using bicycle projection
maxime-clem Jul 20, 2022
52dce7d
Fix multi geometry definitions in tier4_autoware_utils/boost_geometry
maxime-clem Jul 22, 2022
1962727
Improve geometry operations to take advantage of Eigen
maxime-clem Jul 22, 2022
bc9fe6f
Switch to min/max offset and simplify footprint calculations
maxime-clem Jul 25, 2022
cdf007a
Fix unit tests (unset params.heading)
maxime-clem Jul 25, 2022
f796ec5
Add option to filter obstacles using the safety envelope
maxime-clem Jul 25, 2022
e311134
Fix bug with distance calculation and improve debug markers
maxime-clem Jul 28, 2022
4a177fe
Update README
maxime-clem Jul 31, 2022
5434e85
Add parameter to set map obstacles by linestring id (for debug)
maxime-clem Aug 2, 2022
b85b1cc
Move param structures to dedicated file and add PreprocessingParameters
maxime-clem Aug 2, 2022
8138c16
Add parameter to calculate steering angle of trajectory points
maxime-clem Aug 2, 2022
043dc1f
Cleanup footprint generation
maxime-clem Aug 2, 2022
18a7a56
Fix bug with debug marker ids
maxime-clem Aug 3, 2022
07ec431
Fix bug where the VelocityParameters were not constructed
maxime-clem Aug 4, 2022
80b48b2
Update obstacles extraction
maxime-clem Aug 7, 2022
cd2b6e8
Minor code cleanup
maxime-clem Aug 8, 2022
debf767
Switch to collision detection using rtree
maxime-clem Aug 8, 2022
30c5bec
Add publishing of the runtime (in microseconds)
maxime-clem Aug 10, 2022
05ae5f6
Add option to ignore obstacles on the trajectory
maxime-clem Aug 10, 2022
48877b6
Add max length and max duration parameters
maxime-clem Aug 10, 2022
4df5ca1
Restructure Obstacles structure to separate lines and points for speedup
maxime-clem Aug 10, 2022
849b405
Convert obstacle linestrings to segments when used in the rtree
maxime-clem Aug 11, 2022
96d7537
Add parameter for extra distance when filtering the ego path
maxime-clem Aug 12, 2022
ffe4520
Fix issues caused by rebase
maxime-clem Aug 13, 2022
9f91a97
Minor code cleanup
maxime-clem Aug 14, 2022
2cd33c6
Update to run with looping bag replay
maxime-clem Aug 19, 2022
c4b2952
Add debug markers for obstacle masks and only publish when subscribed
maxime-clem Aug 21, 2022
cb4c2ec
Update README
maxime-clem Aug 23, 2022
ff88ec9
Fix humble build issue with PCL library
maxime-clem Aug 24, 2022
7a4d562
Update obstacle extraction from lanelet map (no longer based on route)
maxime-clem Aug 26, 2022
b5b19de
Optimize use of rtree + use naive collision checking with few obstacles
maxime-clem Aug 28, 2022
dbe6ab2
Remove debug code and update default parameters
maxime-clem Oct 17, 2022
2092d72
Do not wait for self pose
maxime-clem Oct 17, 2022
6991e00
Rename to obstacle_velocity_limiter
maxime-clem Oct 17, 2022
005484c
More minor cleanup
maxime-clem Oct 18, 2022
f85a4f8
Update READEME.md
maxime-clem Oct 21, 2022
1019c4b
Update README to have the purpose written before the illustration
maxime-clem Oct 26, 2022
2fad4dc
Update copyright notice: Tier IV -> TIER IV
maxime-clem Oct 26, 2022
2bcb16c
Remove use_sim_time param from node launch file
maxime-clem Oct 26, 2022
f547a8f
Update launch files to run in the motion_planner + add launch config
maxime-clem Oct 26, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ using LineString2d = boost::geometry::model::linestring<Point2d>;
using LinearRing2d = boost::geometry::model::ring<Point2d>;
using Polygon2d = boost::geometry::model::polygon<Point2d>;
using MultiPoint2d = boost::geometry::model::multi_point<Point2d>;
using MultiLineString2d = boost::geometry::model::multi_linestring<Point2d>;
using MultiPolygon2d = boost::geometry::model::multi_polygon<Point2d>;
using MultiLineString2d = boost::geometry::model::multi_linestring<LineString2d>;
TakaHoribe marked this conversation as resolved.
Show resolved Hide resolved
using MultiPolygon2d = boost::geometry::model::multi_polygon<Polygon2d>;

// 3D
struct Point3d;
Expand All @@ -46,8 +46,8 @@ using LineString3d = boost::geometry::model::linestring<Point3d>;
using LinearRing3d = boost::geometry::model::ring<Point3d>;
using Polygon3d = boost::geometry::model::polygon<Point3d>;
using MultiPoint3d = boost::geometry::model::multi_point<Point3d>;
using MultiLineString3d = boost::geometry::model::multi_linestring<Point3d>;
using MultiPolygon3d = boost::geometry::model::multi_polygon<Point3d>;
using MultiLineString3d = boost::geometry::model::multi_linestring<LineString3d>;
using MultiPolygon3d = boost::geometry::model::multi_polygon<Polygon3d>;

struct Point2d : public Eigen::Vector2d
{
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/**:
ros__parameters:
min_ttc: 1.0 # [s] minimum time without collision when doing projection at each trajectory point
distance_buffer: 0.0 # [m] extra distance to add to a projection (in addition to the vehicle overhang)
min_adjusted_velocity: 2.5 # [m/s] minimum velocity that the module can set
max_deceleration: 2.0 # [m/s²] maximum deceleration caused by the adjusted velocity

trajectory_preprocessing:
start_distance: 0.0 # [m] distance ahead of ego from which to start modifying the trajectory
max_length: 100.0 # [m] maximum distance (from the start point) where the velocity is adjusted
max_duration: 10.0 # [s] maximum duration (from the start point) where the velocity is adjusted
downsample_factor: 10 # factor by which to downsample the input trajectory for calculation
calculate_steering_angles: false # if true, the steering angle at each trajectory point is calculated from the change in heading

simulation:
model: particle # model to use for forward projection at each trajectory point. Either "particle" or "bicycle"
distance_method: exact # distance calculation method. Either "exact" or "approximation".
# parameters used only with the bicycle model
steering_offset: 0.01 # [rad] steering angle offset used to model uncertainty in the forward projection
nb_points: 5 # number of points representing the curved projections

obstacles:
dynamic_source: static_only # source of dynamic obstacles. Must be 'pointcloud', 'occupancy_grid', or 'static_only'.
ignore_obstacles_on_path: false # if true, obstacles on the ego paths are ignored
ignore_extra_distance: 1.0 # [m] extra lateral distance where obstacles along the path are ignored
occupancy_grid_threshold: 60 # occupancy grid values higher than this are considered to be obstacles
dynamic_obstacles_buffer: 1.5 # [m] extra distance around dynamic obstacles used to mask the occupancy grid and avoid false obstacle detection
dynamic_obstacles_min_vel: 0.5 # [m/s] velocity above which a dynamic obstacle is ignored by the module
static_map_tags: # linestring tags in the lanelet maps that will be used as static obstacles
- guard_rail
filter_envelope : false # whether to calculate the apparent safety envelope and use it to filter obstacles
rtree_min_points: 500 # from this number of obstacle points, a rtree is used for collision detection
rtree_min_segments: 1600 # from this number of obstacle segments, a rtree is used for collision detection
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,40 @@ def launch_setup(context, *args, **kwargs):
extra_arguments=[{"use_intra_process_comms": LaunchConfiguration("use_intra_process")}],
)

# obstacle velocity limiter
obstacle_velocity_limiter_param_path = os.path.join(
LaunchConfiguration("tier4_planning_launch_param_path").perform(context),
"scenario_planning",
"lane_driving",
"motion_planning",
"obstacle_velocity_limiter",
"obstacle_velocity_limiter.param.yaml",
)
with open(obstacle_velocity_limiter_param_path, "r") as f:
obstacle_velocity_limiter_param = yaml.safe_load(f)["/**"]["ros__parameters"]
obstacle_velocity_limiter_component = ComposableNode(
package="obstacle_velocity_limiter",
plugin="obstacle_velocity_limiter::ObstacleVelocityLimiterNode",
name="obstacle_velocity_limiter",
namespace="",
remappings=[
("~/input/trajectory", "obstacle_avoidance_planner/trajectory"),
("~/input/odometry", "/localization/kinematic_state"),
("~/input/dynamic_obstacles", "/perception/object_recognition/objects"),
("~/input/occupancy_grid", "/perception/occupancy_grid_map/map"),
("~/input/obstacle_pointcloud", "/perception/obstacle_segmentation/pointcloud"),
("~/input/map", "/map/vector_map"),
("~/output/debug_markers", "debug_markers"),
("~/output/trajectory", "obstacle_velocity_limiter/trajectory"),
],
parameters=[
obstacle_velocity_limiter_param,
vehicle_info_param,
{"obstacles.dynamic_source": "static_only"},
],
extra_arguments=[{"use_intra_process_comms": LaunchConfiguration("use_intra_process")}],
)

# surround obstacle checker
surround_obstacle_checker_param_path = os.path.join(
LaunchConfiguration("tier4_planning_launch_param_path").perform(context),
Expand Down Expand Up @@ -167,7 +201,7 @@ def launch_setup(context, *args, **kwargs):
),
("~/input/objects", "/perception/object_recognition/objects"),
("~/input/odometry", "/localization/kinematic_state"),
("~/input/trajectory", "obstacle_avoidance_planner/trajectory"),
("~/input/trajectory", "obstacle_velocity_limiter/trajectory"),
],
parameters=[
nearest_search_param,
Expand Down Expand Up @@ -197,7 +231,7 @@ def launch_setup(context, *args, **kwargs):
name="obstacle_cruise_planner",
namespace="",
remappings=[
("~/input/trajectory", "obstacle_avoidance_planner/trajectory"),
("~/input/trajectory", "obstacle_velocity_limiter/trajectory"),
("~/input/odometry", "/localization/kinematic_state"),
("~/input/acceleration", "/localization/acceleration"),
("~/input/objects", "/perception/object_recognition/objects"),
Expand All @@ -220,7 +254,7 @@ def launch_setup(context, *args, **kwargs):
name="obstacle_cruise_planner_relay",
namespace="",
parameters=[
{"input_topic": "obstacle_avoidance_planner/trajectory"},
{"input_topic": "obstacle_velocity_limiter/trajectory"},
{"output_topic": "/planning/scenario_planning/lane_driving/trajectory"},
{"type": "autoware_auto_planning_msgs/msg/Trajectory"},
],
Expand All @@ -234,6 +268,7 @@ def launch_setup(context, *args, **kwargs):
executable=LaunchConfiguration("container_executable"),
composable_node_descriptions=[
obstacle_avoidance_planner_component,
obstacle_velocity_limiter_component,
],
)

Expand Down
56 changes: 56 additions & 0 deletions planning/obstacle_velocity_limiter/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
cmake_minimum_required(VERSION 3.5)
project(obstacle_velocity_limiter)

find_package(autoware_cmake REQUIRED)
autoware_package()

find_package(PCL REQUIRED COMPONENTS common)
find_package(pcl_conversions REQUIRED)

ament_auto_add_library(obstacle_velocity_limiter_node SHARED
DIRECTORY src
)

ament_target_dependencies(obstacle_velocity_limiter_node PCL)
target_include_directories(obstacle_velocity_limiter_node
SYSTEM PUBLIC
"${PCL_INCLUDE_DIRS}"
)

# Disable warnings due to external dependencies
get_target_property(lanelet2_core_INCLUDE_DIR
lanelet2_core::lanelet2_core INTERFACE_INCLUDE_DIRECTORIES
)

rclcpp_components_register_node(obstacle_velocity_limiter_node
PLUGIN "obstacle_velocity_limiter::ObstacleVelocityLimiterNode"
EXECUTABLE obstacle_velocity_limiter
)

if(BUILD_TESTING)
find_package(ament_lint_auto REQUIRED)
ament_lint_auto_find_test_dependencies()
ament_add_ros_isolated_gtest(test_${PROJECT_NAME}
test/test_forward_projection.cpp
test/test_obstacles.cpp
test/test_collision_distance.cpp
test/test_occupancy_grid_utils.cpp
)
target_link_libraries(test_${PROJECT_NAME}
obstacle_velocity_limiter_node
)
endif()

add_executable(collision_benchmark
benchmarks/collision_checker_benchmark.cpp
)
target_link_libraries(collision_benchmark
obstacle_velocity_limiter_node
)

ament_auto_package(
INSTALL_TO_SHARE
launch
config
script
)
Loading