7.1. 购买渠道

旭日X3派购买渠道?

  1. 世强硬创电商平台:

  2. 亚博智能旗舰店:

  3. 轮趣科技:

  4. 微雪电子:

7.2. 硬件和系统

详细请参考旭日X3派用户手册FAQ

摄像头插拔注意事项

严禁在开发板未断电的情况下插拔摄像头,否则非常容易烧坏摄像头模组

串口线如何连接?

串口线一端(白色)接到旭日X3派,由于接口有凹槽正反面通常不会接反,另外一端接到串口转接板,此处需要重点关注,连接图如下:

../_images/connect.png

旭日X3派供电有什么要求?

旭日X3派开发板通过USB Type C接口供电,并兼容QC、PD快充协议。推荐使用支持QC、PD快充协议的电源适配器,或者至少搭配5V 直流 2A的电源适配器为开发板供电。

注意,请不要使用PC机USB接口为开发板供电,否则会因供电不足造成开发板工作异常(例如旭日X3派上电后, HDMI 无输出(完全黑屏),绿灯没有熄灭,连接串口后,发现系统在反复重启,无法进入操作系统)。

旭日X3派是否有推荐SD卡?

建议使用高速C10 SD卡,老卡可能会存在烧录镜像无法启动问题,SD卡16G以上;

金士顿https://item.jd.com/25263496192.html

闪迪https://item.jd.com/1875992.html#crumb-wrap

F37和GC4663 MIPI摄像头如何连接?

F37和GC4663摄像头模组通过24pin异面FPC排线跟开发板连接,注意排线两端蓝面向上插入连接器。F37摄像头连接示意图如下:

../_images/image-X3-PI-Camera.png

正常连接后接通电源,执行命令:

cd /app/ai_inference/03_mipi_camera_sample
sudo python3 mipi_camera.py

算法渲染结果的HDMI输出如下图,示例图像中检测到了teddy bearcupvase

../_images/image-20220511181747071.png

输入命令:i2cdetect -y -r 1   
F37:
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- -- 
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
30: -- -- -- -- -- -- -- -- -- -- -- UU -- -- -- -- 
40: 40 -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
70: -- -- -- -- -- -- -- --   

GC4663:
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- -- 
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
20: -- -- -- -- -- -- -- -- -- 29 -- -- -- -- -- -- 
30: -- -- -- -- -- -- -- -- -- -- -- UU -- -- -- -- 
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
70: -- -- -- -- -- -- -- --                         

如何查看芯片CPU、BPU等运行状态?

sudo hrut_somstatus

如何设置自启动?

通过在sudo vim /etc/rc.local文件末尾添加命令,可实现开机自启动功能,例如:

#!/bin/bash -e
# 
# rc.local
#re
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.

#!/bin/sh

chmod a=rx,u+ws /usr/bin/sudo
chown sunrise:sunrise /home/sunrise

which "hrut_count" >/dev/null 2>&1
if [ $? -eq 0 ]; then
        hrut_count 0
fi

# Insert what you need

7.3. 应用和示例

如果实现第三方库在旭日X3派上的安装/交叉编译和使用?

如需交叉编译部署,请参考交叉编译环境部署

编译大型程序过程中提示编译进程被kill错误日志如何解决?

参考Swap使用教程

sudo mkdir -p /swapfile 
cd /swapfile 
sudo dd if=/dev/zero of=swap bs=1M count=1024 
sudo chmod 0600 swap 
sudo mkswap -f swap 
sudo swapon swap 
free

如何运行GC4633摄像头示例?

python已提供基于F37和GC4663 camera的FCOS算法示例,会自动检测camera进行算法推理。

cd /app/ai_inference/03_mipi_camera_sample
sudo python3 mipi_camera.py

然后HDMI接屏幕可以渲染图像和算法展示结果。

使用rqt_image_view查看旭日X3派发布的RGB888 RAW图卡顿,甚至无法接收?

FastDDS在UDP协议层没有实现MTU分片,导致IP层进行分片,当UDP数据过大时由于常见路由器、网卡均无法缓冲大量分片,且某一分片丢失会导致重传所有分片,进而形成IP fragmentation attack,表现为同一网段机器通信卡顿。更换cycloneDDS(命令:export RMW_IMPLEMENTATION=rmw_cyclonedds_cpp),或者发送小分辨率jpeg格式图片降低传输数据量。

Linux镜像是否支持板端编译?

Linux镜像rootfs经过最小剪裁,无法支持板端编译。

Linux镜像上如何运行示例

手册中的示例是以Ubuntu系统举例介绍,示例的运行依赖python,这些示例同样可以运行在烧录Linux镜像(无python)的X3派上。

  • Ubuntu系统和Linux镜像启动示例说明

在Ubuntu系统中,启动一个示例分为三步:

1、使用source /opt/tros/setup.bash命令配置tros.b环境

2、拷贝需要的配置文件到执行路径下

3、使用ros2 run或者ros2 launch启动tros.b中的package

在Linux镜像上,这三步分别为:

1、使用export LD_LIBRARY_PATH命令配置tros.b环境

2、拷贝需要的配置文件到执行路径下

3、启动示例程序,并指定启动参数。对于使用C++编写的package,每个package对应于一个可执行程序。

下面使用算法推理示例举例,说明如何将launch脚本内容转换成Linux镜像上的命令。示例输入一张本地图片进行推理,得到渲染后的图片并保存在本地。

  • Ubuntu系统上启动命令

