今天终于将MIPI Camera在web端显示出来了,其实很简单的事情,但是因为一个网络的问题,自己研究了好几天,查遍了论坛所有帖子,最后还是在地平线专家们的指导下,发现问题所在。

言归正传,将自己的过程记录下来。

在系统正常启动,串口登录之后,

想要在web端显示,需要以下准备工作。

一,确认摄像头F37正确接到开发板上。

1.5.8. MIPI摄像头

开发板提供1路MIPI CSI接口(接口2),可实现MIPI摄像头的接入。目前开发板配件提供了2种规格的摄像头模组,以满足不同用户的功能需求。模组型号、规格如下:

序号 Sensor 分辨率 FOV I2C 设备地址
1 GC4663 400W H:104 V:70 D:113 0x29
2 JXF37 200W H:62 V:37 D:68 0x40

摄像头模组通过24pin异面FPC排线跟开发板连接,注意排线两端蓝面向上插入连接器

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

以JXF37摄像头模组为例,安装完成后如下图:

安装完成后,用户可以通过i2cdetect命令确认模组I2C地址能否正常检测到。如检测不到,用户需要检查FPC排线连接是否正常。成功探测到I2C地址时,log打印如下所示:

# 首先使能sensor的24MHz主时钟
sunrise@ubuntu:~# sudo bash -c "echo 1 > /sys/class/vps/mipi_host0/param/snrclk_en"
sunrise@ubuntu:~# sudo bash -c "echo 24000000 > /sys/class/vps/mipi_host0/param/snrclk_freq"
# 执行 i2cdetect 命令探测, 其中显示的 40 即F37这颗sensor的i2c设备地址
sunrise@ubuntu:~# sudo i2cdetect -y -r 10  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: -- -- -- -- -- -- -- --                         

二,确认PC可以通过网络访问开发板。(以WIFI为例)

1,连接WFI

扫描wifi:

sudo nmcli device wifi rescan

列出WIFI列表:

nmcli device wifi list

连接WiFi:

sudo wifi_connect "wifi名" "密码"

2,SSH远程登录

SSH登录

用户在PC机上,可以通过SSH连接实现开发板命令行的远程登录。SSH连接的创建方式,主要有终端软件、PC机命令行两种方式。下面介绍两种连接方法的创建步骤。

终端软件
目前常用终端工具有PuttySecureCRTMobaXterm等,用户可根据自身使用习惯来选择。不同工具的端口配置流程基本类似,下面以MobaXterm为例,介绍新建SSH连接过程:

  • 打开MobaXterm工具,点击Session,然后选择SSH

  • 输入开发板IP地址,例如192.168.1.10

  • 选中specify username,输入sunrise

  • 点击OK后,输入用户名、密码即可完成登录

三,TogetherROS及ROS2 package安装

1. TogetherROS通过DEB包安装

前提:

  • 已完成2.1章节环境准备工作

  • 旭日X3派能够正常访问互联网

  • 旭日X3派能够远程ssh

注意:这里使用的旭日X3派IP为10.64.61.241,安装时需要根据自己的旭日X3派IP进行替换

登录旭日X3派

ssh root@10.64.61.241

安装HHP.deb包,sudo apt install hhp

root@ubuntu:~# sudo apt install hhp
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:hhp
0 upgraded, 1 newly installed, 0 to remove and 52 not upgraded.
Need to get 384 MB of archives.
After this operation, 512 MB of additional disk space will be used.
Get:1 http://42.62.85.28/ubuntu-ports focal/main arm64 hhp arm64 1.0.1 [384 MB]
Fetched 384 MB in 6min 43s (954 kB/s)
Selecting previously unselected package hhp.
(Reading database ... 110406 files and directories currently installed.)
Preparing to unpack .../archives/hhp_1.0.1_arm64.deb ...
Unpacking hhp (1.0.1) ...
Setting up hhp (1.0.1) ...
Generating locales (this might take a while)...en_US.ISO-8859-1... doneen_US.UTF-8... done
Generation complete.

查看/opt目录下文件

root@ubuntu:/userdata# ls /opt/
tros

可以看到HorizonHobotPlatform(HHP)已安装在/opt目录下

注意:安装软件时,执行命令sudo apt install hhp,出现如下错误:

E: Unable to locate package hhp

解决方法:

sudo apt-get update     就好了

2,ROS2 package 安装

前提:已成功安装TogetherROS

TogetherROS与ROS foxy版本接口完全兼容,能够复用ROS丰富工具包,这里以安装和使用ROS foxy版本ros-foxy-image-transport为例介绍如何在TogetherROS中使用ROS package。

1 添加ROS apt源

添加ROS apt源

sudo apt update && sudo apt install curl gnupg2 lsb-release
sudo curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.key  -o /usr/share/keyrings/ros-archive-keyring.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/ros-archive-keyring.gpg] http://packages.ros.org/ros2/ubuntu $(source /etc/os-release && echo $UBUNTU_CODENAME) main" | sudo tee /etc/apt/sources.list.d/ros2.list > /dev/null

