Skip to content

Commit

Permalink
feat: add freespace_planner package (autowarefoundation#35)
Browse files Browse the repository at this point in the history
* 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 (autowarefoundation#28)

* port freespace plannet to ros2 (autowarefoundation#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 (autowarefoundation#75)

Signed-off-by: Takamasa Horibe <horibe.takamasa@gmail.com>

* Convert calls of Duration to Duration::from_seconds where appropriate (autowarefoundation#131)

* Rename h files to hpp (autowarefoundation#142)

* Change includes

* Rename files

* Adjustments to make things compile

* Other packages

* Adjust copyright notice on 532 out of 699 source files (autowarefoundation#143)

* Use quotes for includes where appropriate (autowarefoundation#144)

* Use quotes for includes where appropriate

* Fix lint tests

* Make tests pass hopefully

* Enable lints in freespace_planner (autowarefoundation#147)

* add missing declaration of parameter (autowarefoundation#233)

Signed-off-by: mitsudome-r <ryohsuke.mitsudome@tier4.jp>

* Fix typos in planning modules (autowarefoundation#866) (autowarefoundation#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 (autowarefoundation#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 (autowarefoundation#454)

* Make planning modules components (autowarefoundation#1263)

Signed-off-by: wep21 <border_goldenmarket@yahoo.co.jp>

* Remove use_sim_time for set_parameter (autowarefoundation#1260)

Signed-off-by: wep21 <border_goldenmarket@yahoo.co.jp>

* Rename AstarNavi to FreespacePlannerNode (autowarefoundation#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 (autowarefoundation#1290)

* update HA* for multiple curvatures (autowarefoundation#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 (autowarefoundation#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 (autowarefoundation#1564)

Signed-off-by: Kenji Miyake <kenji.miyake@tier4.jp>

* suppress warnings for declare parameters (autowarefoundation#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 (autowarefoundation#1736) (autowarefoundation#1737)

* Fix -Wunused-parameter (autowarefoundation#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 (autowarefoundation#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 (autowarefoundation#1693)

* Reedsshepp distance as a heuristic function in hybrid A star  (autowarefoundation#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  (autowarefoundation#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 (autowarefoundation#1572)

* Modular planner (autowarefoundation#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_  (autowarefoundation#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 (autowarefoundation#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 (autowarefoundation#1736)

* Fix package.xml (autowarefoundation#2056)

Signed-off-by: Kenji Miyake <kenji.miyake@tier4.jp>

* Change formatter to clang-format and black (autowarefoundation#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 (autowarefoundation#500)

Signed-off-by: Kenji Miyake <kenji.miyake@tier4.jp>

* rename topic name twist -> odometry (autowarefoundation#568)

Co-authored-by: Takayuki Murooka <takayuki.murooka@tier4.jp>

* Port parking planner packages from .Auto (autowarefoundation#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 (autowarefoundation#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>
  • Loading branch information
21 people authored Dec 6, 2021
1 parent 06d0dd5 commit 78bcdf1
Show file tree
Hide file tree
Showing 7 changed files with 929 additions and 0 deletions.
34 changes: 34 additions & 0 deletions planning/freespace_planner/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
cmake_minimum_required(VERSION 3.5)
project(freespace_planner)

if(NOT CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
endif()
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(-Wall -Wextra -Wpedantic -Werror)
endif()

find_package(ament_cmake_auto REQUIRED)
ament_auto_find_build_dependencies()

ament_auto_add_library(freespace_planner_node SHARED
src/freespace_planner/freespace_planner_node.cpp
)

rclcpp_components_register_node(freespace_planner_node
PLUGIN "freespace_planner::FreespacePlannerNode"
EXECUTABLE freespace_planner
)

if(BUILD_TESTING)
find_package(ament_lint_auto REQUIRED)
ament_lint_auto_find_test_dependencies()
endif()

ament_auto_package(
INSTALL_TO_SHARE
launch
config
)
119 changes: 119 additions & 0 deletions planning/freespace_planner/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
# The `freespace_planner`

## freespace_planner_node

`freespace_planner_node` is a global path planner node that plans trajectory
in the space having static/dynamic obstacles. This node is currently based on
Hybrid A\* search algorithm in `freespace_planning_algorithms` package.
Other algorithms such as rrt\* will be also added and selectable in the future.

**Note**
Due to the constraint of trajectory following, the output trajectory will be split to include only the single direction path.
In other words, the output trajectory doesn't include both forward and backward trajectories at once.

### Input topics

| Name | Type | Description |
| ----------------------- | ---------------------------------- | --------------------------------------------------------- |
| `~input/route` | autoware_auto_planning_msgs::Route | route and goal pose |
| `~input/occupancy_grid` | nav_msgs::OccupancyGrid | costmap, for drivable areas |
| `~input/odometry` | nav_msgs::Odometry | vehicle velocity, for checking whether vehicle is stopped |
| `~input/scenario` | autoware_planning_msgs::Scenario | scenarios to be activated, for node activation |

### Output topics

| Name | Type | Description |
| -------------------- | --------------------------------------- | ------------------------------------------ |
| `~output/trajectory` | autoware_auto_planning_msgs::Trajectory | trajectory to be followed |
| `is_completed` | bool (implemented as rosparam) | whether all split trajectory are published |

### Output TFs

None

### How to launch

1. Write your remapping info in `freespace_planner.launch` or add args when executing `roslaunch`
2. `roslaunch freespace_planner freespace_planner.launch`

### Parameters

#### Node parameters

| Parameter | Type | Description |
| ---------------------------- | ------ | ------------------------------------------------------------------------------- |
| `update_rate` | double | timer's update rate |
| `waypoints_velocity` | double | velocity in output trajectory (currently, only constant velocity is supported) |
| `th_arrived_distance_m` | double | threshold distance to check if vehicle has arrived at the trajectory's endpoint |
| `th_stopped_time_sec` | double | threshold time to check if vehicle is stopped |
| `th_stopped_velocity_mps` | double | threshold velocity to check if vehicle is stopped |
| `th_course_out_distance_m` | double | threshold distance to check if vehicle is out of course |
| `replan_when_obstacle_found` | bool | whether replanning when obstacle has found on the trajectory |
| `replan_when_course_out` | bool | whether replanning when vehicle is out of course |

#### Planner common parameters

| Parameter | Type | Description |
| ------------------------- | ------ | -------------------------------------------------- |
| `planning_algorithms` | string | algorithms used in the node |
| `time_limit` | double | time limit of planning |
| `robot_length` | double | robot length |
| `robot_width` | double | robot width |
| `robot_base2back` | double | distance from robot's back to robot's base_link |
| `minimum_turning_radius` | double | minimum turning radius of robot |
| `theta_size` | double | the number of angle's discretization |
| `lateral_goal_range` | double | goal range of lateral position |
| `longitudinal_goal_range` | double | goal range of longitudinal position |
| `angle_goal_range` | double | goal range of angle |
| `curve_weight` | double | additional cost factor for curve actions |
| `reverse_weight` | double | additional cost factor for reverse actions |
| `obstacle_threshold` | double | threshold for regarding a certain grid as obstacle |

#### A\* search parameters

| Parameter | Type | Description |
| --------------------------- | ------ | ------------------------------------------------------- |
| `only_behind_solutions` | bool | whether restricting the solutions to be behind the goal |
| `use_back` | bool | whether using backward trajectory |
| `distance_heuristic_weight` | double | heuristic weight for estimating node's cost |

### Flowchart

```plantuml
@startuml
title onTimer
start
if (all input data are ready?) then (yes)
else (no)
stop
endif
if (scenario is active?) then (yes)
else (no)
:reset internal data;
stop
endif
:get current pose;
if (replan is required?) then (yes)
:reset internal data;
:publish stop trajectory before planning new trajectory;
:plan new trajectory;
else (no)
endif
if (vehicle is stopped?) then (yes)
stop
else (no)
endif
:split trajectory\n(internally managing the state);
:publish trajectory;
stop
@enduml
```
34 changes: 34 additions & 0 deletions planning/freespace_planner/config/freespace_planner.param.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/**:
ros__parameters:
# -- Node Configurations --
planning_algorithm: "astar"
waypoints_velocity: 5.0
update_rate: 10.0
th_arrived_distance_m: 1.0
th_stopped_time_sec: 1.0
th_stopped_velocity_mps: 0.01
th_course_out_distance_m: 1.0
replan_when_obstacle_found: true
replan_when_course_out: true

# -- Configurations common to the all planners --
# base configs
time_limit: 30000.0
minimum_turning_radius: 9.0
maximum_turning_radius: 9.0
turning_radius_size: 1
# search configs
theta_size: 144
angle_goal_range: 6.0
curve_weight: 1.2
reverse_weight: 2.0
lateral_goal_range: 0.5
longitudinal_goal_range: 2.0
# costmap configs
obstacle_threshold: 100

# -- A* search Configurations --
astar:
only_behind_solutions: false
use_back: true
distance_heuristic_weight: 1.0
Original file line number Diff line number Diff line change
@@ -0,0 +1,150 @@
// Copyright 2020 Tier IV, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

/*
* Copyright 2018-2019 Autoware Foundation. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

#ifndef FREESPACE_PLANNER__FREESPACE_PLANNER_NODE_HPP_
#define FREESPACE_PLANNER__FREESPACE_PLANNER_NODE_HPP_

#include <freespace_planning_algorithms/astar_search.hpp>
#include <rclcpp/rclcpp.hpp>
#include <vehicle_info_util/vehicle_info_util.hpp>

#include <autoware_auto_planning_msgs/msg/had_map_route.hpp>
#include <autoware_auto_planning_msgs/msg/trajectory.hpp>
#include <autoware_planning_msgs/msg/scenario.hpp>
#include <geometry_msgs/msg/twist.hpp>
#include <nav_msgs/msg/occupancy_grid.hpp>
#include <nav_msgs/msg/odometry.hpp>

#include <tf2_geometry_msgs/tf2_geometry_msgs.h>
#include <tf2_ros/buffer.h>
#include <tf2_ros/transform_listener.h>

#include <deque>
#include <iostream>
#include <memory>
#include <string>
#include <vector>

namespace freespace_planner
{
using autoware_auto_planning_msgs::msg::HADMapRoute;
using autoware_auto_planning_msgs::msg::Trajectory;
using autoware_planning_msgs::msg::Scenario;
using freespace_planning_algorithms::AbstractPlanningAlgorithm;
using freespace_planning_algorithms::AstarParam;
using freespace_planning_algorithms::PlannerCommonParam;
using geometry_msgs::msg::PoseArray;
using geometry_msgs::msg::PoseStamped;
using geometry_msgs::msg::TransformStamped;
using geometry_msgs::msg::Twist;
using nav_msgs::msg::OccupancyGrid;
using nav_msgs::msg::Odometry;

struct NodeParam
{
std::string planning_algorithm;
double waypoints_velocity; // constant velocity on planned waypoints [km/h]
double update_rate; // replanning and publishing rate [Hz]
double th_arrived_distance_m;
double th_stopped_time_sec;
double th_stopped_velocity_mps;
double th_course_out_distance_m;
bool replan_when_obstacle_found;
bool replan_when_course_out;
};

class FreespacePlannerNode : public rclcpp::Node
{
public:
explicit FreespacePlannerNode(const rclcpp::NodeOptions & node_options);

private:
// ros
rclcpp::Publisher<Trajectory>::SharedPtr trajectory_pub_;
rclcpp::Publisher<PoseArray>::SharedPtr debug_pose_array_pub_;
rclcpp::Publisher<PoseArray>::SharedPtr debug_partial_pose_array_pub_;

rclcpp::Subscription<HADMapRoute>::SharedPtr route_sub_;
rclcpp::Subscription<OccupancyGrid>::SharedPtr occupancy_grid_sub_;
rclcpp::Subscription<Scenario>::SharedPtr scenario_sub_;
rclcpp::Subscription<Odometry>::SharedPtr odom_sub_;

rclcpp::TimerBase::SharedPtr timer_;

std::shared_ptr<tf2_ros::Buffer> tf_buffer_;
std::shared_ptr<tf2_ros::TransformListener> tf_listener_;

// params
NodeParam node_param_;
PlannerCommonParam planner_common_param_;
AstarParam astar_param_;

// variables
std::unique_ptr<AbstractPlanningAlgorithm> algo_;
PoseStamped current_pose_;
PoseStamped goal_pose_;

Trajectory trajectory_;
Trajectory partial_trajectory_;
std::vector<size_t> reversing_indices_;
size_t prev_target_index_;
size_t target_index_;
bool is_completed_ = false;

HADMapRoute::ConstSharedPtr route_;
OccupancyGrid::ConstSharedPtr occupancy_grid_;
Scenario::ConstSharedPtr scenario_;
Odometry::ConstSharedPtr odom_;

std::deque<Odometry::ConstSharedPtr> odom_buffer_;

// functions used in the constructor
void getPlanningCommonParam();
void getAstarParam();

// functions, callback
void onRoute(const HADMapRoute::ConstSharedPtr msg);
void onOccupancyGrid(const OccupancyGrid::ConstSharedPtr msg);
void onScenario(const Scenario::ConstSharedPtr msg);
void onOdometry(const Odometry::ConstSharedPtr msg);

void onTimer();

void reset();
bool isPlanRequired();
void planTrajectory();
void updateTargetIndex();
void initializePlanningAlgorithm();

TransformStamped getTransform(const std::string & from, const std::string & to);
};
} // namespace freespace_planner

#endif // FREESPACE_PLANNER__FREESPACE_PLANNER_NODE_HPP_
20 changes: 20 additions & 0 deletions planning/freespace_planner/launch/freespace_planner.launch.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<launch>
<arg name="input_route" default="input_route"/>
<arg name="input_occupancy_grid" default="input_occupancy_grid"/>
<arg name="input_scenario" default="input_scenario"/>
<arg name="input_odometry" default="/localization/kinematic_state" />
<arg name="output_trajectory" default="output_trajectory"/>
<arg name="is_completed" default="is_completed"/>

<arg name="param_file" default="$(find-pkg-share freespace_planner)/config/freespace_planner.param.yaml"/>

<node pkg="freespace_planner" exec="freespace_planner" name="freespace_planner" output="screen">
<remap from="~/input/route" to="$(var input_route)" />
<remap from="~/input/occupancy_grid" to="$(var input_occupancy_grid)" />
<remap from="~/input/scenario" to="$(var input_scenario)" />
<remap from="~/input/odometry" to="$(var input_odometry)" />
<remap from="~/output/trajectory" to="$(var output_trajectory)" />
<remap from="is_completed" to="$(var is_completed)" />
<param from="$(var param_file)"/>
</node>
</launch>
35 changes: 35 additions & 0 deletions planning/freespace_planner/package.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?xml version="1.0"?>
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
<package format="3">
<name>freespace_planner</name>
<version>0.1.0</version>
<description>The freespace_planner package</description>
<maintainer email="kenji.miyake@tier4.jp">Kenji Miyake</maintainer>
<maintainer email="aohsato@gmail.com">Akihito OHSATO</maintainer>
<license>Apache License 2.0</license>
<author email="aohsato@gmail.com">Akihito OHSATO</author>
<author email="antm678@ertl.jp">Tomohito ANDO</author>

<buildtool_depend>ament_cmake_auto</buildtool_depend>

<depend>autoware_auto_planning_msgs</depend>
<depend>autoware_planning_msgs</depend>
<depend>autoware_utils</depend>
<depend>freespace_planning_algorithms</depend>
<depend>geometry_msgs</depend>
<depend>nav_msgs</depend>
<depend>rclcpp</depend>
<depend>rclcpp_components</depend>
<depend>tf2</depend>
<depend>tf2_geometry_msgs</depend>
<depend>tf2_ros</depend>
<depend>vehicle_info_util</depend>
<depend>visualization_msgs</depend>

<test_depend>ament_lint_auto</test_depend>
<test_depend>autoware_lint_common</test_depend>

<export>
<build_type>ament_cmake</build_type>
</export>
</package>
Loading

0 comments on commit 78bcdf1

Please sign in to comment.