命令如下:

# 配置tros.b环境
source /opt/tros/setup.bash

# 从tros.b的安装路径中拷贝出运行示例需要的配置文件。config中为example使用的模型,回灌使用的本地图片
cp -r /opt/tros/lib/dnn_node_example/config/ .

# 使用本地jpg格式图片进行回灌预测,并存储渲染后的图片
ros2 launch dnn_node_example hobot_dnn_node_example_feedback.launch.py
  • launch脚本路径

此示例使用ros2 launch启动了dnn_node_example package,在X3派的tros.b安装路径/opt/tros/中查找launch脚本hobot_dnn_node_example_feedback.launch.py所在路径:

# find /opt/tros/ -name hobot_dnn_node_example_feedback.launch.py
/opt/tros/share/dnn_node_example/launch/hobot_dnn_node_example_feedback.launch.py
  • launch脚本内容

launch脚本hobot_dnn_node_example_feedback.launch.py主要内容如下:

def generate_launch_description():
    config_file_launch_arg = DeclareLaunchArgument(
        "config_file", default_value=TextSubstitution(text="config/fcosworkconfig.json")
    )

    img_file_launch_arg = DeclareLaunchArgument(
        "image", default_value=TextSubstitution(text="config/test.jpg")
    )

    # 拷贝config中文件
    dnn_node_example_path = os.path.join(
        get_package_prefix('dnn_node_example'),
        "lib/dnn_node_example")
    print("dnn_node_example_path is ", dnn_node_example_path)
    cp_cmd = "cp -r " + dnn_node_example_path + "/config ."
    print("cp_cmd is ", cp_cmd)
    os.system(cp_cmd)

    return LaunchDescription([
        config_file_launch_arg,
        img_file_launch_arg,
        # 启动单目rgb人体、人头、人脸、人手框和人体关键点检测pkg
        Node(
            package='dnn_node_example',
            executable='example',
            output='screen',
            parameters=[
                {"feed_type": 0},
                {"config_file": LaunchConfiguration('config_file')},
                {"image": LaunchConfiguration('image')},
                {"image_type": 0},
                {"dump_render_img": 1}
            ],
            arguments=['--ros-args', '--log-level', 'info']
        )
    ])
  • launch脚本说明

launch脚本支持通过参数config_file指定配置文件选择运行的算法,参数image指定算法推理使用的图片。示例启动时未指定,使用的是默认配置。

launch脚本中package参数指定了启动的package名为dnn_node_exampleexecutable参数指定可执行程序名为exampleparameters参数指定了传给可执行程序的参数。ros2 launch的详细使用说明参考ROS2手册

  • package和可执行程序路径

在X3派的tros.b安装路径/opt/tros/中查找:

# find /opt/tros/ -name dnn_node_example -type d
/opt/tros/lib/dnn_node_example
/opt/tros/share/dnn_node_example

# ls /opt/tros/lib/dnn_node_example
config  example

可以看到可执行程序example/opt/tros/lib/dnn_node_example路径下。

  • Linux镜像上启动可执行程序

运行上一步查找到的可执行程序,并且带上launch脚本中parameters参数:/opt/tros/lib/dnn_node_example/example --ros-args -p feed_type:=0 -p image_type:=0 -p dump_render_img:=1

  • 完整的Linux镜像上运行示例

# 配置tros.b环境
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/opt/tros/lib/

# 从tros.b的安装路径中拷贝出运行示例需要的配置文件。config中为example使用的模型,回灌使用的本地图片
cp -r /opt/tros/lib/dnn_node_example/config/ .

# 使用本地jpg格式图片进行回灌预测,并存储渲染后的图片
/opt/tros/lib/dnn_node_example/example --ros-args -p feed_type:=0 -p image_type:=0 -p dump_render_img:=1

交叉编译TogetheROS.Bot源码速度慢

tros.b的package较多,源码编译需要一些时间(8核CPU & 32G内存配置下编译完成大概需要20分钟)。有两种加速方法:

1 最小化编译

编译脚本中提供了两种编译方式,分别为all_build.sh完整编译(手册交叉编译章节中默认的编译方式)和minimal_build.sh最小化编译。其中最小化编译不编译算法示例和测试用例,编译速度快。

使用最小化编译的方法是将手册交叉编译章节中配置编译选项命令./robot_dev_config/all_build.sh替换为./robot_dev_config/minimal_build.sh

2 手动忽略编译不需要的package

在package源码目录下生成COLCON_IGNORE文件,编译的时候将会忽略编译此package。

下载下来的package源码目录在robot_dev_config/ros2_release.repos中指定,例如下载google_benchmark_vendor时配置如下:

  ament/google_benchmark_vendor:
    type: git
    url: https://c-gitlab.horizon.ai/third_party/ament/google_benchmark_vendor.git
    version: v1.0RC1

说明google_benchmark_vendor package源码下载在了src/ament/google_benchmark_vendor路径下,因此执行命令touch src/ament/google_benchmark_vendor/COLCON_IGNORE忽略google_benchmark_vendor package的编译。

是否支持安装使用其他版本ROS?

支持。

旭日X3派上安装了tros.b之后,还可以安装使用其他版本的ROS,包括ROS1。使用时需要注意,一个终端下只能source一个版本的ROS。

此外tros.b与ROS foxy版本接口完全兼容,不需要安装ROS foxy也能够复用ROS丰富工具包。