2020年2月17日月曜日

ultra96+petalinux+ros2 dashingでturtlebotをgazeboで動かすまでのメモ


以下のSuperfloreを利用してレシピを生成する。
https://github.com/ros/meta-ros/wiki/Superflore-OE-Recipe-Generation-Scheme

navigation2のチュートリアル

https://ros-planning.github.io/navigation2/getting_started/index.html#running-the-example


ros2レシピ生成した後の解析でエラーはくやつを探して消す。buildでcatkin指定しているものはとりあえず消しておく。
grep 'ROS_BUILD_TYPE = "catkin"' -rl ./meta-ros2-dashing/

ROS_UNRESOLVED_PLATFORM_PKGを解決する。=>いらなかった模様。レシピインストール時に問題となったら考える。

clang-format

boost_python3が足りないと言われた。
local.confに以下を追加とのこと。(https://www.yoctoproject.org/pipermail/yocto/2015-April/024351.html)
PACKAGECONFIG_pn-boost = "python"
 
libboost_python3が見つからなかったので、以下のパッチを適用。do_install_appendとして適用 
https://patchwork.openembedded.org/patch/155696/ 

glibcのtaskhashもmismatchしたのでlocked-sig.incから消去。
glibc-localeも同様。

以下のパッチのバージョン指定に誤りがあったためビルドが通らず。
誤:meta-ros2-dashing/recipes-bbappends/vision-opencv/cv-bridge_2.1.3-1.bbappend
正:meta-ros2-dashing/recipes-bbappends/vision-opencv/cv-bridge_2.1.4-1.bbappend
エラーが取れたらパッケージを導入する。
project_spec/meta-plnx-generated/recipes-core/images/petalinux-user-image.bbでIMAGE_INSTALLに次を追加
・packagegroup-ros-turtlebot3-core
・packagegroup-ros-turtlebot3-extended
=================================================================

ros2のネットワークが落ちているとうまくトピック認識できない件について
 
以下のようにbr0とtap0を作る 
sudo brctl addbr br0
sudo ip addr add 10.0.2.2/16 dev br0
sudo ip link set br0 up
sudo ip tuntap add user akira mode tap
sudo dnsmasq --interface=br0 --bind-interfaces --dhcp-range=10.0.2.3,10.0.2.254


-net nic -net nic -net nic -net nic,netdev=my_tap0 -netdev tap,ifname=tap0,id=my_tap0
をQEMU動作の引数として渡す。 =>guestからhostへros2 topic流れてくるようになったが、host側でros2 topic echo /chatterすると、 Could not determine the type for the passed topicというメッセージが出る。
パケットキャプチャの結果、IPフラグメント通信の問題と思われる。cadence_gem.cが怪しいと思うので調査。qemu-xilinxのデバッグフラグを有効にする。locked-sig.incからqemu-xilinxを削除。


SRC_URI_append ="\
    file://0001-enable-cadence_gem-debug-flag.patch \
"
FILESEXTRAPATHS_prepend := "${THISDIR}/files:"


EXTRA_OECONF_append = " \
                --enable-debug \
                "



From 1652e2bd5b1eb896774045f0ac06ea1887abb87d Mon Sep 17 00:00:00 2001
From: Akira Nishiyama <xxxxxxxx@gmail.com>
Date: Mon, 17 Feb 2020 00:29:30 +0900
Subject: [PATCH] enable cadence_gem debug flag

---
 hw/net/cadence_gem.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/net/cadence_gem.c b/hw/net/cadence_gem.c
index 26d8d5e693..74e5118be5 100644
--- a/hw/net/cadence_gem.c
+++ b/hw/net/cadence_gem.c
@@ -31,7 +31,7 @@
 #include "net/checksum.h"
 #include "exec/address-spaces.h"

-#define CADENCE_GEM_ERR_DEBUG 0
+#define CADENCE_GEM_ERR_DEBUG 1
 #define DB_PRINT(...) do {\
     if (CADENCE_GEM_ERR_DEBUG) {   \
         qemu_log(": %s: ", __func__); \
-- 
2.17.1

qemu実行後にtx側のチェックサムオフロードやめるだけで問題は解決するので特に修正はしない。


pingとros2 multicastのテスト結果を記載する。

HOSTのみでの起動確認
$/opt/ros/dashing/lib/robot_state_publisher/robot_state_publisher /opt/ros/dashing/share/turtlebot3_description/urdf/turtlebot3_waffle.urdf

$ros2 run rviz2 rviz2 -d /opt/ros/dashing/share/nav2_bringup/launch/nav2_default_view.rviz

$ /opt/ros/dashing/lib/nav2_lifecycle_manager/lifecycle_manager

$gazebo -s libgazebo_ros_init.so /opt/ros/dashing/share/turtlebot3_gazebo/worlds/turtlebot3_worlds/waffle.model



================================================
QEMU側

ethtool -K eth0 tx off
export ROS_MASTER_URI=http://10.0.2.49:11311
export ROS_IP=10.0.2.49
export ROS_HOSTNAME=10.0.2.49
export ROS_DOMAIN_ID=1
source ros_setup.sh


0 件のコメント:

コメントを投稿