Skip to content

Commit

Permalink
cmt-20240921-4: some format
Browse files Browse the repository at this point in the history
some format + edit readme
  • Loading branch information
nicewang committed Sep 20, 2024
1 parent 0e15ffc commit 1d9a6ee
Show file tree
Hide file tree
Showing 4 changed files with 103 additions and 12 deletions.
29 changes: 28 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -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)
* [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
```
31 changes: 22 additions & 9 deletions monte_carlo_tree_search/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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 $<TARGET_OBJECTS:mcts_objects>)

# clean
add_custom_target(clean_mcts
COMMAND ${CMAKE_COMMAND} -E remove_directory ${OBJDIR}
COMMAND ${CMAKE_COMMAND} -E remove ${CMAKE_BINARY_DIR}/mcts.so
)
29 changes: 28 additions & 1 deletion monte_carlo_tree_search/README.md
Original file line number Diff line number Diff line change
@@ -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
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
```
26 changes: 25 additions & 1 deletion rapidly_exploring_random_tree/README.md
Original file line number Diff line number Diff line change
@@ -1 +1,25 @@
## Rapidly Exploring Random Tree (RRT)
## 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
```

0 comments on commit 1d9a6ee

Please sign in to comment.