宁波建设银行网站分部,课程网站建设课程,网站维护 上海,做出个人网站什么水平这里写目录标题 docker中使用ros2humble的rviz2不显示问题删除 Docker 镜像和容器删除 Docker 容器Linux服务器下查看系统CPU个数、核心数、(make编译最大的)线程数总结#xff1a; RVIZ2 不能显示数据集 docker中使用ros2humble的rviz2不显示问题
问题描述#xff1a;
roo… 这里写目录标题 docker中使用ros2humble的rviz2不显示问题删除 Docker 镜像和容器删除 Docker 容器Linux服务器下查看系统CPU个数、核心数、(make编译最大的)线程数总结 RVIZ2 不能显示数据集 docker中使用ros2humble的rviz2不显示问题
问题描述
root9f20405a1baf:/# rviz2
qt.qpa.xcb: could not connect to display
qt.qpa.plugin: Could not load the Qt platform plugin xcb in even though it was found.
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.Available platform plugins are: eglfs, linuxfb, minimal, minimalegl, offscreen, vnc, xcb.Aborted (core dumped)解答 通过export QT_DEBUG_PLUGINS1查看问题的具体显示输出问题的内容形式如下
root020b7a1aa6d4:/fastlio2# rviz2
qt.qpa.xcb: could not connect to display
qt.qpa.plugin: Could not load the Qt platform plugin xcb in even though it was found.
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.Available platform plugins are: eglfs, linuxfb, minimal, minimalegl, offscreen, vnc, xcb.Aborted (core dumped)
root020b7a1aa6d4:/fastlio2# cd ..
root020b7a1aa6d4:/# export QT_DEBUG_PLUGINS1
root020b7a1aa6d4:/# ros2 run rivz2 rivz2
Package rivz2 not found
root020b7a1aa6d4:/# ros2 run rviz2 rivz2
No executable found
root020b7a1aa6d4:/# ros2 run rviz2 rviz2
QFactoryLoader::QFactoryLoader() checking directory path /usr/lib/x86_64-linux-gnu/qt5/plugins/platforms ...
QFactoryLoader::QFactoryLoader() looking at /usr/lib/x86_64-linux-gnu/qt5/plugins/platforms/libqeglfs.so
Found metadata in lib /usr/lib/x86_64-linux-gnu/qt5/plugins/platforms/libqeglfs.so, metadata
{IID: org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3,MetaData: {Keys: [eglfs]},archreq: 0,className: QEglFSIntegrationPlugin,debug: false,version: 331520
}Got keys from plugin meta data (eglfs)
QFactoryLoader::QFactoryLoader() looking at /usr/lib/x86_64-linux-gnu/qt5/plugins/platforms/libqlinuxfb.so
Found metadata in lib /usr/lib/x86_64-linux-gnu/qt5/plugins/platforms/libqlinuxfb.so, metadata
{IID: org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3,MetaData: {Keys: [linuxfb]},archreq: 0,className: QLinuxFbIntegrationPlugin,debug: false,version: 331520
}Got keys from plugin meta data (linuxfb)
QFactoryLoader::QFactoryLoader() looking at /usr/lib/x86_64-linux-gnu/qt5/plugins/platforms/libqminimal.so
Found metadata in lib /usr/lib/x86_64-linux-gnu/qt5/plugins/platforms/libqminimal.so, metadata
{IID: org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3,MetaData: {Keys: [minimal]},archreq: 0,className: QMinimalIntegrationPlugin,debug: false,version: 331520
}Got keys from plugin meta data (minimal)
QFactoryLoader::QFactoryLoader() looking at /usr/lib/x86_64-linux-gnu/qt5/plugins/platforms/libqminimalegl.so
Found metadata in lib /usr/lib/x86_64-linux-gnu/qt5/plugins/platforms/libqminimalegl.so, metadata
{IID: org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3,MetaData: {Keys: [minimalegl]},archreq: 0,className: QMinimalEglIntegrationPlugin,debug: false,version: 331520
}Got keys from plugin meta data (minimalegl)
QFactoryLoader::QFactoryLoader() looking at /usr/lib/x86_64-linux-gnu/qt5/plugins/platforms/libqoffscreen.so
Found metadata in lib /usr/lib/x86_64-linux-gnu/qt5/plugins/platforms/libqoffscreen.so, metadata
{IID: org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3,MetaData: {Keys: [offscreen]},archreq: 0,className: QOffscreenIntegrationPlugin,debug: false,version: 331520
}Got keys from plugin meta data (offscreen)
QFactoryLoader::QFactoryLoader() looking at /usr/lib/x86_64-linux-gnu/qt5/plugins/platforms/libqvnc.so
Found metadata in lib /usr/lib/x86_64-linux-gnu/qt5/plugins/platforms/libqvnc.so, metadata
{IID: org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3,MetaData: {Keys: [vnc]},archreq: 0,className: QVncIntegrationPlugin,debug: false,version: 331520
}Got keys from plugin meta data (vnc)
QFactoryLoader::QFactoryLoader() looking at /usr/lib/x86_64-linux-gnu/qt5/plugins/platforms/libqxcb.so
Found metadata in lib /usr/lib/x86_64-linux-gnu/qt5/plugins/platforms/libqxcb.so, metadata
{IID: org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3,MetaData: {Keys: [xcb]},archreq: 0,className: QXcbIntegrationPlugin,debug: false,version: 331520
}Got keys from plugin meta data (xcb)
QFactoryLoader::QFactoryLoader() checking directory path /opt/ros/humble/lib/rviz2/platforms ...
loaded library /usr/lib/x86_64-linux-gnu/qt5/plugins/platforms/libqxcb.so
qt.qpa.xcb: could not connect to display
qt.qpa.plugin: Could not load the Qt platform plugin xcb in even though it was found.
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.Available platform plugins are: eglfs, linuxfb, minimal, minimalegl, offscreen, vnc, xcb.[ros2run]: Aborted
root020b7a1aa6d4:/# echo $DISPLAY root020b7a1aa6d4:/#
exit这里参考非常宝藏的社区解决方法 在宿主机中运行
docker run -it -v /tmp/.X11-unix/:/tmp/.X11-unix/:rw --envDISPLAY --name ros2_container osrf/ros:humble-desktop-full解释
-v /tmp/.X11-unix/:/tmp/.X11-unix/:rw
-v 选项允许 Docker 将一个卷挂载到容器上这样容器就能访问宿主机文件系统上的目录
/tmp/.X11-unix/ 是宿主机上由 X 服务器用于显示的一个目录
:/tmp/.X11-unix/ 是容器中挂载卷的位置与宿主机上的目录相同
:rw 部分允许对卷进行读写访问这对显示内容是必要的。--envDISPLAY
这个参数将宿主机的 DISPLAY 环境变量传递给容器。
DISPLAY 变量以启用可视化这里我重点排查了一下貌似是因为之前通过
docker image pull osrf/ros:humble-desktop-full
#拉取的镜像有些东西没有拉取成功 导致RVIZ2始终运行不成功使得我又重新构建了一个container_ros2 ! docker run -it --name ros2_container osrf/ros:humble-desktop-full 接下来报错问题
rootcf4125aa605c:/# ros2 run rviz2 rviz2
QFactoryLoader::QFactoryLoader() checking directory path /usr/lib/x86_64-linux-gnu/qt5/plugins/platforms ...
QFactoryLoader::QFactoryLoader() looking at /usr/lib/x86_64-linux-gnu/qt5/plugins/platforms/libqeglfs.so
Found metadata in lib /usr/lib/x86_64-linux-gnu/qt5/plugins/platforms/libqeglfs.so, metadata
{IID: org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3,MetaData: {Keys: [eglfs]},archreq: 0,className: QEglFSIntegrationPlugin,debug: false,version: 331520
}Got keys from plugin meta data (eglfs)
QFactoryLoader::QFactoryLoader() looking at /usr/lib/x86_64-linux-gnu/qt5/plugins/platforms/libqlinuxfb.so
Found metadata in lib /usr/lib/x86_64-linux-gnu/qt5/plugins/platforms/libqlinuxfb.so, metadata
{IID: org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3,MetaData: {Keys: [linuxfb]},archreq: 0,className: QLinuxFbIntegrationPlugin,debug: false,version: 331520
}Got keys from plugin meta data (linuxfb)
QFactoryLoader::QFactoryLoader() looking at /usr/lib/x86_64-linux-gnu/qt5/plugins/platforms/libqminimal.so
Found metadata in lib /usr/lib/x86_64-linux-gnu/qt5/plugins/platforms/libqminimal.so, metadata
{IID: org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3,MetaData: {Keys: [minimal]},archreq: 0,className: QMinimalIntegrationPlugin,debug: false,version: 331520
}Got keys from plugin meta data (minimal)
QFactoryLoader::QFactoryLoader() looking at /usr/lib/x86_64-linux-gnu/qt5/plugins/platforms/libqminimalegl.so
Found metadata in lib /usr/lib/x86_64-linux-gnu/qt5/plugins/platforms/libqminimalegl.so, metadata
{IID: org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3,MetaData: {Keys: [minimalegl]},archreq: 0,className: QMinimalEglIntegrationPlugin,debug: false,version: 331520
}Got keys from plugin meta data (minimalegl)
QFactoryLoader::QFactoryLoader() looking at /usr/lib/x86_64-linux-gnu/qt5/plugins/platforms/libqoffscreen.so
Found metadata in lib /usr/lib/x86_64-linux-gnu/qt5/plugins/platforms/libqoffscreen.so, metadata
{IID: org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3,MetaData: {Keys: [offscreen]},archreq: 0,className: QOffscreenIntegrationPlugin,debug: false,version: 331520
}Got keys from plugin meta data (offscreen)
QFactoryLoader::QFactoryLoader() looking at /usr/lib/x86_64-linux-gnu/qt5/plugins/platforms/libqvnc.so
Found metadata in lib /usr/lib/x86_64-linux-gnu/qt5/plugins/platforms/libqvnc.so, metadata
{IID: org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3,MetaData: {Keys: [vnc]},archreq: 0,className: QVncIntegrationPlugin,debug: false,version: 331520
}Got keys from plugin meta data (vnc)
QFactoryLoader::QFactoryLoader() looking at /usr/lib/x86_64-linux-gnu/qt5/plugins/platforms/libqxcb.so
Found metadata in lib /usr/lib/x86_64-linux-gnu/qt5/plugins/platforms/libqxcb.so, metadata
{IID: org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3,MetaData: {Keys: [xcb]},archreq: 0,className: QXcbIntegrationPlugin,debug: false,version: 331520
}Got keys from plugin meta data (xcb)
QFactoryLoader::QFactoryLoader() checking directory path /opt/ros/humble/lib/rviz2/platforms ...
loaded library /usr/lib/x86_64-linux-gnu/qt5/plugins/platforms/libqxcb.so
No protocol specified
qt.qpa.xcb: could not connect to display :1
qt.qpa.plugin: Could not load the Qt platform plugin xcb in even though it was found.
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.Available platform plugins are: eglfs, linuxfb, minimal, minimalegl, offscreen, vnc, xcb.[ros2run]: Aborted解决方法 大概是没有同意通过docker容器访问宿主机的X服务器 所以采取的方法为宝藏解决方法
#执行
export QT_DEBUG_PLUGINS1 // 用来输出QT报错的完整信息
再次在docker中运行rviz2的节点
ros2 run rviz2 rviz2 #查看完整报错内容
echo $DISPLAY 判断是不是利用宿主机显示rviz2出现的问题
本地终端输入
sudo xhost 然后按下回车
输入密码
出现下图
再在docker中
ros2 run rviz2 rviz2成功展示界面 这里要注意你rviz2启动的container需要一致 例如我这里的docker image 存在多种 但是这里只有ros2_container成功拉取了rviz2所以 其他的仍然存在rviz2显示问题(那就重新下载一下我的SDK相关包和依赖库)
删除 Docker 镜像和容器
我是个眼里不容沙子的人没用的docker container需要选择删除 列出所有镜像以获取镜像的 ID docker images -a 明确删除哪个镜像 docker rmi your-image-id 操作如下 sudo systemctl start docker
sudo systemctl enable dockerdocker images -adocker rmi d2c94e258dcb
docker iamges -a删除 Docker 容器
#停止所有正在运行的容器
docker ps -a //列出 所有容器 停止和未停止
docker ps //列出所有正在运行的容器删除多个容器
docker rm $(docker ps -a -q)
#用来删除所有停止的容器一般情况下可以将线程数设置为CPU核心数的2倍
Linux服务器下查看系统CPU个数、核心数、(make编译最大的)线程数
# 查看CPU
lscpu #查看cpu的所有信息
#######################################################
rootcf4125aa605c:/Livox-SDK2/build# lscpu
Architecture: x86_64CPU op-mode(s): 32-bit, 64-bitAddress sizes: 46 bits physical, 48 bits virtualByte Order: Little Endian
CPU(s): 8On-line CPU(s) list: 0-7
Vendor ID: GenuineIntelModel name: Intel(R) Xeon(R) W-2223 CPU 3.60GHzCPU family: 6Model: 85Thread(s) per core: 2Core(s) per socket: 4Socket(s): 1Stepping: 7CPU max MHz: 3900.0000CPU min MHz: 1200.0000BogoMIPS: 7200.00Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault epb cat_l3 cdp_l3 invpcid_single intel_ppin ssbd mba ibrs ibpb stibp ibrs_enhanced tpr_shadow vnmi flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid cqm mpx rdt_a avx512f avx512dq rdseed adx smap clflushopt clwb intel_pt avx512cd avx512bw avx512vl xsaveopt xsavec xgetbv1 xsaves cqm_llc cqm_occup_llc cqm_mbm_total cqm_mbm_local dtherm ida aratpln pts hwp hwp_act_window hwp_epp hwp_pkg_req avx512_vnni md_clear flush_l1d arch_capabilities
Virtualization features: Virtualization: VT-x
Caches (sum of all): L1d: 128 KiB (4 instances)L1i: 128 KiB (4 instances)L2: 4 MiB (4 instances)L3: 8.3 MiB (1 instance)
NUMA: NUMA node(s): 1NUMA node0 CPU(s): 0-7
Vulnerabilities: Gather data sampling: Mitigation; MicrocodeItlb multihit: KVM: Mitigation: VMX disabledL1tf: Not affectedMds: Not affectedMeltdown: Not affectedMmio stale data: Mitigation; Clear CPU buffers; SMT vulnerableReg file data sampling: Not affectedRetbleed: Mitigation; Enhanced IBRSSpec rstack overflow: Not affectedSpec store bypass: Mitigation; Speculative Store Bypass disabled via prctl and seccompSpectre v1: Mitigation; usercopy/swapgs barriers and __user pointer sanitizationSpectre v2: Mitigation; Enhanced / Automatic IBRS; IBPB conditional; RSB filling; PBRSB-eIBRS SW sequence; BHI SW loop, KVM SW loopSrbds: Not affectedTsx async abort: Mitigation; TSX disabled
#######################################################查看物理CPU数量 CPU物理核心就是计算机上实际配置的CPU个数
cat /proc/cpuinfo |grep physical id|sort|uniq|wc -l#通过sort 列出cpu信息
grep physical id /proc/cpuinfo | sort -u逻辑CPU的个数 计算机没有开启超线程时逻辑CPU的个数就是计算机的核数 超线程开启后逻辑CPU的个数是核数的两倍 实际上逻辑CPU的数量就是平时称呼的几核几线程中的线程数量在linux的cpuinfo中逻辑CPU数就是processor的数量
cat /proc/cpuinfo| grep processor| wc -l
grep physical id /proc/cpuinfo 查看核心数量 每个物理CPU含有的核心个数。
cat /proc/cpuinfo| grep cpu cores| uniq
grep core id /proc/cpuinfo | sort -u |wc -l总核数 物理CPU个数 X 每颗物理CPU的核数
grep core id /proc/cpuinfo |wc -l查看线程数 cpu支持的线程数 cpu数目 * 每个cpu含有的核心数目* 每个核心含有的线程数642162 CPU是一个影响编译速度的重要因素所以make -j带上一个参数可以把项目在进行中的并行编译现在服务器上的CPU差不多都是多核多线程的所以完全可以用make -j64让make最多允许64个编译进程同时执行这样可以更有效的利用CPU资源。
cat /proc/cpuinfo |grep processor|wc -l
grep processor /proc/cpuinfo | sort -u | wc -l
grep processor /proc/cpuinfo | wc -l博主中线程数 64 2(physical cpu) * 16(cpu kernel number) * 2(每个核心是双核) 我的是卑微的8 所以 安装库的时候 每一个需要make -j的我都选择make -j8
总结
pcl没有选择安装直接将pcl的include加入到相应的bashrc中-最终选择第二种方式
vim ~/.bashrc
export CPLUS_INCLUDE_PATH/usr/include/pcl-1.12:$CPLUS_INCLUDE_PATH #我是pcl-1.12
export LIBRARY_PATH/usr/lib/x86_64-linux-gnu:$LIBRARY_PATHEigen直接大片的**sudo apt install libeigen3-dev** sophus:
git clone https://github.com/strasdat/Sophus.git
cd Sophus
git checkout 1.22.10
mkdir build cd build
cmake .. -DSOPHUS_USE_BASIC_LOGGINGON
make
sudo make installgtsam
#安装依赖
sudo apt-get install libboost-all-dev
sudo apt-get install cmake
sudo apt-get install libtbb-devgit clone https://github.com/borglab/gtsam.git
cd gtsam
mkdir build cd build
cmake ..
make check (optional, runs unit tests)
make installlivox_ros_driver2
mkdir -r ws_livox/src
git clone https://github.com/Livox-SDK/livox_ros_driver2.git ws_livox/src/livox_ros_driver2
cd ws_livox/src/livox_ros_driver2
source /opt/ros/humble/setup.sh
./build.sh humble#在后面需要修改livox_ros_driver2_DIR
vim /FastLIO2_ws/src/FASTLIO2_ROS2/fastlio2/CMakeLists.txt
set(livox_ros_driver2_DIR /ws_livox/install/livox_ros_driver2/share/livox_ros_driver2/cmake)RVIZ2 不能显示数据集
数据连接
首先在安装完成fastlio2需要的依赖库后
mkdir -p /FastLIO2_ws/src cd /FastLIO2_ws/src
git clone --recursive https://github.com/liangheming/FASTLIO2_ROS2.git
cd .. #这里colcon 需要在src目录下
colcon build --symlink-install. ./install/setup.bash #激活安装的fastlio2 node问题:rviz2不能播放db3的rosbag数据 新开启一个终端
docker exec -it rose_container /bin/bash
source /opt/ros/humble/setup.bash
source /FastLIO2_ws/install/setup.bash
ros2 bag play FastLIO_ROS2_Data问题解决 需要在colcon build --symlink-install build fastlio2之前 一定要在colcon build --symlink-install 之前source /ws_livox/install/setup.bash!!! source /ws_livox/install/setup.bash ###!!!!!!cd /FastLIO2_ws/colcon build --symlink-install ## !!!!. ./install/setup.bash ##!!!! 然后在按照上面的方法开启新的终端 ros2 bag play ors_bag_dir 最终能够成功播放数据集。 结果展示