【PX4-AutoPilot教程-TIPS】MAVROS2运行px4.launch文件终端mavros.odometry重复报错map和base_link_frd连接错误的解决方法

MAVROS2运行px4.launch文件终端mavros.odometry重复报错map和base_link_frd连接错误的解决方法

环境:

Ubuntu :20.04 LTS

ROS :ROS2 Foxy

PX4 :1.13.0

问题描述

在使用命令ros2 launch mavros px4.launch命令启动MAVROS2与PX4之间的连接时,MAVROS2可以启动,但终端重复报错,这个重复报错好像不影响使用,报错信息如下。

[mavros_node-1] [ERROR] [1712544758.102953817] [mavros.odometry]: ODOM: Ex: Could not find a connection between 'map' and 'base_link_frd' because they are not part of the same tree.Tf has two or more unconnected trees.

在这里插入图片描述

解决方法

分析原因是可能与ros-foxy-mavros-extras软件包有关,卸载该包在一定程度上可以解决重复报错的问题

sudo apt-get purge ros-foxy-mavros-extras

如果没有效果的话也可以在mavros/mavros/launch文件夹中的px4_pluginlists.yaml文件中添加一行- odometry禁用odometry模块,也可以解决重复报错的问题。

/**:
  ros__parameters:
    plugin_denylist:
      # common
      - odometry

      # extras
      - image_pub
      - vibration
      - distance_sensor
      - rangefinder
      - wheel_odometry

    # plugin_allowlist:
    #   - 'sys_*'

安装并测试MAVROS2的方法

创建ROS2工作空间。

mkdir -p ~/mavros2_ws/src
cd ~/mavros2_ws

下载MAVLink和MAVROS2源码。

source /opt/ros/foxy/setup.bash
rosinstall_generator --format repos mavlink | tee /tmp/mavlink.repos
rosinstall_generator --format repos --upstream mavros | tee -a /tmp/mavros.repos
vcs import src < /tmp/mavlink.repos
vcs import src < /tmp/mavros.repos
rosdep install --from-paths src --ignore-src -y

安装依赖数据集。

sudo ./src/mavros/mavros/scripts/install_geographiclib_datasets.sh

从github官网下载MAVROS2的ros2分支的最新版本代码,替换mavros2_ws/src文件夹中的mavros文件夹。

MAVROS2

编译工作空间。

source ~/mavros2_ws/install/setup.bash
colcon build

新建一个终端,测试MAVROS2能否正常启动。

source /opt/ros/foxy/setup.bash
source ~/mavros2_ws/install/setup.bash
ros2 launch mavros px4.launch

参考资料:

How to use mavros2

  • 7
    点赞
  • 10
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

后厂村路练习生

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值