Skip to content

Commit

Permalink
add files for nmpc_cgmres.
Browse files Browse the repository at this point in the history
  • Loading branch information
mmurooka committed Mar 30, 2022
1 parent 890ca0b commit 79dec67
Show file tree
Hide file tree
Showing 19 changed files with 3,798 additions and 2 deletions.
46 changes: 46 additions & 0 deletions nmpc_cgmres/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
cmake_minimum_required(VERSION 3.1)
project(nmpc_cgmres)

add_compile_options(-std=c++17)

# Options
option(OPTIMIZE_FOR_NATIVE "Enable -march=native" OFF)

find_package(catkin REQUIRED COMPONENTS
roscpp
)

# Eigen
find_package(Eigen3 REQUIRED)
include_directories(${EIGEN3_INCLUDE_DIR})

catkin_package(
CATKIN_DEPENDS
roscpp
DEPENDS EIGEN3
INCLUDE_DIRS include
LIBRARIES nmpc_cgmres
)

add_library(nmpc_cgmres
src/CgmresSolver.cpp
)
target_include_directories(nmpc_cgmres PUBLIC
include
${catkin_INCLUDE_DIRS}
)
target_link_libraries(nmpc_cgmres PUBLIC
${catkin_LIBRARIES}
)
if(OPTIMIZE_FOR_NATIVE)
target_compile_options(nmpc_cgmres INTERFACE -march=native)
endif()

if(CATKIN_ENABLE_TESTING)
add_subdirectory(tests)
endif()

OPTION(INSTALL_DOCUMENTATION "Generate and install the documentation" OFF)
if(INSTALL_DOCUMENTATION)
add_subdirectory(doc)
endif()
28 changes: 28 additions & 0 deletions nmpc_cgmres/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# nmpc_cgmres
Non-linear model predictive control (NMPC) with continuation/GMRES method (C/GMRES)

[![CI](https://github.com/isri-aist/NMPC/actions/workflows/ci.yaml/badge.svg)](https://github.com/isri-aist/NMPC/actions/workflows/ci.yaml)
[![Documentation](https://img.shields.io/badge/doxygen-online-brightgreen?logo=read-the-docs&style=flat)](https://isri-aist.github.io/NMPC/nmpc_cgmres/index.html)

## Control method
See the following for a detailed algorithm.
- T Ohtsuka. Continuation/GMRES method for fast computation of nonlinear receding horizon control. Automatica. 2004.
- https://www.coronasha.co.jp/np/isbn/9784339033182/
- https://www.coronasha.co.jp/np/isbn/9784339032109/

## Examples
Make sure that it is built with `--catkin-make-args tests` option.

### Semiactive damper
```bash
$ rosrun nmpc_cgmres TestCgmresSolver --gtest_filter=*SemiactiveDamperProblem
$ rosrun nmpc_cgmres plotCgmresData.py
```
![TestSemiactiveDamperProblem](doc/images/TestSemiactiveDamperProblem.png)

### Cart-pole
```bash
$ rosrun nmpc_cgmres TestCgmresSolver --gtest_filter=*CartPoleProblem
$ rosrun nmpc_cgmres plotCgmresData.py
```
![TestCartPoleProblem](doc/images/TestCartPoleProblem.png)
13 changes: 13 additions & 0 deletions nmpc_cgmres/doc/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
find_package(Doxygen REQUIRED)

if(DOXYGEN_FOUND)
set(DOXYFILE_PATH ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile)

configure_file(Doxyfile.in ${DOXYFILE_PATH})

add_custom_target(nmpc_cgmres_doc ALL
${DOXYGEN_EXECUTABLE} ${DOXYFILE_PATH}
DEPENDS ${DOXYFILE_PATH}
COMMENT "Generating Doxygen documentation"
)
endif()
Loading

0 comments on commit 79dec67

Please sign in to comment.