蓝桥ROS扩展笔记CppRobotics编译

举报
zhangrelay 发表于 2022/07/31 00:50:25 2022/07/31
【摘要】 为了方便下载和使用,选用gitcode: git clone https://gitcode.net/ZhangRelay/cpp_robotics.git   解压缩: unzip cpp_robotics/CppRobotics.zip 编译常见过程: mkdir build cmake .. ...

为了方便下载和使用,选用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/ $             


  
  1. cmake_minimum_required(VERSION 3.1)
  2. project(CPP_ROBOTICS)
  3. set(CMAKE_CXX_STANDARD 11)
  4. # set(CMAKE_BUILD_TYPE Debug)
  5. set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin)
  6. set(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/lib)
  7. #############################
  8. #Dependencies
  9. #############################
  10. find_package(Eigen3 REQUIRED)
  11. find_package(OpenCV REQUIRED)
  12. include_directories(${EIGEN3_INCLUDE_DIR})
  13. include_directories(./include)
  14. #include_directories(/home/tai/Software/Ipopt-3.12.13/build/include)
  15. #link_directories(/home/tai/Software/Ipopt-3.12.13/build/lib)
  16. ##############################
  17. #Localization
  18. ##############################
  19. add_executable(ekf src/extended_kalman_filter.cpp)
  20. target_link_libraries(ekf ${OpenCV_LIBS} )
  21. add_executable(pf src/particle_filter.cpp)
  22. target_link_libraries(pf ${OpenCV_LIBS} )
  23. ##############################
  24. #PathPlanning
  25. ##############################
  26. add_executable(dijkstra src/dijkstra.cpp)
  27. target_link_libraries(dijkstra ${OpenCV_LIBS} )
  28. add_executable(astar src/a_star.cpp)
  29. target_link_libraries(astar ${OpenCV_LIBS} )
  30. add_executable(rrt src/rrt.cpp)
  31. target_link_libraries(rrt ${OpenCV_LIBS} )
  32. add_executable(rrtstar src/rrt_star.cpp)
  33. target_link_libraries(rrtstar ${OpenCV_LIBS} )
  34. add_executable(dwa src/dynamic_window_approach.cpp)
  35. target_link_libraries(dwa ${OpenCV_LIBS} )
  36. add_executable(mptg src/model_predictive_trajectory_generator.cpp)
  37. target_link_libraries(mptg ${OpenCV_LIBS})
  38. add_executable(slp src/state_lattice_planner.cpp)
  39. target_link_libraries(slp ${OpenCV_LIBS})
  40. add_executable(csp src/cubic_spline_planner.cpp)
  41. target_link_libraries(csp ${OpenCV_LIBS})
  42. add_executable(frenet src/frenet_optimal_trajectory.cpp)
  43. target_link_libraries(frenet ${OpenCV_LIBS})
  44. ##############################
  45. #PathTracking
  46. ##############################
  47. add_executable(lqr src/lqr_steer_control.cpp)
  48. target_link_libraries(lqr ${OpenCV_LIBS})
  49. add_executable(lqr_full src/lqr_speed_steer_control.cpp)
  50. target_link_libraries(lqr_full ${OpenCV_LIBS})
  51. #add_executable(mpc src/model_predictive_control.cpp)
  52. #target_link_libraries(mpc ${OpenCV_LIBS} ipopt)

 

文章来源: zhangrelay.blog.csdn.net,作者:zhangrelay,版权归原作者所有,如需转载,请联系作者。

原文链接:zhangrelay.blog.csdn.net/article/details/126065411

【版权声明】本文为华为云社区用户转载文章,如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱: cloudbbs@huaweicloud.com
  • 点赞
  • 收藏
  • 关注作者

评论(0

0/1000
抱歉,系统识别当前为高风险访问,暂不支持该操作

全部回复

上滑加载中

设置昵称

在此一键设置昵称,即可参与社区互动!

*长度不超过10个汉字或20个英文字符,设置后3个月内不可修改。

*长度不超过10个汉字或20个英文字符,设置后3个月内不可修改。