Skip to content

Commit 94904a5

Browse files
tkimura4mitsudome-rnnmmTakaHoribekmiya
authored
feat: add freespace_planner package (#35)
* release v0.4.0 * remove ROS1 packages temporarily Signed-off-by: mitsudome-r <ryohsuke.mitsudome@tier4.jp> * Revert "remove ROS1 packages temporarily" This reverts commit a78b36113cc2ea65f3fc1c3488a363651b679881. Signed-off-by: mitsudome-r <ryohsuke.mitsudome@tier4.jp> * add COLCON_IGNORE to ros1 packages Signed-off-by: mitsudome-r <ryohsuke.mitsudome@tier4.jp> * Rename launch files to launch.xml (#28) * port freespace plannet to ros2 (#41) * port freespace plannet to ros2 Signed-off-by: Takamasa Horibe <horibe.takamasa@gmail.com> * fix from review : add buildtool dependence & change function name to camelCase Signed-off-by: Takamasa Horibe <horibe.takamasa@gmail.com> * fix duration unit for RCLCPP_*_THROTTLE (#75) Signed-off-by: Takamasa Horibe <horibe.takamasa@gmail.com> * Convert calls of Duration to Duration::from_seconds where appropriate (#131) * Rename h files to hpp (#142) * Change includes * Rename files * Adjustments to make things compile * Other packages * Adjust copyright notice on 532 out of 699 source files (#143) * Use quotes for includes where appropriate (#144) * Use quotes for includes where appropriate * Fix lint tests * Make tests pass hopefully * Enable lints in freespace_planner (#147) * add missing declaration of parameter (#233) Signed-off-by: mitsudome-r <ryohsuke.mitsudome@tier4.jp> * Fix typos in planning modules (#866) (#275) * fix typos in planning * fix corresponding typos in planning * revert fixed typos temporarily due to its impact on launchers Co-authored-by: Kazuki Miyahara <kmiya@outlook.com> * Ros2 fix topic name part1 (#408) * Fix topic name of lane_departure_checker debug Signed-off-by: Takagi, Isamu <isamu.takagi@tier4.jp> * Fix topic name of mpc_follower debug Signed-off-by: Takagi, Isamu <isamu.takagi@tier4.jp> * Fix topic name of velocity_controller debug Signed-off-by: Takagi, Isamu <isamu.takagi@tier4.jp> * Fix topic name of motion_velocity_optimizer debug Signed-off-by: Takagi, Isamu <isamu.takagi@tier4.jp> * Fix topic name of lane_change_planner debug Signed-off-by: Takagi, Isamu <isamu.takagi@tier4.jp> * Fix topic name of behavior_velocity_planner debug Signed-off-by: Takagi, Isamu <isamu.takagi@tier4.jp> * Fix topic name of obstacle_avoidance_planner debug Signed-off-by: Takagi, Isamu <isamu.takagi@tier4.jp> * Fix topic name of behavior_velocity_planner Signed-off-by: Takagi, Isamu <isamu.takagi@tier4.jp> * Fix topic name of motion_velocity_optimizer Signed-off-by: Takagi, Isamu <isamu.takagi@tier4.jp> * Fix topic name of lane_departure_checker Signed-off-by: Takagi, Isamu <isamu.takagi@tier4.jp> * Fix topic name of mpc_follower Signed-off-by: Takagi, Isamu <isamu.takagi@tier4.jp> * Fix topic name of behavior_velocity_planner Signed-off-by: Takagi, Isamu <isamu.takagi@tier4.jp> * Fix topic name of velocity_controller Signed-off-by: Takagi, Isamu <isamu.takagi@tier4.jp> * Fix topic name of lane_change_planner Signed-off-by: Takagi, Isamu <isamu.takagi@tier4.jp> * Fix topic name of obstacle_avoidance_planner Signed-off-by: Takagi, Isamu <isamu.takagi@tier4.jp> * Fix topic name of obstacle_stop_planner Signed-off-by: Takagi, Isamu <isamu.takagi@tier4.jp> * Fix topic name of costmap_generator Signed-off-by: Takagi, Isamu <isamu.takagi@tier4.jp> * Fix topic name of freespace_planner Signed-off-by: Takagi, Isamu <isamu.takagi@tier4.jp> * Fix topic name of surround_obstacle_checker Signed-off-by: Takagi, Isamu <isamu.takagi@tier4.jp> * Fix topic name of costmap_generator Signed-off-by: Takagi, Isamu <isamu.takagi@tier4.jp> * Fix topic name of emergency_handler Signed-off-by: Takagi, Isamu <isamu.takagi@tier4.jp> * Fix lint errors Signed-off-by: Takagi, Isamu <isamu.takagi@tier4.jp> * Fix typo Signed-off-by: Takagi, Isamu <isamu.takagi@tier4.jp> * add use_sim-time option (#454) * Make planning modules components (#1263) Signed-off-by: wep21 <border_goldenmarket@yahoo.co.jp> * Remove use_sim_time for set_parameter (#1260) Signed-off-by: wep21 <border_goldenmarket@yahoo.co.jp> * Rename AstarNavi to FreespacePlannerNode (#1322) * Rename AstarNavi Signed-off-by: Kenji Miyake <kenji.miyake@tier4.jp> * uncrustify Signed-off-by: Kenji Miyake <kenji.miyake@tier4.jp> * Porting freespace planner (#1290) * update HA* for multiple curvatures (#1196) * update HA* for multi-curvature planning Signed-off-by: Takamasa Horibe <horibe.takamasa@gmail.com> * restore param to old one Signed-off-by: Takamasa Horibe <horibe.takamasa@gmail.com> * cosmetic change Signed-off-by: Takamasa Horibe <horibe.takamasa@gmail.com> * Add todo for parameter name change Signed-off-by: Takamasa Horibe <horibe.takamasa@gmail.com> * add freespace planner config yaml (#1207) * add freespace planner config yaml * fixed typo * fixed comment * Fix variable names Signed-off-by: Kenji Miyake <kenji.miyake@tier4.jp> * Fix lint Signed-off-by: wep21 <border_goldenmarket@yahoo.co.jp> Co-authored-by: Takamasa Horibe <horibe.takamasa@gmail.com> Co-authored-by: RyuYamamoto <ryu.yamamoto@tier4.jp> Co-authored-by: Kenji Miyake <kenji.miyake@tier4.jp> Co-authored-by: wep21 <border_goldenmarket@yahoo.co.jp> * Fix wrong rate in freespace_planner (#1564) Signed-off-by: Kenji Miyake <kenji.miyake@tier4.jp> * suppress warnings for declare parameters (#1724) * fix for lanelet2_extension * fix for traffic light ssd fine detector * fix for topic_state_monitor * fix for dummy diag publisher * fix for remote cmd converter * fix for vehicle_info_util * fix for multi object tracker * fix for freespace planner * fix for autoware_error_monitor * add Werror for multi object tracker * fix for multi object tracker * add Werror for liraffic light ssd fine detector * add Werror for topic state monitor * add Werror * add Werror * add Werror * add Werror * fix style * set default arg (#1736) (#1737) * Fix -Wunused-parameter (#1836) * Fix -Wunused-parameter Signed-off-by: Kenji Miyake <kenji.miyake@tier4.jp> * Fix mistake Signed-off-by: Kenji Miyake <kenji.miyake@tier4.jp> * fix spell * Fix lint issues Signed-off-by: Kenji Miyake <kenji.miyake@tier4.jp> * Ignore flake8 warnings Signed-off-by: Kenji Miyake <kenji.miyake@tier4.jp> Co-authored-by: Hiroki OTA <hiroki.ota@tier4.jp> * add sort-package-xml hook in pre-commit (#1881) * add sort xml hook in pre-commit * change retval to exit_status * rename * add prettier plugin-xml * use early return * add license note * add tier4 license * restore prettier * change license order * move local hooks to public repo * move prettier-xml to pre-commit-hooks-ros * update version for bug-fix * apply pre-commit * Master sync for parking (#1693) * Reedsshepp distance as a heuristic function in hybrid A star (#1297) * Use reeds sheep distance * Use average radius * Add standalone toy problem * Cleanup standalone node * Add plotter * Add rostest * Arrange directory * Better test and plot settings * Following PEP & small fix cpp * Avoid repeted heap allocation * Standalone reeds-shepp * Licence notice * Use struct instead of raw array * Update license * Removed comment * Add how to use python visualizer * Remove useless methods * Apply clang-format * Do not fully expose StateXYT * Remove StateXYT->q[3] conversion * Use StateXYZ & remove useless functions * Add license in test * Update planning/scenario_planning/parking/astar_search/include/astar_search/astar_search.h Co-authored-by: Takamasa Horibe <horibe.takamasa@gmail.com> * Update planning/scenario_planning/parking/astar_search/src/astar_search.cpp Co-authored-by: Takamasa Horibe <horibe.takamasa@gmail.com> * Install reeds-shepp * Apply markdownlint Co-authored-by: Takamasa Horibe <horibe.takamasa@gmail.com> Signed-off-by: wep21 <border_goldenmarket@yahoo.co.jp> * Boost collision checking by pre-caching the collision indexes for all yaw angles (#1298) * Precompute collision index for all theta to accelearte collision * Add test condition that checks solution's feasibility * Fix in response to the review * Update planning/scenario_planning/parking/astar_search/include/astar_search/astar_search.h Co-authored-by: tkimura4 <tomoya.kimura@tier4.jp> * Use inline (#1572) * Modular planner (#1492) * Update * Check working (NOTE somehow 2x faster than the original... why???) * Split header and impl * AstarWaypoint => PlannerWaypoint * AstarParam => PlannerParam * Change package name : astar_search => planning_algorithms * Add override keyword for readability * Apply clang-format & Add License * Remove useless executable * Rearange some functions and members * Add include guard * Remove unused node status * Add virtual destructor * Rename test names * Removed duplicate transformPose * Do not expose transformPose * Compatible planning_algorithms * Pointer to AbstractAlgorithm * Apply clang-format * Removed needless method declaration * Renamed planning_algorithms => parking_planning_algorithms * Add explicit * Apply clang-format * Split parameter into PlannerCommonParam and AstarParam * Tweak * Remove unused line * Split rosparam into common_param and astar_param * Fix package stuff reflect to the chagne of planning_algorithm pkg name * Change class name * Small fix (complied! and check running on Autoware) * Add rosparam : planning_algorithm * Fix comment and ros_info message * Remove useless ; * Add note * Add namespace * Fix typo * Apply clang-format 10 * Remove array3d * Avoid using std * Rename: parking => freespace * Avoid using namespace hoge * Update readme of freesapce planner * Apply clang-format * Update readme for freesplace_planning_algorithms * [freespace_planning_algorithms] apply aedd8626762121ad7 Signed-off-by: Takamasa Horibe <horibe.takamasa@gmail.com> * fix inline definition Signed-off-by: Takamasa Horibe <horibe.takamasa@gmail.com> * rename directory Signed-off-by: Takamasa Horibe <horibe.takamasa@gmail.com> * rename function Signed-off-by: Takamasa Horibe <horibe.takamasa@gmail.com> * Fix bug yaw => index conversion * modify package.xml: fix license, add author Signed-off-by: Takamasa Horibe <horibe.takamasa@gmail.com> * fix license Signed-off-by: Takamasa Horibe <horibe.takamasa@gmail.com> Co-authored-by: Takamasa Horibe <horibe.takamasa@gmail.com> * Fix bug nearest_index must not be greater than the current target_index_ (#1571) * Fixbug * Apply clang-format * Compute neareset index in the partial trajectory * extract partial_trajectory from current target trajectory Signed-off-by: Takamasa Horibe <horibe.takamasa@gmail.com> * add explicit guard Signed-off-by: Takamasa Horibe <horibe.takamasa@gmail.com> Co-authored-by: Takamasa Horibe <horibe.takamasa@gmail.com> * Cleanup & modify readme freespace planner (#1607) * apply clang format Signed-off-by: Takamasa Horibe <horibe.takamasa@gmail.com> * align indent Signed-off-by: Takamasa Horibe <horibe.takamasa@gmail.com> * rename robot_shape -> vehicle_shape Signed-off-by: Takamasa Horibe <horibe.takamasa@gmail.com> * rename step -> distance for TODO Signed-off-by: Takamasa Horibe <horibe.takamasa@gmail.com> * modify include guard Signed-off-by: Takamasa Horibe <horibe.takamasa@gmail.com> * fix comparison warning Signed-off-by: Takamasa Horibe <horibe.takamasa@gmail.com> * update readme Signed-off-by: Takamasa Horibe <horibe.takamasa@gmail.com> * add namespace on ros-parameters Signed-off-by: Takamasa Horibe <horibe.takamasa@gmail.com> * use autoware_utils Signed-off-by: Takamasa Horibe <horibe.takamasa@gmail.com> * align indent Signed-off-by: Takamasa Horibe <horibe.takamasa@gmail.com> * fix comparison warning Signed-off-by: Takamasa Horibe <horibe.takamasa@gmail.com> Signed-off-by: wep21 <border_goldenmarket@yahoo.co.jp> * Rename files Signed-off-by: wep21 <border_goldenmarket@yahoo.co.jp> * Remove boost constants Signed-off-by: wep21 <border_goldenmarket@yahoo.co.jp> * Apply lint Signed-off-by: wep21 <border_goldenmarket@yahoo.co.jp> * Add missing geometry2 apis Signed-off-by: wep21 <border_goldenmarket@yahoo.co.jp> * Porting test code to ros2 Signed-off-by: wep21 <border_goldenmarket@yahoo.co.jp> * Apply lint Signed-off-by: wep21 <border_goldenmarket@yahoo.co.jp> * Install test script Signed-off-by: wep21 <border_goldenmarket@yahoo.co.jp> * Change file mode of test script Signed-off-by: wep21 <border_goldenmarket@yahoo.co.jp> * Fix map info data type in test script Signed-off-by: wep21 <border_goldenmarket@yahoo.co.jp> * Add namespace and message abbreviation Signed-off-by: wep21 <border_goldenmarket@yahoo.co.jp> * Fix typo Signed-off-by: wep21 <border_goldenmarket@yahoo.co.jp> * Fix lint Signed-off-by: wep21 <border_goldenmarket@yahoo.co.jp> * Fix for pre-commit Signed-off-by: Kenji Miyake <kenji.miyake@tier4.jp> * Fix tf initialization Signed-off-by: wep21 <border_goldenmarket@yahoo.co.jp> Co-authored-by: Hirokazu Ishida <38597814+HiroIshida@users.noreply.github.com> Co-authored-by: Takamasa Horibe <horibe.takamasa@gmail.com> Co-authored-by: tkimura4 <tomoya.kimura@tier4.jp> Co-authored-by: Kenji Miyake <kenji.miyake@tier4.jp> * set default arg (#1736) * Fix package.xml (#2056) Signed-off-by: Kenji Miyake <kenji.miyake@tier4.jp> * Change formatter to clang-format and black (#2332) * Revert "Temporarily comment out pre-commit hooks" This reverts commit 748e9cdb145ce12f8b520bcbd97f5ff899fc28a3. * Replace ament_lint_common with autoware_lint_common Signed-off-by: Kenji Miyake <kenji.miyake@tier4.jp> * Remove ament_cmake_uncrustify and ament_clang_format Signed-off-by: Kenji Miyake <kenji.miyake@tier4.jp> * Apply Black Signed-off-by: Kenji Miyake <kenji.miyake@tier4.jp> * Apply clang-format Signed-off-by: Kenji Miyake <kenji.miyake@tier4.jp> * Fix build errors Signed-off-by: Kenji Miyake <kenji.miyake@tier4.jp> * Fix for cpplint * Fix include double quotes to angle brackets Signed-off-by: Kenji Miyake <kenji.miyake@tier4.jp> * Apply clang-format Signed-off-by: Kenji Miyake <kenji.miyake@tier4.jp> * Fix build errors Signed-off-by: Kenji Miyake <kenji.miyake@tier4.jp> * Add COLCON_IGNORE (#500) Signed-off-by: Kenji Miyake <kenji.miyake@tier4.jp> * rename topic name twist -> odometry (#568) Co-authored-by: Takayuki Murooka <takayuki.murooka@tier4.jp> * Port parking planner packages from .Auto (#600) * Copy code of 'vehicle_constants_manager' * Fix vehicle_constants_manager for ROS galactic * Rm .iv costmap_generator freespace_planner freespace_planning_aglorihtms * Add astar_search (from .Auto) * Copy freespace_planner from .Auto * Update freespace_planner for .IV * Copy costmap_generator from .Auto * Copy and update had_map_utils from .Auto * Update costmap_generator * Copy costmap_generator_nodes * Update costmap_generator_nodes * Comment out all tests * Move vehicle_constant_managers to tmp_autoware_auto_dependencies * ignore pre-commit for back-ported packages Signed-off-by: Takamasa Horibe <horibe.takamasa@gmail.com> * ignore testing Signed-off-by: Takamasa Horibe <horibe.takamasa@gmail.com> Co-authored-by: Takamasa Horibe <horibe.takamasa@gmail.com> * Port parking modules (#738) * Port costmap_generator * Port freespace_planner * fix readme * ci(pre-commit): autofix * misc Co-authored-by: mitsudome-r <ryohsuke.mitsudome@tier4.jp> Co-authored-by: Nikolai Morin <nnmmgit@gmail.com> Co-authored-by: Takamasa Horibe <horibe.takamasa@gmail.com> Co-authored-by: Ryohsuke Mitsudome <43976834+mitsudome-r@users.noreply.github.com> Co-authored-by: Kazuki Miyahara <kmiya@outlook.com> Co-authored-by: Takagi, Isamu <43976882+isamu-takagi@users.noreply.github.com> Co-authored-by: Daisuke Nishimatsu <42202095+wep21@users.noreply.github.com> Co-authored-by: Kenji Miyake <31987104+kenji-miyake@users.noreply.github.com> Co-authored-by: Keisuke Shima <19993104+KeisukeShima@users.noreply.github.com> Co-authored-by: RyuYamamoto <ryu.yamamoto@tier4.jp> Co-authored-by: Kenji Miyake <kenji.miyake@tier4.jp> Co-authored-by: wep21 <border_goldenmarket@yahoo.co.jp> Co-authored-by: Hiroki OTA <hiroki.ota@tier4.jp> Co-authored-by: Hirokazu Ishida <38597814+HiroIshida@users.noreply.github.com> Co-authored-by: Takayuki Murooka <takayuki5168@gmail.com> Co-authored-by: Takayuki Murooka <takayuki.murooka@tier4.jp> Co-authored-by: Maxime CLEMENT <78338830+maxime-clem@users.noreply.github.com> Co-authored-by: Fumiya Watanabe <rej55.g@gmail.com> Co-authored-by: Takeshi Miura <57553950+1222-takeshi@users.noreply.github.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent 679d6bd commit 94904a5

File tree

7 files changed

+929
-0
lines changed

7 files changed

+929
-0
lines changed
+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
cmake_minimum_required(VERSION 3.5)
2+
project(freespace_planner)
3+
4+
if(NOT CMAKE_CXX_STANDARD)
5+
set(CMAKE_CXX_STANDARD 14)
6+
set(CMAKE_CXX_STANDARD_REQUIRED ON)
7+
set(CMAKE_CXX_EXTENSIONS OFF)
8+
endif()
9+
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
10+
add_compile_options(-Wall -Wextra -Wpedantic -Werror)
11+
endif()
12+
13+
find_package(ament_cmake_auto REQUIRED)
14+
ament_auto_find_build_dependencies()
15+
16+
ament_auto_add_library(freespace_planner_node SHARED
17+
src/freespace_planner/freespace_planner_node.cpp
18+
)
19+
20+
rclcpp_components_register_node(freespace_planner_node
21+
PLUGIN "freespace_planner::FreespacePlannerNode"
22+
EXECUTABLE freespace_planner
23+
)
24+
25+
if(BUILD_TESTING)
26+
find_package(ament_lint_auto REQUIRED)
27+
ament_lint_auto_find_test_dependencies()
28+
endif()
29+
30+
ament_auto_package(
31+
INSTALL_TO_SHARE
32+
launch
33+
config
34+
)

planning/freespace_planner/README.md

+119
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
# The `freespace_planner`
2+
3+
## freespace_planner_node
4+
5+
`freespace_planner_node` is a global path planner node that plans trajectory
6+
in the space having static/dynamic obstacles. This node is currently based on
7+
Hybrid A\* search algorithm in `freespace_planning_algorithms` package.
8+
Other algorithms such as rrt\* will be also added and selectable in the future.
9+
10+
**Note**
11+
Due to the constraint of trajectory following, the output trajectory will be split to include only the single direction path.
12+
In other words, the output trajectory doesn't include both forward and backward trajectories at once.
13+
14+
### Input topics
15+
16+
| Name | Type | Description |
17+
| ----------------------- | ---------------------------------- | --------------------------------------------------------- |
18+
| `~input/route` | autoware_auto_planning_msgs::Route | route and goal pose |
19+
| `~input/occupancy_grid` | nav_msgs::OccupancyGrid | costmap, for drivable areas |
20+
| `~input/odometry` | nav_msgs::Odometry | vehicle velocity, for checking whether vehicle is stopped |
21+
| `~input/scenario` | autoware_planning_msgs::Scenario | scenarios to be activated, for node activation |
22+
23+
### Output topics
24+
25+
| Name | Type | Description |
26+
| -------------------- | --------------------------------------- | ------------------------------------------ |
27+
| `~output/trajectory` | autoware_auto_planning_msgs::Trajectory | trajectory to be followed |
28+
| `is_completed` | bool (implemented as rosparam) | whether all split trajectory are published |
29+
30+
### Output TFs
31+
32+
None
33+
34+
### How to launch
35+
36+
1. Write your remapping info in `freespace_planner.launch` or add args when executing `roslaunch`
37+
2. `roslaunch freespace_planner freespace_planner.launch`
38+
39+
### Parameters
40+
41+
#### Node parameters
42+
43+
| Parameter | Type | Description |
44+
| ---------------------------- | ------ | ------------------------------------------------------------------------------- |
45+
| `update_rate` | double | timer's update rate |
46+
| `waypoints_velocity` | double | velocity in output trajectory (currently, only constant velocity is supported) |
47+
| `th_arrived_distance_m` | double | threshold distance to check if vehicle has arrived at the trajectory's endpoint |
48+
| `th_stopped_time_sec` | double | threshold time to check if vehicle is stopped |
49+
| `th_stopped_velocity_mps` | double | threshold velocity to check if vehicle is stopped |
50+
| `th_course_out_distance_m` | double | threshold distance to check if vehicle is out of course |
51+
| `replan_when_obstacle_found` | bool | whether replanning when obstacle has found on the trajectory |
52+
| `replan_when_course_out` | bool | whether replanning when vehicle is out of course |
53+
54+
#### Planner common parameters
55+
56+
| Parameter | Type | Description |
57+
| ------------------------- | ------ | -------------------------------------------------- |
58+
| `planning_algorithms` | string | algorithms used in the node |
59+
| `time_limit` | double | time limit of planning |
60+
| `robot_length` | double | robot length |
61+
| `robot_width` | double | robot width |
62+
| `robot_base2back` | double | distance from robot's back to robot's base_link |
63+
| `minimum_turning_radius` | double | minimum turning radius of robot |
64+
| `theta_size` | double | the number of angle's discretization |
65+
| `lateral_goal_range` | double | goal range of lateral position |
66+
| `longitudinal_goal_range` | double | goal range of longitudinal position |
67+
| `angle_goal_range` | double | goal range of angle |
68+
| `curve_weight` | double | additional cost factor for curve actions |
69+
| `reverse_weight` | double | additional cost factor for reverse actions |
70+
| `obstacle_threshold` | double | threshold for regarding a certain grid as obstacle |
71+
72+
#### A\* search parameters
73+
74+
| Parameter | Type | Description |
75+
| --------------------------- | ------ | ------------------------------------------------------- |
76+
| `only_behind_solutions` | bool | whether restricting the solutions to be behind the goal |
77+
| `use_back` | bool | whether using backward trajectory |
78+
| `distance_heuristic_weight` | double | heuristic weight for estimating node's cost |
79+
80+
### Flowchart
81+
82+
```plantuml
83+
@startuml
84+
title onTimer
85+
start
86+
87+
if (all input data are ready?) then (yes)
88+
else (no)
89+
stop
90+
endif
91+
92+
if (scenario is active?) then (yes)
93+
else (no)
94+
:reset internal data;
95+
stop
96+
endif
97+
98+
:get current pose;
99+
100+
if (replan is required?) then (yes)
101+
:reset internal data;
102+
:publish stop trajectory before planning new trajectory;
103+
:plan new trajectory;
104+
else (no)
105+
endif
106+
107+
108+
if (vehicle is stopped?) then (yes)
109+
stop
110+
else (no)
111+
endif
112+
113+
:split trajectory\n(internally managing the state);
114+
115+
:publish trajectory;
116+
117+
stop
118+
@enduml
119+
```
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
/**:
2+
ros__parameters:
3+
# -- Node Configurations --
4+
planning_algorithm: "astar"
5+
waypoints_velocity: 5.0
6+
update_rate: 10.0
7+
th_arrived_distance_m: 1.0
8+
th_stopped_time_sec: 1.0
9+
th_stopped_velocity_mps: 0.01
10+
th_course_out_distance_m: 1.0
11+
replan_when_obstacle_found: true
12+
replan_when_course_out: true
13+
14+
# -- Configurations common to the all planners --
15+
# base configs
16+
time_limit: 30000.0
17+
minimum_turning_radius: 9.0
18+
maximum_turning_radius: 9.0
19+
turning_radius_size: 1
20+
# search configs
21+
theta_size: 144
22+
angle_goal_range: 6.0
23+
curve_weight: 1.2
24+
reverse_weight: 2.0
25+
lateral_goal_range: 0.5
26+
longitudinal_goal_range: 2.0
27+
# costmap configs
28+
obstacle_threshold: 100
29+
30+
# -- A* search Configurations --
31+
astar:
32+
only_behind_solutions: false
33+
use_back: true
34+
distance_heuristic_weight: 1.0
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,150 @@
1+
// Copyright 2020 Tier IV, Inc.
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+
/*
16+
* Copyright 2018-2019 Autoware Foundation. All rights reserved.
17+
*
18+
* Licensed under the Apache License, Version 2.0 (the "License");
19+
* you may not use this file except in compliance with the License.
20+
* You may obtain a copy of the License at
21+
*
22+
* http://www.apache.org/licenses/LICENSE-2.0
23+
*
24+
* Unless required by applicable law or agreed to in writing, software
25+
* distributed under the License is distributed on an "AS IS" BASIS,
26+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
27+
* See the License for the specific language governing permissions and
28+
* limitations under the License.
29+
*/
30+
31+
#ifndef FREESPACE_PLANNER__FREESPACE_PLANNER_NODE_HPP_
32+
#define FREESPACE_PLANNER__FREESPACE_PLANNER_NODE_HPP_
33+
34+
#include <freespace_planning_algorithms/astar_search.hpp>
35+
#include <rclcpp/rclcpp.hpp>
36+
#include <vehicle_info_util/vehicle_info_util.hpp>
37+
38+
#include <autoware_auto_planning_msgs/msg/had_map_route.hpp>
39+
#include <autoware_auto_planning_msgs/msg/trajectory.hpp>
40+
#include <autoware_planning_msgs/msg/scenario.hpp>
41+
#include <geometry_msgs/msg/twist.hpp>
42+
#include <nav_msgs/msg/occupancy_grid.hpp>
43+
#include <nav_msgs/msg/odometry.hpp>
44+
45+
#include <tf2_geometry_msgs/tf2_geometry_msgs.h>
46+
#include <tf2_ros/buffer.h>
47+
#include <tf2_ros/transform_listener.h>
48+
49+
#include <deque>
50+
#include <iostream>
51+
#include <memory>
52+
#include <string>
53+
#include <vector>
54+
55+
namespace freespace_planner
56+
{
57+
using autoware_auto_planning_msgs::msg::HADMapRoute;
58+
using autoware_auto_planning_msgs::msg::Trajectory;
59+
using autoware_planning_msgs::msg::Scenario;
60+
using freespace_planning_algorithms::AbstractPlanningAlgorithm;
61+
using freespace_planning_algorithms::AstarParam;
62+
using freespace_planning_algorithms::PlannerCommonParam;
63+
using geometry_msgs::msg::PoseArray;
64+
using geometry_msgs::msg::PoseStamped;
65+
using geometry_msgs::msg::TransformStamped;
66+
using geometry_msgs::msg::Twist;
67+
using nav_msgs::msg::OccupancyGrid;
68+
using nav_msgs::msg::Odometry;
69+
70+
struct NodeParam
71+
{
72+
std::string planning_algorithm;
73+
double waypoints_velocity; // constant velocity on planned waypoints [km/h]
74+
double update_rate; // replanning and publishing rate [Hz]
75+
double th_arrived_distance_m;
76+
double th_stopped_time_sec;
77+
double th_stopped_velocity_mps;
78+
double th_course_out_distance_m;
79+
bool replan_when_obstacle_found;
80+
bool replan_when_course_out;
81+
};
82+
83+
class FreespacePlannerNode : public rclcpp::Node
84+
{
85+
public:
86+
explicit FreespacePlannerNode(const rclcpp::NodeOptions & node_options);
87+
88+
private:
89+
// ros
90+
rclcpp::Publisher<Trajectory>::SharedPtr trajectory_pub_;
91+
rclcpp::Publisher<PoseArray>::SharedPtr debug_pose_array_pub_;
92+
rclcpp::Publisher<PoseArray>::SharedPtr debug_partial_pose_array_pub_;
93+
94+
rclcpp::Subscription<HADMapRoute>::SharedPtr route_sub_;
95+
rclcpp::Subscription<OccupancyGrid>::SharedPtr occupancy_grid_sub_;
96+
rclcpp::Subscription<Scenario>::SharedPtr scenario_sub_;
97+
rclcpp::Subscription<Odometry>::SharedPtr odom_sub_;
98+
99+
rclcpp::TimerBase::SharedPtr timer_;
100+
101+
std::shared_ptr<tf2_ros::Buffer> tf_buffer_;
102+
std::shared_ptr<tf2_ros::TransformListener> tf_listener_;
103+
104+
// params
105+
NodeParam node_param_;
106+
PlannerCommonParam planner_common_param_;
107+
AstarParam astar_param_;
108+
109+
// variables
110+
std::unique_ptr<AbstractPlanningAlgorithm> algo_;
111+
PoseStamped current_pose_;
112+
PoseStamped goal_pose_;
113+
114+
Trajectory trajectory_;
115+
Trajectory partial_trajectory_;
116+
std::vector<size_t> reversing_indices_;
117+
size_t prev_target_index_;
118+
size_t target_index_;
119+
bool is_completed_ = false;
120+
121+
HADMapRoute::ConstSharedPtr route_;
122+
OccupancyGrid::ConstSharedPtr occupancy_grid_;
123+
Scenario::ConstSharedPtr scenario_;
124+
Odometry::ConstSharedPtr odom_;
125+
126+
std::deque<Odometry::ConstSharedPtr> odom_buffer_;
127+
128+
// functions used in the constructor
129+
void getPlanningCommonParam();
130+
void getAstarParam();
131+
132+
// functions, callback
133+
void onRoute(const HADMapRoute::ConstSharedPtr msg);
134+
void onOccupancyGrid(const OccupancyGrid::ConstSharedPtr msg);
135+
void onScenario(const Scenario::ConstSharedPtr msg);
136+
void onOdometry(const Odometry::ConstSharedPtr msg);
137+
138+
void onTimer();
139+
140+
void reset();
141+
bool isPlanRequired();
142+
void planTrajectory();
143+
void updateTargetIndex();
144+
void initializePlanningAlgorithm();
145+
146+
TransformStamped getTransform(const std::string & from, const std::string & to);
147+
};
148+
} // namespace freespace_planner
149+
150+
#endif // FREESPACE_PLANNER__FREESPACE_PLANNER_NODE_HPP_
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<launch>
2+
<arg name="input_route" default="input_route"/>
3+
<arg name="input_occupancy_grid" default="input_occupancy_grid"/>
4+
<arg name="input_scenario" default="input_scenario"/>
5+
<arg name="input_odometry" default="/localization/kinematic_state" />
6+
<arg name="output_trajectory" default="output_trajectory"/>
7+
<arg name="is_completed" default="is_completed"/>
8+
9+
<arg name="param_file" default="$(find-pkg-share freespace_planner)/config/freespace_planner.param.yaml"/>
10+
11+
<node pkg="freespace_planner" exec="freespace_planner" name="freespace_planner" output="screen">
12+
<remap from="~/input/route" to="$(var input_route)" />
13+
<remap from="~/input/occupancy_grid" to="$(var input_occupancy_grid)" />
14+
<remap from="~/input/scenario" to="$(var input_scenario)" />
15+
<remap from="~/input/odometry" to="$(var input_odometry)" />
16+
<remap from="~/output/trajectory" to="$(var output_trajectory)" />
17+
<remap from="is_completed" to="$(var is_completed)" />
18+
<param from="$(var param_file)"/>
19+
</node>
20+
</launch>
+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<?xml version="1.0"?>
2+
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
3+
<package format="3">
4+
<name>freespace_planner</name>
5+
<version>0.1.0</version>
6+
<description>The freespace_planner package</description>
7+
<maintainer email="kenji.miyake@tier4.jp">Kenji Miyake</maintainer>
8+
<maintainer email="aohsato@gmail.com">Akihito OHSATO</maintainer>
9+
<license>Apache License 2.0</license>
10+
<author email="aohsato@gmail.com">Akihito OHSATO</author>
11+
<author email="antm678@ertl.jp">Tomohito ANDO</author>
12+
13+
<buildtool_depend>ament_cmake_auto</buildtool_depend>
14+
15+
<depend>autoware_auto_planning_msgs</depend>
16+
<depend>autoware_planning_msgs</depend>
17+
<depend>autoware_utils</depend>
18+
<depend>freespace_planning_algorithms</depend>
19+
<depend>geometry_msgs</depend>
20+
<depend>nav_msgs</depend>
21+
<depend>rclcpp</depend>
22+
<depend>rclcpp_components</depend>
23+
<depend>tf2</depend>
24+
<depend>tf2_geometry_msgs</depend>
25+
<depend>tf2_ros</depend>
26+
<depend>vehicle_info_util</depend>
27+
<depend>visualization_msgs</depend>
28+
29+
<test_depend>ament_lint_auto</test_depend>
30+
<test_depend>autoware_lint_common</test_depend>
31+
32+
<export>
33+
<build_type>ament_cmake</build_type>
34+
</export>
35+
</package>

0 commit comments

Comments
 (0)