RDKX5 使用ros2运行报错Websocket did not receive AI data

1、板卡型号:RDK X5
2、系统版本:
oot@ubuntu:/app/pydev_demo/drone# sudo cat /etc/version
3.2.3
root@ubuntu:/app/pydev_demo/drone# sudo rdkos_info
================ RDK System Information Collection ================

[Hardware Model]:
D-Robotics X5 MD V0.2 (Board Id = 504)

    temperature-->
            DDR      : 33.0 (C)
            BPU      : 32.2 (C)
            CPU      : 32.3 (C)
    cpu frequency-->
                  min(M)    cur(M)  max(M)
            cpu0: 300       1500    1500
            cpu1: 300       1500    1500
            cpu2: 300       1200    1500
            cpu3: 300       1200    1500
            cpu4: 300       1200    1500
            cpu5: 300       1500    1500
            cpu6: 300       1500    1500
            cpu7: 300       1200    1500
    bpu status information---->
                  min(M)    cur(M)  max(M)  ratio
            bpu0: 500       1000    1000    0
    ddr frequency information---->
                  min(M)    cur(M)  max(M)
            ddr:  266       4266    4266
    GPU gc8000 frequency information---->
                  min(M)    cur(M)  max(M)
            gc8000:  200    1000    1000

[RDK Kernel Version]:
Linux ubuntu 6.1.83 #3 SMP PREEMPT Mon Dec 8 15:42:08 CST 2025 aarch64 aarch64 aarch64 GNU/Linux

[RDK Miniboot Version]:
U-Boot 2022.10+ (Jun 18 2025 - 11:13:54 +0800)

3、问题涉及的技术领域:TROS (TogetheROS.Bot)
4、问题:
经yolov5 tag7.0 训练,并使用rdk_model_zoo中的YOLOv5_Detect.py验证可以运行,可识别目标。但是,在ros2中运行报错如下:
[ERROR] [1765438415.277494449] [dnn_example_node]: Error! Invalid parser: yolov5 . Only yolov2, yolov3, yolov5, yolov5x, yolov8, yolov10, ssd, fcos efficient_det, classification, unet, yolov8-seg are supported
[example-3] [ERROR] [1765438415.277620281] [dnn_example_node]: Load config fail!

[websocket-4] [ERROR] [1765438420.360195882] [websocket]:
[drone.zip|attachment]
! Please check whether the AI data publisher still exists by ‘ros2 topic info hobot_dnn_detection’!

drone.zip (6.2 MB)

求解答,万分感谢。

您好,需要修改TROS hobot_dnn中的后处理来进行推理,经过model zoo转化的模型目前无法在TROS上直接run

如何修改,具体修改那个文件呢,有教程吗?烦请告知,非常感谢。

您好,这块属于ROS2开发的基本内容

需要掌握ROS2 Package相关内容,git clone hobot_dnn 源码后参考 model zoo 中的后处理来修改对应cpp后处理相关文件后 进行编译,主要是不需要反量化,现有modelzoo中的代码直接输出fp32

Hobot Dnn:GitHub - D-Robotics/hobot_dnn

后处理:hobot_dnn/dnn_node/src/output_parser/detection at develop · D-Robotics/hobot_dnn · GitHub

您好,成功在ROS下运行。参考【地平线机器人平台应用系列-yolov5全流程部署】 https://www.bilibili.com/video/BV1Dv4y1y7W6/?share_source=copy_web&vd_source=a1a9c334c5afe6ba6aaedd4b1359ce13,git后切换至 tros_2.5.9,修改了种类,替换了bin文件。进行了dnn_node_sample 编译。
执行colcon build --packages-select dnn_node_sample,只有X3,没有X5,有影响吗?如果进行dnn_node_example编译修改呢,如何自定义呢?

root@ubuntu:/app/hobot_dnn/dnn_node_sample# colcon build --packages-select dnn_node_sample
[2.809s] WARNING:colcon.colcon_core.package_selection:Some selected packages are already built in one or more underlay workspaces:
‘dnn_node_sample’ is in: /opt/tros/humble
If a package in a merged underlay workspace is overridden and it installs headers, then all packages in the overlay must sort their include directories by workspace order. Failure to do so may result in build failures or undefined behavior at run time.
If the overridden package is used by another package in any underlay, then the overriding package in the overlay must be API and ABI compatible or undefined behavior at run time may occur.

If you understand the risks and want to override a package anyways, add the following to the command line:
–allow-overriding dnn_node_sample

