From 1d9a6ee8e2ef7c919cac91a273ee3592cd25b92f Mon Sep 17 00:00:00 2001 From: nicewang <15051965381@163.com> Date: Sat, 21 Sep 2024 04:33:45 +0800 Subject: [PATCH] cmt-20240921-4: some format some format + edit readme --- README.md | 29 ++++++++++++++++++++++- monte_carlo_tree_search/CMakeLists.txt | 31 ++++++++++++++++++------- monte_carlo_tree_search/README.md | 29 ++++++++++++++++++++++- rapidly_exploring_random_tree/README.md | 26 ++++++++++++++++++++- 4 files changed, 103 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index c7b6337..fdb117d 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,30 @@ ## Robot Path Planning * [Monte Carlo Tree Search](monte_carlo_tree_search/README.md) -* [Rapidly Exploring Random Tree (RRT)](rapidly_exploring_random_tree/README.md) \ No newline at end of file +* [Rapidly Exploring Random Tree (RRT)](rapidly_exploring_random_tree/README.md) + +### Appendix: Build & Run +`CMakeList.txt` mainly for github workflows' building process. + +If you want to build manually using `CMakeList.txt`, use following commands: + +```shell +# build +mkdir build && cd build +cmake .. +make +``` + +Run: + +```shell +# mcts +./monte_carlo_tree_search/mcts.so +# rrt +./rapidly_exploring_random_tree/rrt.so +``` + +Clean: + +```shell +make clean +``` \ No newline at end of file diff --git a/monte_carlo_tree_search/CMakeLists.txt b/monte_carlo_tree_search/CMakeLists.txt index e5634ed..533f88b 100644 --- a/monte_carlo_tree_search/CMakeLists.txt +++ b/monte_carlo_tree_search/CMakeLists.txt @@ -29,20 +29,33 @@ add_compile_definitions( CONFIG_C=${CONFIG_C} ) -# source -set(SRC - src/main.cpp - src/mcts.cpp - src/state.cpp +# Set dir of include, src and obj +set(INCDIR ${CMAKE_SOURCE_DIR}/include) +set(SRCDIR ${CMAKE_SOURCE_DIR}/src) +set(OBJDIR ${CMAKE_BINARY_DIR}/obj) + +# Set obj files and src files +set(SRCFILES ${CMAKE_CURRENT_LIST_DIR}/src/state.cpp ${CMAKE_CURRENT_LIST_DIR}/src/mcts.cpp ${CMAKE_CURRENT_LIST_DIR}/src/main.cpp) +set(OBJFILES ${OBJDIR}/mcts.o ${OBJDIR}/main.o) + +# Include Dir +include_directories(${INCDIR}) + +# Add an object library to control the generation of object files +add_library(mcts_objects OBJECT ${SRCFILES}) + +# Set the output directory to the obj folder +set_target_properties(mcts_objects PROPERTIES + ARCHIVE_OUTPUT_DIRECTORY ${OBJDIR} + LIBRARY_OUTPUT_DIRECTORY ${OBJDIR} + RUNTIME_OUTPUT_DIRECTORY ${OBJDIR} ) -# header -include_directories(include) - # executable file -add_executable(mcts.so ${SRC}) +add_executable(mcts.so $) # clean add_custom_target(clean_mcts + COMMAND ${CMAKE_COMMAND} -E remove_directory ${OBJDIR} COMMAND ${CMAKE_COMMAND} -E remove ${CMAKE_BINARY_DIR}/mcts.so ) diff --git a/monte_carlo_tree_search/README.md b/monte_carlo_tree_search/README.md index 8f494fc..2bafffe 100644 --- a/monte_carlo_tree_search/README.md +++ b/monte_carlo_tree_search/README.md @@ -1,6 +1,33 @@ ## Monte Carlo Tree Search ### Background: Algorithm Framework +[Original Paper](paper/CG2006.pdf) + +Algorithm Main Steps: + 1. Selection 2. Expansion 3. Simulation / Rollout -4. Backpropagation \ No newline at end of file +4. Backpropagation + +### Appendix: Build & Run +`CMakeList.txt` mainly for github workflows' building process. + +If you want to build manually, use `Makefile` there. + +* Build + +```shell +make +``` + +* Run: + +```shell +./mcts.so +``` + +* Clean: + +```shell +make clean +``` \ No newline at end of file diff --git a/rapidly_exploring_random_tree/README.md b/rapidly_exploring_random_tree/README.md index c11a271..b7cfe74 100644 --- a/rapidly_exploring_random_tree/README.md +++ b/rapidly_exploring_random_tree/README.md @@ -1 +1,25 @@ -## Rapidly Exploring Random Tree (RRT) \ No newline at end of file +## Rapidly Exploring Random Tree (RRT) +[Original Paper](paper/Lav98c.pdf) + +### Appendix: Build & Run +`CMakeList.txt` mainly for github workflows' building process. + +If you want to build manually, use `Makefile` there. + +* Build + +```shell +make +``` + +* Run: + +```shell +./rrt.so +``` + +* Clean: + +```shell +make clean +``` \ No newline at end of file