一、前言
网页链接
ROS 2 Documentation — ROS 2 Documentation: Galactic documentation ---ros2官网
https://download.qt.io/archive/qt/5.12/5.12.12/ ---Qt5.12.12下载
软件安利
DuangCloud (dc-site4.com),vpn上外网,github下载速度快,不限登录个数,相对来说还算划算
GitHub - diegostamigni/qmake2cmake: Convert QMake projects to CMake,免费开源软件,将qmake转化为cmake文件,算是对前期是否跨平台问题考虑不足的亡羊补牢
二、安装及使用
(一)安装及卸载
windows安装
(1)python -m pip install -U catkin_pkg cryptography empy ifcfg lark-parser lxml netifaces numpy opencv-python pyparsing pyyaml setuptools rosdistro ---使用pip安装一系列软件,可能会因为源文件失效而安装失败,可以从以下地址安装:
pip install colcon-common-extensions -i http://pypi.douban.com/simple/ --trusted-host pypi.douban.com ---colcon-common-extensions为需要安装的软件
(2)stderr: examples_rclcpp_multithreaded_executor CMake Error at CMakeLists.txt:13 (find_package): By not providing "Findament_cmake.cmake" in
CMAKE_MODULE_PATH this project has asked CMake to find a package configuration file provided by "ament_c //编译时错误,添加环境变量:
ament_cmake_DIR
C:\dev\ros2_foxy\share\ament_cmake\cmake\ament_cmakeConfig.cmake
(3)CMake Warning (dev) at C:/dev/ros2_foxy/share/connext_cmake_module/cmake/Modules/FindConnext.cmake:163 (list):
Policy CMP0121 is not set: The list() command now validates parsing of
index arguments. Run "cmake --help-policy CMP0121" for policy details.
Use the cmake_policy command to set the policy and suppress this warning.
Invalid list index "nddsc.lib". //cmake警告,需要在cmake文件中增加:
cmake_policy(SET CMP0121 OLD)
cmake文件:C:\dev\ros2_foxy\share\connext_cmake_module\cmake\Modules\FindConnext.cmake
(4)qt安装之后需要检查添加的环境变量:
QT_QPA_PLATFORM_PLUGIN_PATH
D:\SoftWare\Qt\5.12.12\msvc2017_64\plugins\platforms
Qt5_DIR
D:\SoftWare\Qt\5.12.12\msvc2017_64
windows卸载
卸载ros需要卸载cholocate及相关文件,否则重新安装软件,会提示软件已存在
linux安装
(1)linux各位大神研究的比较多,在网上找的一键安装
https://zhuanlan.zhihu.com/p/149187701
(2)rosdep update失败(这里使用大神鱼香ROS的国产化解决办法)
sudo pip install rosdepc ---使用rosdepc
如果显示没有pip可以试试pip3:
sudo pip3 install rosdepc
如果pip3还没有:
sudo apt-get install python3-pip
sudo rosdepc init
rosdepc update
(二)使用(适用于单节点,多节点参照ros2官网)
切换到ros2节点源文件
cd \dev\ros2_ws
调用ros2脚本
call C:\dev\ros2_galactic\local_setup.bat
生成ros节点
colcon build --merge-install --packages-select cpp_pubsub ----为生成的ros节点
获取安装文件
call install/setup.bat
生成可执行程序
ros2 run cpp_pubsub talker cpp_pubsub ---节点生成可执行程序talker