差别
这里会显示出您选择的修订版和当前版本之间的差别。
两侧同时换到之前的修订记录 前一修订版 后一修订版 | 前一修订版 | ||
digi:arm-embedded:linux:dey:deycustomrootfs:ros2 [2024/03/06 15:47] – robin | digi:arm-embedded:linux:dey:deycustomrootfs:ros2 [2024/03/25 03:36] (当前版本) – robin | ||
---|---|---|---|
行 9: | 行 9: | ||
< | < | ||
- | 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 |
- | | + | sudo locale-gen en_US.utf8 |
- | | + | sudo apt -y install python-is-python3 |
- | | + | |
- | | + | |
- | | + | |
- | sudo locale-gen en_US.utf8 | + | |
</ | </ | ||
- | 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: |
< | < | ||
- | mkdir ros2-test | + | sudo -H tmux |
- | cd ros2-test | + | curl -o /usr/local/bin/repo http:// |
- | + | chmod a+x /usr/local/bin/repo | |
- | mkdir conf | + | exit |
- | ln -snf ../conf build/. | + | |
- | + | ||
- | 在build/files/ | + | |
- | cp build/files/ros2-humble-kirkstone conf/. | + | |
</ | </ | ||
- | 上面这个主要是为了研究配置文件,供以后碰到问题时参考,可以不做这第2步,先直接拉meta-ros到源码,请参考下面 | + | 然后设置好git |
- | + | ||
- | 3. DEY的镜像bb文件研读 | + | |
- | 主要的image配置文件在:dey4.0/ | + | |
- | 其中,core-image-base是在poky的基础镜像文件中添加一些包实现的,所以先研读core-image-base基础镜像,它继承自更基础的core-image(sources/ | + | |
- | 接下来将拉取meta-ros,并研读相关的bb文件。 | + | |
- | + | ||
- | 4. 拉取meta-ros | + | |
- | 下载meta-ros到dey的源码目录下 | + | |
< | < | ||
- | cd dey4.0/sources | + | git config --global user.name “yourname” |
- | git clone https:// | + | git config --global user.email " |
+ | </ | ||
+ | 接着就可以用repo安装DEY AIO了 | ||
+ | < | ||
+ | cd | ||
+ | mkdir dey-aio | ||
+ | cd dey-aio | ||
+ | repo init -u https:// | ||
+ | repo sync | ||
</ | </ | ||
- | 我们还需要把这个layer添加到conf/ | + | 3. 配置ROS支持 |
+ | |||
+ | 我们还需要把这个layer添加到conf/ | ||
< | < | ||
/ | / | ||
行 52: | 行 45: | ||
/ | / | ||
</ | </ | ||
+ | 并在bblayers.conf的配置文件最后添加这两行变量定义: | ||
+ | < | ||
+ | ROS_DISTRO = " | ||
+ | ROS_DISTRO_TYPE = " | ||
+ | </ | ||
+ | |||
+ | 此时可以尝试编译ros-core | ||
- | 注意下载下来的目录中,meta-ros-common和meta-ros2-humble是我们需要的。如果要编译ros的镜像,在meta-ros-common中有image相关的recipe,其中: | + | bitbake ros-core |
+ | |||
+ | 5. 检查机器学习相关包 | ||
+ | < | ||
+ | cat ../ | ||
+ | 最新的bb文件应该如下所录,使用tensorflow-lite,如果不是请按下面注释掉原来的一行,并添加这一新行 | ||
+ | # | ||
+ | # Only install tensorflow-lite to save space | ||
+ | ML_PKGS: | ||
+ | </ | ||
+ | 另外,在conf/ | ||
+ | IMAGE_INSTALL: | ||
+ | |||
+ | |||
+ | |||
+ | 6. 创建带ros支持的镜像 | ||
+ | |||
+ | 如果要编译ros的镜像,在meta-ros-common中有image相关的recipe,其中: | ||
cat ros-image-core可以观察,要定义的东西: | cat ros-image-core可以观察,要定义的东西: | ||
< | < | ||
行 161: | 行 178: | ||
bitbake core-image-ros | bitbake core-image-ros | ||
</ | </ | ||
- | 首先要排除的是,在ros的三个layer中,对yocto版本限制了,只需把conf/ | ||
- | 继续编译,碰到一个错误: | ||
- | |||
- | ERROR: ParseError at / | ||
- | |||
- | 看样子,在meta-digi-dey里放ros镜像的bb是不行的,要大改,试着把这个文件拷到meta-ros-common/ | ||
- | |||
- | 此时,碰到的错误是ParseError at / | ||
- | |||
- | 看来,应该是不能直接复制双方的recipe,而要有技巧。 | ||
- | |||
- | 根据文档: | ||
- | |||
- | < | ||
- | nano ros-env | ||
- | |||
- | ROS_VERSION=2 | ||
- | ROS_PYTHON_VERSION=3 | ||
- | ROS_DISTRO=humble | ||
- | |||
- | chmod +x ros-env | ||
- | source ros-env | ||
- | </ | ||
- | 再编译仍有错,检索https:// | ||
- | |||
- | 1. 在conf/ | ||
- | |||
- | 2. DISTRO ?= " | ||
- | |||
- | |||
- | 发现没有把mcf配置文件用起来,一个可能的方案是,把mcf放在 conf/ | ||
- | |||
- | 注意到最核心的文档是:https:// | ||
- | 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:// | ||
- | |||
- | 应该是ros转用recipe的方法, | ||
- | |||
- | |||
- | |||
- | |||
- | . | ||
- | |||
- | . | ||
- | |||
- | . | ||
- | . | ||
- | |||
- | . | ||
- | |||
- | . | ||
- | |||
- | 以下无用 | ||
- | |||
- | |||
- | |||
- | |||
- | 。 | ||
- | |||
- | 。 | ||
- | |||
- | 。 | ||
- | |||
- | |||
- | 接下来的方向是: | ||
- | |||
- | 1. 尝试编译core-image-minimal \\ | ||
- | 2. 添加相关digi包 \\ | ||
- | 或\\ | ||
- | 比较core-image-minimal和core-image-base的差异,如果不大,则\\ | ||
- | 1.ros-image-core改为以core-image-base为基础的镜像, | ||
- | |||
- | 正在进行的任务: | ||
- | 1. 编译一下core-image-minial ,并在cc93上跑起来,看看有哪些东西 | ||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | *****以下无用待参考后删除, 相关配置文件中的一些敲定可能有需要 | ||
- | |||
- | |||
- | 待参考 | ||
- | |||
- | 待删除 | ||
- | 。。 | ||
- | |||
- | 。。 | ||
- | |||
- | 。。 | ||
- | |||
- | < | ||
- | ******************************** | ||
- | |||
- | # Clone the OpenEmbedded metadata layers and generate conf/ | ||
- | build/ | ||
- | |||
- | # Set up the shell environment for this build and create a conf/ | ||
- | unset BDIR BITBAKEDIR BUILDDIR OECORELAYERCONF OECORELOCALCONF OECORENOTESCONF OEROOT TEMPLATECONF | ||
- | source openembedded-core/ | ||
- | |||
- | # The current directory is now the build directory; return to the original. | ||
- | cd - | ||
- | |||
- | # An OpenEmbedded build produces a number of types of build artifacts, some of which can be shared between builds for | ||
- | # different OpenEmbedded DISTRO-s and ROS distros. Create a common artifacts directory on the separate disk under which all | ||
- | # the build artifacts will be placed. The edits to conf/ | ||
- | mkdir -p "< | ||
- | </ | ||
- | |||
- | |||
- | ====以下待删除 | ||
- | --- | ||
- | |||
- | 在[[http:// | ||
- | |||
- | meta-ros提供了两个镜像参考,分别是最小的core-image-ros-roscore以及扩展的core-image-ros-world | ||
- | 检查这两个bb文件,core-image-ros-world集成有packagegroup-ros-world,这个bb文件在https:// | ||
- | 可以发现,这个镜像带有canopen等众多应用层的包,不过这个镜像模板并不是以dey为基础的,为了能在dey里面用,应该把相关的包编译进dey中,甚至在熟练后可以做一个dey-image-ros的镜像bb文件来打包编译所需的镜像 | ||
- | |||
- | 要把第三方的layer添加到项目中,请按下面这个方式操作: | ||
- | < | ||
- | 1、 cd / | ||
- | 2、 git clone https:// | ||
- | |||
- | 3. 在项目文件夹中conf/ | ||
- | 4. 查一下相关的包:bitbake-layers show-recipes |grep ros | ||
- | 现在可以编译指定包甚至是roscore镜像 | ||
- | 5. bitbake core-image-ros-roscore | ||
- | |||
- | </ | ||
- | 要把canopen等ros的包添加到dey镜像中,可参考参考[[digi: | ||
- | |||
- | 调试过程: | ||
- | 因为最初编译core-image-ros-world没过,所以展开调试排错,先试着编译一个socketcan_interface | ||
- | 出错时注意那些错误信息:比如这次是: | ||
- | < | ||
- | ...undefined reference to symbol ' | ||
- | .......error adding symbols:DSO missing from command line | ||
- | </ | ||
- | google一下" | ||
- | 注意,如果您在tmp/ | ||
+ | 其它可能有用参考:https:// | ||