ROS2按照官网的办法安装好之后,
Installing ROS 2 on Windows — ROS 2 Documentation: Galactic documentation
测试时碰到的问题
指令,
call C:\dev\ros2_galactic\local_setup.bat
ros2 run turtlesim turtlesim_node
或者
call C:\dev\ros2_galactic\local_setup.bat
ros2 run turtlesim turtle_teleop_key
报错,
qt.qpa.plugin: Could not find the Qt platform plugin "windows" in "C:\Qt\5.15.0\msvc2019_64\plugins\platforms"
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:\Qt\qt5\5.15.0\msvc2019_64\plugins\platforms
然后把文件
C:\dev\ros2_galactic\bin\platforms\qwindows.dll
拷贝到
C:\Qt\5.15.0\msvc2019_64\plugins\platforms\qwindows.dll
(2)或者,
设置
QT_QPA_PLATFORM_PLUGIN_PATH =
C:\dev\ros2_galactic\bin\platforms\
原因分析操作系统上存在多个qdinwos.dll,只有galactic下面那个是和ROS一起编译生成的;QT下面那个是windows下通用的链接库,但不包含一系列ROS需要的调用函数。
悲催的是ROS并没有在其正式的文档中对该差别进行说明,只是在安装时说要设置,
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
大家按官方的路走,是导致出错的最主要原因。
晒两张图,使用的分析工具是 [dependencies.exe]
这个是QT5自带的,和ROS不兼容的,
这个是ROSt自带的,
本文结束