Skip to content

Commit 1d9a6ee

Browse files
committed
cmt-20240921-4: some format
some format + edit readme
1 parent 0e15ffc commit 1d9a6ee

File tree

4 files changed

+103
-12
lines changed

4 files changed

+103
-12
lines changed

README.md

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,30 @@
11
## Robot Path Planning
22
* [Monte Carlo Tree Search](monte_carlo_tree_search/README.md)
3-
* [Rapidly Exploring Random Tree (RRT)](rapidly_exploring_random_tree/README.md)
3+
* [Rapidly Exploring Random Tree (RRT)](rapidly_exploring_random_tree/README.md)
4+
5+
### Appendix: Build & Run
6+
`CMakeList.txt` mainly for github workflows' building process.
7+
8+
If you want to build manually using `CMakeList.txt`, use following commands:
9+
10+
```shell
11+
# build
12+
mkdir build && cd build
13+
cmake ..
14+
make
15+
```
16+
17+
Run:
18+
19+
```shell
20+
# mcts
21+
./monte_carlo_tree_search/mcts.so
22+
# rrt
23+
./rapidly_exploring_random_tree/rrt.so
24+
```
25+
26+
Clean:
27+
28+
```shell
29+
make clean
30+
```

monte_carlo_tree_search/CMakeLists.txt

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,20 +29,33 @@ add_compile_definitions(
2929
CONFIG_C=${CONFIG_C}
3030
)
3131

32-
# source
33-
set(SRC
34-
src/main.cpp
35-
src/mcts.cpp
36-
src/state.cpp
32+
# Set dir of include, src and obj
33+
set(INCDIR ${CMAKE_SOURCE_DIR}/include)
34+
set(SRCDIR ${CMAKE_SOURCE_DIR}/src)
35+
set(OBJDIR ${CMAKE_BINARY_DIR}/obj)
36+
37+
# Set obj files and src files
38+
set(SRCFILES ${CMAKE_CURRENT_LIST_DIR}/src/state.cpp ${CMAKE_CURRENT_LIST_DIR}/src/mcts.cpp ${CMAKE_CURRENT_LIST_DIR}/src/main.cpp)
39+
set(OBJFILES ${OBJDIR}/mcts.o ${OBJDIR}/main.o)
40+
41+
# Include Dir
42+
include_directories(${INCDIR})
43+
44+
# Add an object library to control the generation of object files
45+
add_library(mcts_objects OBJECT ${SRCFILES})
46+
47+
# Set the output directory to the obj folder
48+
set_target_properties(mcts_objects PROPERTIES
49+
ARCHIVE_OUTPUT_DIRECTORY ${OBJDIR}
50+
LIBRARY_OUTPUT_DIRECTORY ${OBJDIR}
51+
RUNTIME_OUTPUT_DIRECTORY ${OBJDIR}
3752
)
3853

39-
# header
40-
include_directories(include)
41-
4254
# executable file
43-
add_executable(mcts.so ${SRC})
55+
add_executable(mcts.so $<TARGET_OBJECTS:mcts_objects>)
4456

4557
# clean
4658
add_custom_target(clean_mcts
59+
COMMAND ${CMAKE_COMMAND} -E remove_directory ${OBJDIR}
4760
COMMAND ${CMAKE_COMMAND} -E remove ${CMAKE_BINARY_DIR}/mcts.so
4861
)

monte_carlo_tree_search/README.md

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,33 @@
11
## Monte Carlo Tree Search
22
### Background: Algorithm Framework
3+
[Original Paper](paper/CG2006.pdf)
4+
5+
Algorithm Main Steps:
6+
37
1. Selection
48
2. Expansion
59
3. Simulation / Rollout
6-
4. Backpropagation
10+
4. Backpropagation
11+
12+
### Appendix: Build & Run
13+
`CMakeList.txt` mainly for github workflows' building process.
14+
15+
If you want to build manually, use `Makefile` there.
16+
17+
* Build
18+
19+
```shell
20+
make
21+
```
22+
23+
* Run:
24+
25+
```shell
26+
./mcts.so
27+
```
28+
29+
* Clean:
30+
31+
```shell
32+
make clean
33+
```
Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,25 @@
1-
## Rapidly Exploring Random Tree (RRT)
1+
## Rapidly Exploring Random Tree (RRT)
2+
[Original Paper](paper/Lav98c.pdf)
3+
4+
### Appendix: Build & Run
5+
`CMakeList.txt` mainly for github workflows' building process.
6+
7+
If you want to build manually, use `Makefile` there.
8+
9+
* Build
10+
11+
```shell
12+
make
13+
```
14+
15+
* Run:
16+
17+
```shell
18+
./rrt.so
19+
```
20+
21+
* Clean:
22+
23+
```shell
24+
make clean
25+
```

0 commit comments

Comments
 (0)