更新apt仓库

sudo apt update

2 安装packages

sudo apt install ros-foxy-image-transport
sudo apt install ros-foxy-image-transport-plugins

3 建立软连接

cd /opt/tros
## 使用/opt/tros目录下的create_soft_link.py创建ROS package至TogetherROS的软连接
sudo python3 create_soft_link.py --foxy /opt/ros/foxy/ --tros /opt/tros/

使用ROS2 package

与ROS使用一样

source /opt/tros/local_setup.bash
ros2 run image_transport list_transports

运行结果如下,展示了image_transport package支持的图像格式

root@ubuntu:/opt/tros# ros2 run image_transport list_transports
Declared transports:
image_transport/compressed
image_transport/compressedDepth
image_transport/raw
image_transport/theoraDetails:
----------
"image_transport/compressed"- Provided by package: compressed_image_transport- Publisher:This plugin publishes a CompressedImage using either JPEG or PNG compression.- Subscriber:This plugin decompresses a CompressedImage topic.----------
"image_transport/compressedDepth"- Provided by package: compressed_depth_image_transport- Publisher:This plugin publishes a compressed depth images using PNG compression.- Subscriber:This plugin decodes a compressed depth images.----------
"image_transport/raw"- Provided by package: image_transport- Publisher:This is the default publisher. It publishes the Image as-is on the base topic.- Subscriber:This is the default pass-through subscriber for topics of type sensor_msgs/Image.----------
"image_transport/theora"- Provided by package: theora_image_transport- Publisher:This plugin publishes a video packet stream encoded using Theora.- Subscriber:This plugin decodes a video packet stream encoded using Theora.

四,准备完成,开启程序

启动 web_service 服务

在使用 web 展示之前,确保板子与个人PC机处于同一网段,并且PC可以访问板子的IP。

执行如下命令启动web service

cd /app/ai_inference/05_web_display_camera_sample/
sudo sh ./start_nginx.sh
sudo python3 ./mipi_camera_web.py 在这里出现了以下错误:
root@ubuntu:/app/ai_inference/05_web_display_camera_sample# sudo python3 ./mipi_camera_web.py[C][6444][08-08][20:43:17:400][configuration.cpp:51][EasyDNN]EasyDNN version: 0.3.5[BPU_PLAT]BPU Platform Version(1.3.1)![HBRT] set log level as 0. version = 3.13.27ioctl read error, ret = -1 error = 121keros_i2c_read failedioctl write error, ret = -1 error = 121keros_i2c_write failedioctl write error, ret = -1 error = 121keros_i2c_write failedioctl read error, ret = -1 error = 121keros_i2c_read failedioctl read error, ret = -1 error = 121keros_i2c_read failedioctl read error, ret = -1 error = 121keros_i2c_read failedioctl read error, ret = -1 error = 121keros_i2c_read failedioctl read error, ret = -1 error = 121keros_i2c_read failed[000:000] (keros_util.cpp:99): keros_authentication failed, ret = 0[000:000] (configuration.cpp:147): Keros key init failed.[DNN] Runtime version = 1.8.4_(3.13.27 HBRT)[HorizonRT] The model builder version = 1.5.2[ERROR][sensor][f37_utility.c:253] not support mode 0[ERROR]["LOG"][utility/hb_cam_utility.c:909] sensor_init fail[ERROR]["LOG"][utility/hb_cam_utility.c:1004] hb_sensor_init_process fail[ERROR]["mipi"][mipi/hb_mipi_api.c:225] hb_cam_utility_ex error![ERROR]["LOG"][/home/hobot/1-work/08_bsp/hbre/hb_ubuntu/hb_vio_python/x3_sdk/x3_sdk_swap/src/x3_vio_vin.c:100] hb mipi init sensor error![ERROR]["LOG"][/home/hobot/1-work/08_bsp/hbre/hb_ubuntu/hb_vio_python/x3_sdk/x3_sdk_swap/src/x3_vio_vin.c:224] x3_sensor_init error!2022/08/08 20:43:17.561 ERROR [x3_cam_init][0139]x3_vin_init failed, -1
解决方法:重新启动程序,显示成功 

