Skip to content

Implementation of Common Planning and Control Algorithms in C++

Notifications You must be signed in to change notification settings

Wai-Ngai/PnC_CPP

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

自动驾驶决策规划控制c++代码实现

本项目根据原项目进行重构和重写,旨在学习C++语法和规控算法。

原项目地址,理论知识参考原项目博客.

python代码实现参考github仓库 .

推荐结合博客内容来看代码实现。

1. 项目依赖

本项目在Ubuntu 20.04下运行,windows下尚未尝试过,因此推荐使用Ubuntu系统。

- python3
- matplotlib
- cmake
- Eigen
- Osqp
- CPPAD
- Ipopt

1.1 cmake的安装直接终端运行

sudo apt install cmake

如果在项目编译时报cmake版本低的错误,可参考该 博客 升级cmake。对cmake操作不不够熟悉的同学可以先参考文档 学习。

1.2 Eigen在Linux下的安装直接使用命令

sudo apt-get install libeigen3-dev

解决 fatal error: Eigen/Core: No such file or directory

当调用 eigen 库时,会报错:fatal error: Eigen/Core: No such file or directory

这是因为 eigen 库默认安装在了 /usr/include/eigen3/Eigen 路径下,需使用下面命令映射到 /usr/include 路径下:

sudo ln -s /usr/include/eigen3/Eigen /usr/include/Eigen

Eigen库采用模板编程技术,仅由一些头文件组成,运行速度快。用cmake管理项目的时候,只需要在CMakeLists.txt里面添加头文件的路径即可:

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

Eigen库的学习除了官网 之外,还可以参考这篇博客

1.3 matplotlib安装

画图代码采用了c++ 调用python的matplotlib的方式,所以需要使用 pip的方式安装matplotlib,具体使用方式参考说明文档 。 这边直接移植了该功能。

pip3 install matplotlib

1.4 CPPAD/Ipopt安装

MPC代码使用了CPPAD/Ipopt优化库,如果要进行MPC的测试,需要安装CPPAD/ipopt。安装方式可参考博客

1.5 osqp_eigne安装

osqp_eigne参考博客

2. 项目编译

在项目主目录下,编译:

mkdir build
cd build
cmake ../
make

3. 路径规划

4. 决策控制

5. 预测

About

Implementation of Common Planning and Control Algorithms in C++

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published