ROS 摄像头图像显示问题分析与解决
故障描述在启动自动赛程序时,发现摄像头无法正常工作。虽然使用 rqt_image_view 可以成功显示图像,但当将话题名称从 /camera/image 改为 /camera/color/image_raw 时,程序仍然无法正常显示摄像头图像,并报错提示 detect_ros 进程已终止。错误信息报错内容如下: process has died .log file: /home/spark/.ros/log/744b18d8-2944-11ef-8a0b-b7fe19ea1142/detect_ros-12*.log该报错表明 detect_ros 进程因未知原因终止。
单独运行 detect_ros.py 文件的输出当尝试单独运行 detect_ros.py 文件时,输出以下内容并直接终止:2024-06-13 13:21:23.397117: I tensorflow/tsl/cuda/cudart_stub.cc:28] Could not find cuda drivers on your machine, GPU will not be used.2024-06-13 13:21:23.440466: I tensorflow/tsl/cuda/cudart_stub.cc:28] Could not find cuda drivers on your machine, GPU will not be used.2024-06-13 13:21:23.440871: I tensorflow/core/platform/cpu_feature_guard.cc:182] This TensorFlow binary is optimized to use available CPU instructions in performance-critical operations.To enable the following instructions: AVX2 FMA, in other operations, rebuild TensorFlow with the appropriate compiler flags.2024-06-13 13:21:24.102906: W tensorflow/compiler/tf2tensorrt/utils/py_utils.cc:38] TF-TRT Warning: Could not find TensorRTTraceback (most recent call last):File "/home/spark/spark_noetic/src/3rd_app/auto_match_24/auto_match/nodes/detect_ros.py", line 28, in <module> from object_detection.utils import label_map_util # type: ignoreFile "/home/spark/spark_noetic/src/3rd_app/tensorflow_app/tensorflow_object_detector/src/object_detection/utils/label_map_util.py", line 22, in <module> from object_detection.protos import string_int_label_map_pb2File "/home/spark/spark_noetic/src/3rd_app/tensorflow_app/tensorflow_object_detector/src/object_detection/protos/string_int_label_map_pb2.py", line 35, in <module> _descriptor.FieldDescriptor(File "/usr/local/lib/python3.8/dist-packages/google/protobuf/descriptor.py", line 561, in __new__ _message.Message._CheckCalledFromGeneratedFile()TypeError: Descriptors cannot not be created directly.If this call came from a _pb2.py file, your generated code is out of date and must be regenerated with protoc >= 3.19.0.If you cannot immediately regenerate your protos, some other possible workarounds are: 1. Downgrade the protobuf package to 3.20.x or lower. 2. Set PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python (but this will use pure-Python parsing and will be much slower).More information: https://developers.google.com/protocol-buffers/docs/news/2022-05-06#python-updates可能原因分析
[*]TensorFlow 和 Protobuf 版本不匹配:报错信息中提示 Descriptors cannot not be created directly,这通常是由于 TensorFlow 和 Protobuf 版本不匹配导致的。建议检查 TensorFlow 和 Protobuf 的版本,并根据报错信息中的建议进行相应的升级或降级操作。
[*]GPU 驱动问题:报错信息中提示 Could not find cuda drivers on your machine,这意味着系统中未安装或未正确配置 GPU 驱动。建议检查并安装正确的 GPU 驱动程序。
[*]TensorRT 问题:报错信息中提示 TF-TRT Warning: Could not find TensorRT,这表明系统中未安装 TensorRT 库。如果程序需要使用 TensorRT 进行加速,则需要安装相应的库。
解决建议
[*]检查 TensorFlow 和 Protobuf 版本:确保 TensorFlow 和 Protobuf 的版本兼容,并根据报错信息中的建议进行升级或降级操作。
[*]安装 GPU 驱动:检查并安装正确的 GPU 驱动程序。
[*]安装 TensorRT:如果程序需要使用 TensorRT 进行加速,则需要安装相应的库。
[*]检查日志文件:查看 /home/spark/.ros/log/744b18d8-2944-11ef-8a0b-b7fe19ea1142/detect_ros-12*.log 日志文件,获取更多关于程序崩溃的信息。
:lol很好的分享~我来抢沙发啦~ NXROS小助理 发表于 2024-7-4 14:01
很好的分享~我来抢沙发啦~
谢谢 对我们有所帮组 sunny 发表于 2024-7-4 15:37
对我们有所帮组
很开心对你们有所帮助。 抢沙发:D saiLan 发表于 2024-7-4 19:31
抢沙发
;P 萌新上号,很有借鉴意义,值得学习借鉴 有问题现象,造成原因和解决的方案,很不错,思路清晰,每天都在进步一点点!!! 666666啊,很厉害啊
页:
[1]
2