From 515cb8fcc5b7c914fad88beb23f7766e8848d76d Mon Sep 17 00:00:00 2001 From: Jiri Vlasak Date: Mon, 10 Dec 2018 10:30:25 +0100 Subject: [PATCH] Make `steer` procedure part of RRTBase --- CHANGELOG.md | 1 + CMakeLists.txt | 3 --- README.md | 11 ++++++----- base/rrtbase.cc | 5 +++++ decision_control/rrtplanner.cc | 13 ++++--------- incl/compile.h | 4 ---- incl/rrtbase.h | 1 + incl/rrtplanner.h | 26 -------------------------- 8 files changed, 17 insertions(+), 47 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 775ee3a..baf29d1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,7 @@ The format is based on [Keep a Changelog][] and this project adheres to - Make `cost` function part of RRTBase. - Make `nn` procedure part of RRTBase. - Make `nv` procedure part of RRTBase. +- Make `steer` procedure part of RRTBase. ## 0.3.0 - 2018-12-03 ### Added diff --git a/CMakeLists.txt b/CMakeLists.txt index aa86fb1..96a22ee 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,9 +7,6 @@ ENDIF(PLANNER) IF(TMAX) ADD_DEFINITIONS(-DTMAX=${TMAX}) ENDIF(TMAX) -IF(ST) - ADD_DEFINITIONS(-DST=${ST}) -ENDIF(ST) find_package(OpenMP) if (OPENMP_FOUND) diff --git a/README.md b/README.md index aad8cf6..2caf1fc 100644 --- a/README.md +++ b/README.md @@ -33,11 +33,12 @@ The list of available macros with values: - `Kuwata2008` - RRT with changing cost and steering to goal. - `Karaman2011` - RRT* framework. - `TMAX` - Specify the upper time bound in seconds. -- `ST` - - `st1` - Steer directly to goal. - - `st2` - Steer with maximum turning radius and direction in mind. - - `st3` - Reeds and Shepp steer procedure. - - `st4` - Very basic closed-loop simulator. + +Implemented Steering procedures: +- `st1` - Steer directly to goal. +- `st2` - Steer with maximum turning radius and direction in mind. +- `st3` - Reeds and Shepp steer procedure. +- `st4` - Very basic closed-loop simulator. To disable *OpenMP*, add `-DCMAKE_DISABLE_FIND_PACKAGE_OpenMP=TRUE` to `cmake` command or to `build.sh` script. diff --git a/base/rrtbase.cc b/base/rrtbase.cc index 47465c8..6719101 100644 --- a/base/rrtbase.cc +++ b/base/rrtbase.cc @@ -717,3 +717,8 @@ std::vector RRTBase::nv(RRTNode *node, float dist) } return nvs; } + +std::vector RRTBase::steer(RRTNode *init, RRTNode *goal) +{ + return st3(init, goal); +} diff --git a/decision_control/rrtplanner.cc b/decision_control/rrtplanner.cc index 1f8d63d..b1fa6e9 100644 --- a/decision_control/rrtplanner.cc +++ b/decision_control/rrtplanner.cc @@ -32,8 +32,7 @@ along with I am car. If not, see . #define KUWATA2008_DCOST CO LaValle1998::LaValle1998(RRTNode *init, RRTNode *goal): - RRTBase(init, goal), - steer(ST) + RRTBase(init, goal) { srand(static_cast(time(0))); } @@ -79,8 +78,7 @@ bool LaValle1998::next() } Kuwata2008::Kuwata2008(RRTNode *init, RRTNode *goal): - RRTBase(init, goal), - steer(ST) + RRTBase(init, goal) { srand(static_cast(time(0))); } @@ -166,8 +164,7 @@ bool Kuwata2008::next() } Karaman2011::Karaman2011(RRTNode *init, RRTNode *goal): - RRTBase(init, goal), - steer(ST) + RRTBase(init, goal) { srand(static_cast(time(0))); } @@ -284,8 +281,7 @@ bool Karaman2011::rewire(std::vector nvs, RRTNode *ns) } T1::T1(RRTNode *init, RRTNode *goal): - RRTBase(init, goal), - steer(ST) + RRTBase(init, goal) { srand(static_cast(time(0))); } @@ -583,7 +579,6 @@ bool T3::overlaptrees(RRTNode **ron, RRTNode **gon) Klemm2015::Klemm2015(RRTNode *init, RRTNode *goal): Karaman2011(init, goal), - steer(ST), orig_root_(init), orig_goal_(goal) { diff --git a/incl/compile.h b/incl/compile.h index 9843a1c..c32f63d 100644 --- a/incl/compile.h +++ b/incl/compile.h @@ -26,8 +26,4 @@ along with I am car. If not, see . #define TMAX 10 #endif -#ifndef ST -#define ST st1 -#endif - #endif diff --git a/incl/rrtbase.h b/incl/rrtbase.h index b183c59..961b626 100644 --- a/incl/rrtbase.h +++ b/incl/rrtbase.h @@ -105,6 +105,7 @@ class RRTBase { float cost(RRTNode *init, RRTNode *goal); RRTNode *nn(RRTNode *rs); std::vector nv(RRTNode *node, float dist); + std::vector steer(RRTNode *init, RRTNode *goal); // virtuals - implemented by child classes virtual bool next() = 0; diff --git a/incl/rrtplanner.h b/incl/rrtplanner.h index 63e8b33..824c153 100644 --- a/incl/rrtplanner.h +++ b/incl/rrtplanner.h @@ -28,22 +28,12 @@ class LaValle1998: public RRTBase { public: //using RRTBase::RRTBase; LaValle1998(RRTNode *init, RRTNode *goal); - - // RRT framework - std::vector (*steer)( - RRTNode *init, - RRTNode *goal); bool next(); }; class Kuwata2008: public RRTBase { public: Kuwata2008(RRTNode *init, RRTNode *goal); - - // RRT framework - std::vector (*steer)( - RRTNode *init, - RRTNode *goal); bool next(); }; @@ -56,29 +46,18 @@ class Karaman2011: public RRTBase { bool rewire(std::vector nvs, RRTNode *ns); public: Karaman2011(RRTNode *init, RRTNode *goal); - - // RRT framework - std::vector (*steer)( - RRTNode *init, - RRTNode *goal); bool next(); }; class T1: public RRTBase { public: T1(RRTNode *init, RRTNode *goal); - - // RRT framework - std::vector (*steer)( - RRTNode *init, - RRTNode *goal); bool next(); }; class T2: public Karaman2011 { public: using Karaman2011::Karaman2011; - bool next(); float goal_cost(); }; @@ -108,11 +87,6 @@ class Klemm2015: public Karaman2011 { void swap(); public: Klemm2015(RRTNode *init, RRTNode *goal); - - // RRT framework - std::vector (*steer)( - RRTNode *init, - RRTNode *goal); bool next(); }; -- 2.39.2