蓝桥ROS扩展笔记CppRobotics编译
Posted zhangrelay
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了蓝桥ROS扩展笔记CppRobotics编译相关的知识,希望对你有一定的参考价值。
为了方便下载和使用,选用gitcode:
git clone https://gitcode.net/ZhangRelay/cpp_robotics.git
解压缩:
unzip cpp_robotics/CppRobotics.zip
编译常见过程:
mkdir build
cmake ..
make
一次成功^_^
选个A*看看效果?
# 目录
* [定位](#localization)
* [扩展卡尔曼滤波器](#extended-kalman-filter-localization)
* [粒子过滤器](#particle-filter-localization)
* 直方图过滤器
* [建图](#mapping)
* 高斯网格图
* [SLAM](#SLAM)
* 快速SLAM 1.0
* [路径规划](#path-planning)
* [Dijkstra](#dijkstra)
* [A*](#a-star)
* [RRT](#rrt)
* [动态窗口方法](#dynamic-window-approach)
* [模型预测轨迹生成器](#model-predictive-trajectory-generator)
* [三次样条规划器](#cubic-spline-planner)
* [状态格规划器](#state-lattice-planner)
* [Frenet 帧轨迹](#frenet-frame-trajectory)
* [路径跟踪控制](#path-tracking-control)
* [LQR 转向控制](#lqr-steering-control)
* [LQR 速度和转向控制](#lqr-speed-and-steering-control)
* [模型预测速度和转向控制](#mpc-speed-and-steering-control)
* [空中导航](#aerial-navigation)
*无人机3D轨迹跟踪
*火箭动力着陆
附编译过程:
shiyanlou:CppRobotics-master/ $ cd build [22:54:56]
shiyanlou:build/ $ cmake .. [22:55:02]
-- The C compiler identification is GNU 5.4.0
-- The CXX compiler identification is GNU 5.4.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found OpenCV: /opt/ros/kinetic (found version "3.3.1")
-- Configuring done
-- Generating done
-- Build files have been written to: /home/shiyanlou/CppRobotics-master/build
shiyanlou:build/ $ make [22:55:09]
Scanning dependencies of target lqr
[ 3%] Building CXX object CMakeFiles/lqr.dir/src/lqr_steer_control.cpp.o
[ 7%] Linking CXX executable ../bin/lqr
[ 7%] Built target lqr
Scanning dependencies of target astar
[ 11%] Building CXX object CMakeFiles/astar.dir/src/a_star.cpp.o
[ 15%] Linking CXX executable ../bin/astar
[ 15%] Built target astar
Scanning dependencies of target ekf
[ 19%] Building CXX object CMakeFiles/ekf.dir/src/extended_kalman_filter.cpp.o
[ 23%] Linking CXX executable ../bin/ekf
[ 23%] Built target ekf
Scanning dependencies of target mptg
[ 26%] Building CXX object CMakeFiles/mptg.dir/src/model_predictive_trajectory_generator.cpp.o
In file included from /home/shiyanlou/CppRobotics-master/src/model_predictive_trajectory_generator.cpp:16:0:
/home/shiyanlou/CppRobotics-master/./include/trajectory_optimizer.h: In member function \\u2018cpprobotics::TrajState cpprobotics::TrajectoryOptimizer::calc_diff(cpprobotics::TrajState)\\u2019:
/home/shiyanlou/CppRobotics-master/./include/motion_model.h:18:81: warning: narrowing conversion of \\u2018(fmod((fmod((((double)yaw_) + 3.1415926535897931e+0), 6.2831853071795862e+0) - 6.2831853071795862e+0), 6.2831853071795862e+0) + 3.1415926535897931e+0)\\u2019 from \\u2018double\\u2019 to \\u2018float\\u2019 inside [-Wnarrowing]
e YAW_P2P(angle) std::fmod(std::fmod((angle)+M_PI, 2*M_PI)-2*M_PI, 2*M_PI)+M_PI
^
/home/shiyanlou/CppRobotics-master/./include/trajectory_optimizer.h:134:11: note: in expansion of macro \\u2018YAW_P2P\\u2019
YAW_P2P(yaw_);
^
[ 30%] Linking CXX executable ../bin/mptg
[ 30%] Built target mptg
Scanning dependencies of target pf
[ 34%] Building CXX object CMakeFiles/pf.dir/src/particle_filter.cpp.o
[ 38%] Linking CXX executable ../bin/pf
[ 38%] Built target pf
Scanning dependencies of target dijkstra
[ 42%] Building CXX object CMakeFiles/dijkstra.dir/src/dijkstra.cpp.o
[ 46%] Linking CXX executable ../bin/dijkstra
[ 46%] Built target dijkstra
Scanning dependencies of target rrt
[ 50%] Building CXX object CMakeFiles/rrt.dir/src/rrt.cpp.o
[ 53%] Linking CXX executable ../bin/rrt
[ 53%] Built target rrt
Scanning dependencies of target rrtstar
[ 57%] Building CXX object CMakeFiles/rrtstar.dir/src/rrt_star.cpp.o
[ 61%] Linking CXX executable ../bin/rrtstar
[ 61%] Built target rrtstar
Scanning dependencies of target frenet
[ 65%] Building CXX object CMakeFiles/frenet.dir/src/frenet_optimal_trajectory.cpp.o
[ 69%] Linking CXX executable ../bin/frenet
[ 69%] Built target frenet
Scanning dependencies of target dwa
[ 73%] Building CXX object CMakeFiles/dwa.dir/src/dynamic_window_approach.cpp.o
[ 76%] Linking CXX executable ../bin/dwa
[ 76%] Built target dwa
Scanning dependencies of target lqr_full
[ 80%] Building CXX object CMakeFiles/lqr_full.dir/src/lqr_speed_steer_control.cpp.o
[ 84%] Linking CXX executable ../bin/lqr_full
[ 84%] Built target lqr_full
Scanning dependencies of target slp
[ 88%] Building CXX object CMakeFiles/slp.dir/src/state_lattice_planner.cpp.o
In file included from /home/shiyanlou/CppRobotics-master/src/state_lattice_planner.cpp:19:0:
/home/shiyanlou/CppRobotics-master/./include/trajectory_optimizer.h: In member function \\u2018cpprobotics::TrajState cpprobotics::TrajectoryOptimizer::calc_diff(cpprobotics::TrajState)\\u2019:
/home/shiyanlou/CppRobotics-master/./include/motion_model.h:18:81: warning: narrowing conversion of \\u2018(fmod((fmod((((double)yaw_) + 3.1415926535897931e+0), 6.2831853071795862e+0) - 6.2831853071795862e+0), 6.2831853071795862e+0) + 3.1415926535897931e+0)\\u2019 from \\u2018double\\u2019 to \\u2018float\\u2019 inside [-Wnarrowing]
e YAW_P2P(angle) std::fmod(std::fmod((angle)+M_PI, 2*M_PI)-2*M_PI, 2*M_PI)+M_PI
^
/home/shiyanlou/CppRobotics-master/./include/trajectory_optimizer.h:134:11: note: in expansion of macro \\u2018YAW_P2P\\u2019
YAW_P2P(yaw_);
^
[ 92%] Linking CXX executable ../bin/slp
[ 92%] Built target slp
Scanning dependencies of target csp
[ 96%] Building CXX object CMakeFiles/csp.dir/src/cubic_spline_planner.cpp.o
[100%] Linking CXX executable ../bin/csp
[100%] Built target csp
shiyanlou:build/ $
cmake_minimum_required(VERSION 3.1)
project(CPP_ROBOTICS)
set(CMAKE_CXX_STANDARD 11)
# set(CMAKE_BUILD_TYPE Debug)
set(EXECUTABLE_OUTPUT_PATH $PROJECT_SOURCE_DIR/bin)
set(LIBRARY_OUTPUT_PATH $PROJECT_SOURCE_DIR/lib)
#############################
#Dependencies
#############################
find_package(Eigen3 REQUIRED)
find_package(OpenCV REQUIRED)
include_directories($EIGEN3_INCLUDE_DIR)
include_directories(./include)
#include_directories(/home/tai/Software/Ipopt-3.12.13/build/include)
#link_directories(/home/tai/Software/Ipopt-3.12.13/build/lib)
##############################
#Localization
##############################
add_executable(ekf src/extended_kalman_filter.cpp)
target_link_libraries(ekf $OpenCV_LIBS )
add_executable(pf src/particle_filter.cpp)
target_link_libraries(pf $OpenCV_LIBS )
##############################
#PathPlanning
##############################
add_executable(dijkstra src/dijkstra.cpp)
target_link_libraries(dijkstra $OpenCV_LIBS )
add_executable(astar src/a_star.cpp)
target_link_libraries(astar $OpenCV_LIBS )
add_executable(rrt src/rrt.cpp)
target_link_libraries(rrt $OpenCV_LIBS )
add_executable(rrtstar src/rrt_star.cpp)
target_link_libraries(rrtstar $OpenCV_LIBS )
add_executable(dwa src/dynamic_window_approach.cpp)
target_link_libraries(dwa $OpenCV_LIBS )
add_executable(mptg src/model_predictive_trajectory_generator.cpp)
target_link_libraries(mptg $OpenCV_LIBS)
add_executable(slp src/state_lattice_planner.cpp)
target_link_libraries(slp $OpenCV_LIBS)
add_executable(csp src/cubic_spline_planner.cpp)
target_link_libraries(csp $OpenCV_LIBS)
add_executable(frenet src/frenet_optimal_trajectory.cpp)
target_link_libraries(frenet $OpenCV_LIBS)
##############################
#PathTracking
##############################
add_executable(lqr src/lqr_steer_control.cpp)
target_link_libraries(lqr $OpenCV_LIBS)
add_executable(lqr_full src/lqr_speed_steer_control.cpp)
target_link_libraries(lqr_full $OpenCV_LIBS)
#add_executable(mpc src/model_predictive_control.cpp)
#target_link_libraries(mpc $OpenCV_LIBS ipopt)
以上是关于蓝桥ROS扩展笔记CppRobotics编译的主要内容,如果未能解决你的问题,请参考以下文章
ROS1云课→20迷宫不惑之A*大法(一种虽古老但实用全局路径规划算法)
ROS1云课→20迷宫不惑之A*大法(一种虽古老但实用全局路径规划算法)