差别

这里会显示出您选择的修订版和当前版本之间的差别。

到此差别页面的链接

两侧同时换到之前的修订记录 前一修订版
后一修订版
前一修订版
digi:arm-embedded:linux:dey:deycustomrootfs:ros2 [2024/03/07 08:15] robindigi:arm-embedded:linux:dey:deycustomrootfs:ros2 [2024/03/25 03:36] (当前版本) robin
行 9: 行 9:
  
 <code> <code>
-sudo apt update +sudo apt -y update  
-sudo apt install gawk wget git diffstat unzip gcc-multilib +sudo apt -y install gawk wget file git diffstat file unzip texinfo gcc gcc-multilib build-essential chrpath socat cpio python3 python3-pip python3-pexpect python3-distutils python3-subunit xz-utils debianutils iputils-ping python3-git python3-jinja2 libegl1-mesa libsdl1.2-dev pylint xterm  mesa-common-dev g++-multilib locales lsb-release time zstd locales liblz4-tool 
-        build-essential chrpath socat cpio python3-pip python3-pexpect +sudo locale-gen en_US.utf8 
-        xz-utils debianutils iputils-ping +sudo apt -y install python-is-python3
-        python3-git python3-jinja2 libegl1-mesa libsdl1.2-dev xterm +
-        g++-multilib locales lsb-release python3-distutils time +
-        liblz4-tool zstd file +
-sudo locale-gen en_US.utf8  #这条不一定要执行,因为本来就是用默认英文的+
 </code> </code>
  
-2.找出环境变量配置文件备用 +2.安装DEY ALL In One开发环境,本开发环境会把meta-digi和meta-ros都和官方同步,用户只需在配置文件对镜像进行配置。 
-为了整合meta-ros到dey的镜象中有两种办法,一种是meta-ros中的镜像名来编译另一种是参考dey-image-qt创建dey-image-ros并在镜像的recipe里加上关键包的支持。为了调查清楚首先在一个全新的虚拟机上演练一下官方文档安装过程,并检查其配置文件。 +首先要安装repo在ubuntu 22.04中可直接用apt install repo安装如果您发行版不支持这种安装方式请从官方下载安装repo:
 <code> <code>
-mkdir ros2-test +sudo -H tmux 
-cd ros2-test +curl -o /usr/local/bin/repo http://commondatastorage.googleapis.com/git-repo-downloads/repo 
- +chmod a+x /usr/local/bin/repo 
-mkdir conf +exit
-ln -snf ../conf build/. +
- +
-在build/files/下,有一系列的mcf文件,我们需要拷贝ros2-humble-kirkstone.mcf到配置文件下,可见这是控制编译的主本配置文件, +
-cp build/files/ros2-humble-kirkstone conf/.+
 </code> </code>
-上面这个主要是为了研究配置文件,供以碰到问题时参考,可以不做这第2步,先直接拉meta-ros到源码,请参考下面 +好git
- +
-3. DEY的镜像bb文件研读 +
-主要的image配文件在:dey4.0/sources/poky/meta/recipes-core/images和dey4.0/sources/meta-digi/meta-digi-dey/recipes-core/images +
-其中,core-image-base是在poky的基础镜像文件中添加一些包实现的,所以先研读core-image-base基础镜像,它继承自更基础的core-image(sources/poky/meta/classes/core-image.bbclass) +
-接下来将拉取meta-ros,并研读相关的bb文件。 +
- +
-4. 拉取meta-ros +
-下载meta-ros到dey的源码目录下+
 <code> <code>
-cd dey4.0/sources +git config --global user.name  “yourname”    
-git clone https://github.com/ros/meta-ros.git+git config --global user.email "you@email.com“   
 +</code> 
 +接着就可以用repo安装DEY AIO了 
 +<code> 
 +cd 
 +mkdir dey-aio 
 +cd dey-aio 
 +repo init -u https://github.com/peyoot/dey-aio-manifest.git -b china 
 +repo sync
 </code> </code>
  
-我们还需要把这个layer添加到conf/bblayer.conf中,在文件的加上这三句:+3. 配置ROS支持 
 + 
 +我们还需要把这个layer添加到conf/bblayers.conf中,在文件的适当位置插入这三句:
 <code> <code>
   /home/robin/dey-aio/dey4.0/sources/meta-ros/meta-ros-common \   /home/robin/dey-aio/dey4.0/sources/meta-ros/meta-ros-common \
行 52: 行 45:
   /home/robin/dey-aio/dey4.0/sources/meta-ros/meta-ros2-humble \   /home/robin/dey-aio/dey4.0/sources/meta-ros/meta-ros2-humble \
 </code> </code>
 +并在bblayers.conf的配置文件最后添加这两行变量定义:
 +<code>
 +ROS_DISTRO = "humble"
 +ROS_DISTRO_TYPE = "ros2"
 +</code>
 +
 +此时可以尝试编译ros-core
  
