Installing ROS 2 on Windows — ROS 2 Documentation: Galactic documentation
安装ROS2基本上的流程都是按照上方链接ROS2的官方教程来操作,只不过在安装Qt5的时候,官方文档里面写的内容会造成之后运行海龟程序的时候出错。
根据官方教程,应该将QT_QPA_PLATFORM_PLUGIN_PATH设为Qt的安装路径下,如下所示:
set Qt5_DIR=C:\Qt\5.15.0\msvc2019_64
set QT_QPA_PLATFORM_PLUGIN_PATH=C:\Qt\5.15.0\msvc2019_64\plugins\platforms
可是在运行海龟程序的时候会出现如下报错,原因在于找不到qwindows.dll的路径。
qt.qpa.plugin: Could not find the Qt platform plugin "windows" in "" This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.
解决方法如下:将路径设为ROS2程序包内的platforms,内含qwindows.dll。
set QT_QPA_PLATFORM_PLUGIN_PATH=C:\dev\ros2_foxy\bin\platforms