故障描述 在启动自动赛程序时,发现摄像头无法正常工作。虽然使用 rqt_image_view 可以成功显示图像,但当将话题名称从 /camera/image 改为 /camera/color/image_raw 时,程序仍然无法正常显示摄像头图像,并报错提示 detect_ros 进程已终止。 错误信息报错内容如下: [detect_ros-12] process has died [pid 6894, exit code 1, cmd /home/spark/spark_noetic/src/3rd_app/auto_match_24/auto_match/nodes/detect_ros.py image:=/camera/color/image_raw __name:=detect_ros __log:=/home/spark/.ros/log/744b18d8-2944-11ef-8a0b-b7fe19ea1142/detect_ros-12.log]. 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 TensorRT Traceback (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: ignore File "/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_pb2 File "/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/pr ... 5-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 日志文件,获取更多关于程序崩溃的信息。
|