-注意下来的目录中meta-ros-common和meta-ros2-humble是我们需要如果要编译ros的镜像,在meta-ros-common中有image相关的recipe,其中:+bitbake ros-core 
 + 
 +5. 检查机器学习相关包 
 +<code> 
 +cat ../../sources/meta-digi/meta-digi-dey/dynamic-layers/meta-ml/recipes-fsl/packagegroup/packagegroup-imx-ml.bbappend 
 +最新的bb文件应该如所录,使用tensorflow-lite,如果不是请按面注释掉原来的一行并添加这一新行 
 +#ML_PKGS:mx9-nxp-bsp:remove = "deepview-rt-examples" 
 +# Only install tensorflow-lite to save space 
 +ML_PKGS:mx9-nxp-bsp:mx93-nxp-bsp = "tensorflow-lite" 
 +</code> 
 +另外,在conf/local.conf中添加机器学习包 
 +IMAGE_INSTALL:append = " packagegroup-imx-ml" 
 + 
 + 
 + 
 +6. 创建带ros支持镜像 
 + 
 +如果要编译ros的镜像,在meta-ros-common中有image相关的recipe,其中:
 cat ros-image-core可以观察,要定义的东西: cat ros-image-core可以观察,要定义的东西:
 <code> <code>
行 161: 行 178:
 bitbake core-image-ros bitbake core-image-ros
 </code> </code>
-首先要排除的是,在ros的三个layer中,对yocto版本限制了,只需把conf/layer.conf中的这句LAYERSERIES_COMPAT_ros-common-layer = "nanbield"中nanbield改为kirkstone,即可。 
- 
-继续编译,碰到一个错误: 
- 
-ERROR: ParseError at /home/robin/dey-aio/dey4.0/sources/meta-ros/meta-ros2/recipes-devtools/python/python3-pydantic_2.5.3.bb:10: Could not inherit file classes/python_hatchling.bbclass ,而python3-pydantic_2.5.3.bb 
- 
-看样子,在meta-digi-dey里放ros镜像的bb是不行的,要大改,试着把这个文件拷到meta-ros-common/recipes-core/images/下,改名为ros-image-dey, 再编译一下看看, 
- 
-此时,碰到的错误是ParseError at /home/robin/dey-aio/dey4.0/sources/meta-ros/meta-ros-common/recipes-core/images/ros-image-dey.bb:29: Could not inherit file classes/ros_humble.bbclass  
- 
-看来,应该是不能直接复制双方的recipe,而要有技巧。 
- 
-根据文档: https://docs.ros.org/en/humble/Tutorials/Beginner-CLI-Tools/Configuring-ROS2-Environment.html ,还是用一个脚本来设置这变量 
- 
-<code> 
-nano ros-env 
- 
-ROS_VERSION=2 
-ROS_PYTHON_VERSION=3 
-ROS_DISTRO=humble 
- 
-chmod +x ros-env 
-source ros-env 
-</code> 
-再编译仍有错,检索https://github.com/ros/meta-ros/wiki/OpenEmbedded-Build-Instructions#add-meta-ros-to-an-existing-openembedded-project, 里面提到没有用mcf配置文件时的一些方法: 
- 
-1. 在conf/bblayers.conf 设置ROS_DISTRO, 因此在这个文件中加上 ROS_DISTRO = "humble" , 此外也加上ROS_DISTRO_TYPE = "ros" 
- 
-2. DISTRO ?= "${MCF_DISTRO}"  没用mcf时,用真实的DISTRO替掉这个变量 
- 
- 
-发现没有把mcf配置文件用起来,一个可能的方案是,把mcf放在 conf/下,另一种情况是合并到conf/local.conf中。  
- 
-注意到最核心的文档是:https://github.com/ros/meta-ros/wiki/OpenEmbedded-Build-Instructions#add-meta-ros-to-an-existing-openembedded-project ,还有https://github.com/ros/meta-ros/tree/master:文档中的History其中提到:\\ 
-The initial port of ROS 2 port was undertaken by Erle Robotics. Their work was shared at this repository and integrated upstream into meta-ros.\\ 
- 
-It has been converted to use recipes generated by superflore. Please see this wiki page for details of what was done and the current development milestones. \\  
-wiki地址就是 
- 
-https://github.com/ros/meta-ros/wiki/Superflore-OE-Recipe-Generation-Scheme 
- 
-应该是ros转用recipe的方法, 
- 
-为了得到ros-core, 折衷一下,先把不用的bb注销掉, 即python那几个错误的bb,改为.bb-rm,不启用。 
- 
-精简一下conf/local.conf ,此时可编译通过: 
-<code> 
- 
- 
-</code> 
- 
-继续除错,主要还是devtool那个目录,应该是版本问题,考虑到不把cc93当成开发电脑,这些python都可以先禁掉\\ 
- 
-/home/robin/dey-aio/dey4.0/sources/poky/meta/recipes-devtools/python/python3-cryptography_36.0.2.bb 
  
-\\ 
  
  
-一个可能有用参考:https://community.nxp.com/t5/i-MX-Processors/I-MX8M-plus-AI-Robot-platform/m-p/1303809#M176520+其它可能有用参考:https://community.nxp.com/t5/i-MX-Processors/I-MX8M-plus-AI-Robot-platform/m-p/1303809#M176520