This may be promoted to an error in a future release of colcon-override-check.
Starting >>> dnn_node_sample
[Processing: dnn_node_sample]
[Processing: dnn_node_sample]
— stderr: dnn_node_sample
invalid platform, build platform X3 default
PREFIX_PATH is x3
SYS_ROOT is
hobot_cv_LIBRARIES is /opt/tros/humble/lib/libhobot_cv.so
update HOBOTCV_LIB_INSTALL_PATH as /opt/tros/humble/lib
HOBOTCV_LIB_INSTALL_PATH is /opt/tros/humble/lib
/app/hobot_dnn/dnn_node_sample/src/parser.cpp:43:14: warning: missing initializer for member ‘hobot::dnn_node::dnn_node_sample::PTQYolo5Config::dequantize_scale’ [-Wmissing-field-initializers]
43 | {“drone”}};
| ^
In file included from /opt/ros/humble/include/rclcpp/rclcpp/logging.hpp:24,
from /opt/ros/humble/include/rclcpp/rclcpp/client.hpp:40,
from /opt/ros/humble/include/rclcpp/rclcpp/callback_group.hpp:24,
from /opt/ros/humble/include/rclcpp/rclcpp/any_executable.hpp:20,
from /opt/ros/humble/include/rclcpp/rclcpp/memory_strategy.hpp:25,
from /opt/ros/humble/include/rclcpp/rclcpp/memory_strategies.hpp:18,
from /opt/ros/humble/include/rclcpp/rclcpp/executor_options.hpp:20,
from /opt/ros/humble/include/rclcpp/rclcpp/executor.hpp:37,
from /opt/ros/humble/include/rclcpp/rclcpp/executors/multi_threaded_executor.hpp:25,
from /opt/ros/humble/include/rclcpp/rclcpp/executors.hpp:21,
from /opt/ros/humble/include/rclcpp/rclcpp/rclcpp.hpp:155,
from /opt/tros/humble/include/dnn_node/dnn_node_data.h:23,
from /opt/tros/humble/include/dnn_node/dnn_node.h:22,
from /app/hobot_dnn/dnn_node_sample/src/sample.cpp:16:
/app/hobot_dnn/dnn_node_sample/src/sample.cpp: In member function ‘void DNNNodeSample::FeedImg(hbm_img_msgs::msg::HbmMsg1080P_<std::allocator >::ConstSharedPtr)’:
/app/hobot_dnn/dnn_node_sample/src/sample.cpp:149:18: warning: format ‘%d’ expects argument of type ‘int’, but argument 5 has type ‘std::array<unsigned char, 12>::const_pointer’ {aka ‘const unsigned char*’} [-Wformat=]
149 | "Only support nv12 img encoding! Using hobot codec to process "
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
150 | “%d encoding img.”,
| ~~~~~~~~~~~~~~~~~~
151 | img_msg->encoding.data());
| ~~~~~~~~~~~~~~~~~~~~~~~~
| |
| std::array<unsigned char, 12>::const_pointer {aka const unsigned char*}
/app/hobot_dnn/dnn_node_sample/src/sample.cpp:150:20: note: format string is defined here
150 | “%d encoding img.”,
| ~^
| |
| int
| %hhn
In file included from /opt/ros/humble/include/rclcpp/rclcpp/logging.hpp:24,
from /opt/ros/humble/include/rclcpp/rclcpp/client.hpp:40,
from /opt/ros/humble/include/rclcpp/rclcpp/callback_group.hpp:24,
from /opt/ros/humble/include/rclcpp/rclcpp/any_executable.hpp:20,
from /opt/ros/humble/include/rclcpp/rclcpp/memory_strategy.hpp:25,
from /opt/ros/humble/include/rclcpp/rclcpp/memory_strategies.hpp:18,
from /opt/ros/humble/include/rclcpp/rclcpp/executor_options.hpp:20,
from /opt/ros/humble/include/rclcpp/rclcpp/executor.hpp:37,
from /opt/ros/humble/include/rclcpp/rclcpp/executors/multi_threaded_executor.hpp:25,
from /opt/ros/humble/include/rclcpp/rclcpp/executors.hpp:21,
from /opt/ros/humble/include/rclcpp/rclcpp/rclcpp.hpp:155,
from /opt/tros/humble/include/dnn_node/dnn_node_data.h:23,
from /opt/tros/humble/include/dnn_node/dnn_node.h:22,
from /app/hobot_dnn/dnn_node_sample/src/sample.cpp:16:
/app/hobot_dnn/dnn_node_sample/src/sample.cpp: In member function ‘virtual int DNNNodeSample::PostProcess(const std::shared_ptrhobot::dnn_node::DnnNodeOutput&)’:
/app/hobot_dnn/dnn_node_sample/src/sample.cpp:307:19: warning: format ‘%d’ expects argument of type ‘int’, but argument 8 has type ‘long int’ [-Wformat=]
307 | "input fps: %.2f, out fps: %.2f, infer time ms: %d, "
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
308 | “post process time ms: %d”,
| ~~~~~~~~~~~~~~~~~~~~~~~~~~

312 | interval);
| ~~~~~~~~
| |
| long int
/app/hobot_dnn/dnn_node_sample/src/sample.cpp:308:43: note: format string is defined here
308 | “post process time ms: %d”,
| ~^
| |
| int
| %ld

Finished <<< dnn_node_sample [1min 19s]

Summary: 1 package finished [1min 21s]
1 package had stderr output: dnn_node_sample

您好,不建议切换到老版本tros,修改我给出的后处理相关代码后编译即可