ROS2按照官网的办法安装好之后,
Installing ROS 2 on Windows — ROS 2 documentation: Galactic documentation
测试时碰到的问题
指令,
call C:devros2_galacticlocal_setup.bat ros2 run turtlesim turtlesim_node 或者 call C:devros2_galacticlocal_setup.bat ros2 run turtlesim turtle_teleop_key
报错,
qt.qpa.plugin: Could not find the Qt platform plugin "windows" in "C:Qt5.15.0msvc2019_64pluginsplatforms" This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.
这里说要你重装啊什么的,当然这不会有效果。
先说一下解决方案[ROS2 galactic windows] cannot start turtlesim - no Qt platform plugin could be initialized · Issue #126 · ros/ros_tutorials · GitHub
(1)
设置
QT_QPA_PLATFORM_PLUGIN_PATH =
C:Qtqt55.15.0msvc2019_64pluginsplatforms
然后把文件
C:devros2_galacticbinplatformsqwindows.dll
拷贝到
C:Qt5.15.0msvc2019_64pluginsplatformsqwindows.dll
(2)或者,
设置
QT_QPA_PLATFORM_PLUGIN_PATH =
C:devros2_galacticbinplatforms
原因分析操作系统上存在多个qdinwos.dll,只有galactic下面那个是和ROS一起编译生成的;QT下面那个是windows下通用的链接库,但不包含一系列ROS需要的调用函数。
悲催的是ROS并没有在其正式的文档中对该差别进行说明,只是在安装时说要设置,
set Qt5_DIR=C:Qt5.15.0msvc2019_64 set QT_QPA_PLATFORM_PLUGIN_PATH=C:Qt5.15.0msvc2019_64pluginsplatforms
大家按官方的路走,是导致出错的最主要原因。
晒两张图,使用的分析工具是 [dependencies.exe]
这个是QT5自带的,和ROS不兼容的,
这个是ROSt自带的,
本文结束



