Skip to content

Commit e406194

Browse files
authored
Merge pull request #16 from mlsdpk/feature-sampling-planner
Add minimal versions of RRT and RRT-Star
2 parents bd50919 + e21c8e4 commit e406194

File tree

27 files changed

+1466
-37
lines changed

27 files changed

+1466
-37
lines changed

.github/workflows/.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626
- name: Install Dependencies
2727
run: |
2828
sudo apt-get update
29-
sudo apt-get -y install libsfml-dev
29+
sudo apt-get -y install libsfml-dev libboost-all-dev
3030
3131
- name: Building
3232
run: |

CMakeLists.txt

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ include_directories(include/States/Algorithms/BFS)
1111
include_directories(include/States/Algorithms/DFS)
1212
include_directories(include/States/Algorithms/DIJKSTRA)
1313
include_directories(include/States/Algorithms/ASTAR)
14+
include_directories(include/States/Algorithms/RRT)
15+
include_directories(include/States/Algorithms/RRT_STAR)
1416

1517
set(EXECUTABLE_NAME "main")
1618

@@ -20,6 +22,7 @@ add_executable(${EXECUTABLE_NAME}
2022
src/State.cpp
2123
src/Gui.cpp
2224
src/States/Algorithms/Algorithm.cpp
25+
src/States/Algorithms/SamplingBased.cpp
2326
src/States/Algorithms/Node.cpp
2427
)
2528

@@ -43,18 +46,33 @@ add_library(astar
4346
src/States/Algorithms/ASTAR/ASTAR.cpp
4447
)
4548

49+
add_library(rrt
50+
src/States/Algorithms/RRT/RRT.cpp
51+
)
52+
53+
add_library(rrt_star
54+
src/States/Algorithms/RRT_STAR/RRT_STAR.cpp
55+
)
56+
4657
# Find any version 2.X of SFML
4758
find_package(SFML 2.5.1 COMPONENTS system window graphics network audio)
59+
find_package(Boost COMPONENTS system filesystem REQUIRED)
4860

49-
include_directories(${SFML_INCLUDE_DIRS})
61+
include_directories(${SFML_INCLUDE_DIRS} ${Boost_INCLUDE_DIR})
5062

5163
target_link_libraries(${EXECUTABLE_NAME}
64+
${Boost_LIBRARIES}
5265
sfml-graphics
5366
sfml-window
5467
sfml-system
68+
)
69+
70+
target_link_libraries(${EXECUTABLE_NAME}
5571
main_menu
5672
bfs
5773
dfs
5874
dijkstra
5975
astar
76+
rrt
77+
rrt_star
6078
)

README.md

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@
44

55
## Overview
66

7-
A tool for visualizing numerous pathfinding algorithms. Current implementation of the project involves four search-based planning algorithms: BFS, DFS, DIJKSTRA and A-Star. The project extensively uses SFML and Modern C++ features such as smart pointers, lamda expressions along with multi-threading concepts.
7+
A tool for visualizing numerous pathfinding algorithms.
8+
9+
Current implementation of the project involves four search-based planning algorithms: BFS, DFS, DIJKSTRA and A-Star, and two sampling-based planning algorithms: RRT and RRT*. The project extensively uses SFML and Modern C++ features such as smart pointers, lamda expressions along with multi-threading concepts.
810

911
![](figures/img1.gif)
1012

@@ -97,7 +99,25 @@ The exact name of the packages may vary from distribution to distribution. Once
9799

98100
## TODO
99101

102+
### Search-based planners
103+
- [x] BFS
104+
- [x] DFS
105+
- [x] DIJKSTRA
106+
- [x] A*
107+
- [ ] Bidirectional-A*
108+
- [ ] D*
109+
- [ ] LPA*
110+
100111
### Sampling-based planners
101-
- [ ] RRT
112+
- [x] RRT
102113
- [ ] RRT-Connect
103-
- [ ] RRT*
114+
- [x] RRT*
115+
- [ ] Informed-RRT*
116+
- [ ] FMT*
117+
- [ ] BIT*
118+
- [ ] ABIT*
119+
- [ ] AIT*
120+
121+
## Related Publications
122+
- [RRT](https://www.cs.csustan.edu/~xliang/Courses/CS4710-21S/Papers/06%20RRT.pdf): Rapidly-exploring random trees: A new tool for path planning
123+
- [RRT*](https://journals.sagepub.com/doi/abs/10.1177/0278364911406761): Sampling-based algorithms for optimal motion planning

config/algorithms.ini

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,5 @@ BFS
22
DFS
33
ASTAR
44
DIJKSTRA
5+
RRT
6+
RRT_STAR

config/rrt.ini

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
max_vertices: 2000
2+
delta_q: 0.05
3+
goal_radius: 0.1

config/rrt_star.ini

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
max_vertices: 2000
2+
delta_q: 0.05
3+
rewireFactor: 1.1
4+
maxDistance: 0.1
5+
goal_radius: 0.1

figures/img1.gif

-14.3 KB
Loading

include/Gui.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,7 @@ class DropDownList {
6262
public:
6363
// Constructor
6464
DropDownList(float x, float y, float width, float height, sf::Font* font,
65-
std::string text, const std::vector<std::string>& algo_vec,
66-
unsigned numOfElements, unsigned default_index = 0);
65+
std::string text, const std::vector<std::string>& algo_vec);
6766

6867
// Destructor
6968
~DropDownList();

include/States/Algorithms/ASTAR/ASTAR.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ class ASTAR : public Algorithm {
3737
void updateNodes() override;
3838

3939
// override render functions
40+
void renderBackground() override;
4041
void renderNodes() override;
4142

4243
// ASTAR algorithm function

include/States/Algorithms/Algorithm.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,14 +82,12 @@ class Algorithm : public State {
8282
void update(const float& dt) override;
8383
void render() override;
8484

85-
// New update functions
85+
// New update & render functions
8686
void updateButtons();
87-
88-
// New render functions
89-
void renderBackground();
9087
void renderButtons();
9188

9289
// virtual functions
90+
virtual void renderBackground() = 0;
9391
virtual void renderNodes() = 0;
9492
virtual void updateNodes() = 0;
9593
virtual void initAlgorithm() = 0;

0 commit comments

Comments
 (0)