【地平线旭日X3派试用体验】基于MIPI Camera的目标检测 web 端展示,全流程(第三节)相关推荐

  1. 【地平线旭日X3派试用体验】经典小游戏打坦克(按键版,待实现手势版)

    前言 本文以经典的打坦克游戏为例,体验下在本开发板环境下高效的Qt程序的开发. 后续考虑加上手势识别,用手势控制替代按键控制,实现体感游戏. 测试过程 下载源码 git clone(详见文末) cd ...

  2. 【地平线旭日X3派试用体验】变身红白机玩转NES游戏

    InfoNES 安装SDL sudo apt install libsdl1.2-dev 下载代码 git clone GitHub - qinyunti/InfoNES-1: NES Emulato ...

  3. 【地平线旭日X3派试用体验】WIFI连接,SSH登录,TogetherROS安装(第二节)

    我短期目标是想将F37摄像头采集的数据,在电脑web端显示出来,在这之前需要有几项准备工作. F37摄像头已从淘宝购买到货,这一节介绍WIFI 连接,SSH登录,TogetherROS安装. 一,WI ...

  4. 地平线旭日X3派试用 | ssh密钥登陆 蓝牙手柄连入ros

    1.ssh密钥登陆 ssh登陆开发作为必修课,默认密码登陆不安全又得每次输密码,有点不雅,改之.在windows上使用的是Fluent Terminal(个人使用习惯). 1.1 因为经常使用macb ...

  5. PPYOLO垃圾检测+地平线旭日X3派部署(下)

    请点击此处查看本环境基本用法. Please click here for more detailed instructions. 1. 简介 在上一个教程中,我们介绍了如何利用百度PaddlePad ...

  6. 地平线旭日X3派小白上手

    1.购买 各个经销商对地平线旭日X3派2G板的统一报价是499,但各种套餐中价格有差异,建议选用带散热和串口的套餐,原因是CPU发热量还是有点大的,板载调试接口是2.0间距,大部分人手头没有这种杜邦线 ...

  7. 基于flask的YOLO目标检测web服务及接口

    这个小项目是基于flask微型目标检测服务.使用的是YOLOv3版本,使用的是在coco数据集上已经训练好的参数.整个目录结构如下(我运行的环境是window10,pycharm): 其中: cfg是 ...

  8. 地平线旭日X3派(一)系统配置

    一.SSH登录 1.1 串口配置+串口登录 1.1.1无线网络配置 1.2 SSH登录 1.3 修改文件 用vim 1.4 安装togetherROS 1.4.1 安装ROS2-foxy 安装基础功能 ...

  9. [首发] 多方位玩转“地平线新发布AIoT开发板——旭日X3派(Sunrise x3 Pi)” 插电!开机!轻松秒杀!

    有幸在发布会前拿到了开发板,可以提前对开发板测试,感受下新品AIoT的魅力.(我这个是体验装,不花钱,需要啥设备他们还得给我买→_→) 下面我将以自己的科研项目经历来对这款芯片进行评估,简单来说,就是 ...

  10. AI 边缘计算平台 - RK3588 / 旭日 X3 派 / 爱芯派 AX620A / K510 简介

    今年的双 11,看起来好像没有往年那么火,各大厂家优惠的力度感觉也不是很大.盘点一下 AI 边缘计算平台,发现有几款性价比还比较高平台的加入,值得大家考察一番. 我将几款性价比还不错的平台做了整理,列 ...

最新文章

  1. Linux分区的认识
  2. 4月30日或为上半年“最难打车日”
  3. msg批量转html,SysTools MSG Converter(MSG格式转换器)
  4. 扫地机器人湿地_什么品牌的扫地机器人性价比最高?
  5. AJAX+json+jquery实现预加载瀑布流布局
  6. spring学习(50):延迟加载
  7. LeetCode:Rotate Image
  8. 数据科学和人工智能技术笔记 十、模型选择
  9. [YOLO] libtorch-yolov3 代码下载
  10. 947. 移除最多的同行或同列石头2021-01-23
  11. opencv函数之saturate_cast(防止溢出)
  12. 【LeetCode】【数组】题号:*665,非递减数列
  13. 【python简洁之道】-----1. 注释规则
  14. 单片机c语言常用的语句有几条,单片机C语言教程-基础语句
  15. 安装软件提示计算机管理员权限,Win7安装软件需要管理员权限的解决方法
  16. [置顶] 高效前端优化工具--Fiddler入门教程
  17. 控制工程中的数学建模(4)——控制系统时域数学模型建立的一般步骤(之一)
  18. KafKa - 集群模式搭建
  19. Ti芯片 bq76940锂电池管理系统BMS资料,源程序+PDF原理图,主控stm32f030。
  20. 幼儿python编程书籍_少儿Python编程入门书籍分享

热门文章

  1. Attributes as Operators
  2. 用python对《三国演义》的人物出场进行统计
  3. 每天学点Vue,学习笔记---DAY4
  4. 投屏设置 android,上班摸鱼神器 Anlink安卓手机投屏操作体验
  5. 如何使用奥特歌词制作双语LRC字幕
  6. Codeforces Round #496 (Div. 3) E2 - Median on Segments (General Case Edition)(思维+用bit 位求前缀合)
  7. MATLAB实现空间前方交会-后方交会计算
  8. CI 与 CD 有什么区别
  9. CorAl – Are the point clouds Correctly Aligned?
  10. The JAVA_HOME environment variable is not defined correctly(亲测有效)