【PX4-AutoPilot教程-TIPS】MAVROS2运行px4.launch文件报错ValueError无法启动的解决方法

本文主要是介绍【PX4-AutoPilot教程-TIPS】MAVROS2运行px4.launch文件报错ValueError无法启动的解决方法,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

MAVROS2运行px4.launch文件报错ValueError无法启动的解决方法

    • 问题描述
    • 解决方法

环境:

Ubuntu :20.04 LTS

ROS :ROS2 Foxy

PX4 :1.13.0

问题描述

在使用命令ros2 launch mavros px4.launch命令启动MAVROS2与PX4之间的连接时报错,无法启动MAVROS2,报错信息如下。

hccwb@ThinkPad-X1:~$ ros2 launch mavros px4.launch
/opt/ros/foxy/bin/ros2:6: DeprecationWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.htmlfrom pkg_resources import load_entry_point
[INFO] [launch]: All log files can be found below /home/hccwb/.ros/log/2024-04-08-10-33-52-422681-ThinkPad-X1-2141
[INFO] [launch]: Default logging verbosity is set to INFO
Task exception was never retrieved
future: <Task finished name='Task-2' coro=<LaunchService._process_one_event() done, defined at /opt/ros/foxy/lib/python3.8/site-packages/launch/launch_service.py:226> exception=ValueError('$(var log_output) is not a valid standard output config i.e. "screen", "log" or "both"')>
Traceback (most recent call last):File "/opt/ros/foxy/lib/python3.8/site-packages/launch/launch_service.py", line 228, in _process_one_eventawait self.__process_event(next_event)File "/opt/ros/foxy/lib/python3.8/site-packages/launch/launch_service.py", line 248, in __process_eventvisit_all_entities_and_collect_futures(entity, self.__context))File "/opt/ros/foxy/lib/python3.8/site-packages/launch/utilities/visit_all_entities_and_collect_futures_impl.py", line 45, in visit_all_entities_and_collect_futuresfutures_to_return += visit_all_entities_and_collect_futures(sub_entity, context)File "/opt/ros/foxy/lib/python3.8/site-packages/launch/utilities/visit_all_entities_and_collect_futures_impl.py", line 45, in visit_all_entities_and_collect_futuresfutures_to_return += visit_all_entities_and_collect_futures(sub_entity, context)File "/opt/ros/foxy/lib/python3.8/site-packages/launch/utilities/visit_all_entities_and_collect_futures_impl.py", line 45, in visit_all_entities_and_collect_futuresfutures_to_return += visit_all_entities_and_collect_futures(sub_entity, context)[Previous line repeated 3 more times]File "/opt/ros/foxy/lib/python3.8/site-packages/launch/utilities/visit_all_entities_and_collect_futures_impl.py", line 38, in visit_all_entities_and_collect_futuressub_entities = entity.visit(context)File "/opt/ros/foxy/lib/python3.8/site-packages/launch/action.py", line 108, in visitreturn self.execute(context)File "/opt/ros/foxy/lib/python3.8/site-packages/launch_ros/actions/node.py", line 453, in executeret = super().execute(context)File "/opt/ros/foxy/lib/python3.8/site-packages/launch/actions/execute_process.py", line 826, in executelaunch.logging.get_output_loggers(self.__name, self.__output)File "/opt/ros/foxy/lib/python3.8/site-packages/launch/logging/__init__.py", line 409, in get_output_loggersoutput_config = _normalize_output_configuration(output_config)File "/opt/ros/foxy/lib/python3.8/site-packages/launch/logging/__init__.py", line 339, in _normalize_output_configurationraise ValueError((
ValueError: $(var log_output) is not a valid standard output config i.e. "screen", "log" or "both"

在这里插入图片描述

解决方法

分析原因是ROS2 Foxy中MAVROS2的版本问题,Foxy中的MAVROS2 2.4.0版本会有这个问题,但MAVROS2 2.7.0修复了这个问题,所以比较好的解决方案就是自己创建工作空间用MAVROS2 2.7.0搭建环境。

创建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

这篇关于【PX4-AutoPilot教程-TIPS】MAVROS2运行px4.launch文件报错ValueError无法启动的解决方法的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/967541

相关文章

golang中reflect包的常用方法

《golang中reflect包的常用方法》Go反射reflect包提供类型和值方法,用于获取类型信息、访问字段、调用方法等,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值... 目录reflect包方法总结类型 (Type) 方法值 (Value) 方法reflect包方法总结

C# 比较两个list 之间元素差异的常用方法

《C#比较两个list之间元素差异的常用方法》:本文主要介绍C#比较两个list之间元素差异,本文通过实例代码给大家介绍的非常详细,对大家的学习或工作具有一定的参考借鉴价值,需要的朋友参考下吧... 目录1. 使用Except方法2. 使用Except的逆操作3. 使用LINQ的Join,GroupJoin

MySQL查询JSON数组字段包含特定字符串的方法

《MySQL查询JSON数组字段包含特定字符串的方法》在MySQL数据库中,当某个字段存储的是JSON数组,需要查询数组中包含特定字符串的记录时传统的LIKE语句无法直接使用,下面小编就为大家介绍两种... 目录问题背景解决方案对比1. 精确匹配方案(推荐)2. 模糊匹配方案参数化查询示例使用场景建议性能优

关于集合与数组转换实现方法

《关于集合与数组转换实现方法》:本文主要介绍关于集合与数组转换实现方法,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐教... 目录1、Arrays.asList()1.1、方法作用1.2、内部实现1.3、修改元素的影响1.4、注意事项2、list.toArray()2.1、方

Python中注释使用方法举例详解

《Python中注释使用方法举例详解》在Python编程语言中注释是必不可少的一部分,它有助于提高代码的可读性和维护性,:本文主要介绍Python中注释使用方法的相关资料,需要的朋友可以参考下... 目录一、前言二、什么是注释?示例:三、单行注释语法:以 China编程# 开头,后面的内容为注释内容示例:示例:四

Redis出现中文乱码的问题及解决

《Redis出现中文乱码的问题及解决》:本文主要介绍Redis出现中文乱码的问题及解决,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐教... 目录1. 问题的产生2China编程. 问题的解决redihttp://www.chinasem.cns数据进制问题的解决中文乱码问题解决总结

一文详解Git中分支本地和远程删除的方法

《一文详解Git中分支本地和远程删除的方法》在使用Git进行版本控制的过程中,我们会创建多个分支来进行不同功能的开发,这就容易涉及到如何正确地删除本地分支和远程分支,下面我们就来看看相关的实现方法吧... 目录技术背景实现步骤删除本地分支删除远程www.chinasem.cn分支同步删除信息到其他机器示例步骤

在Golang中实现定时任务的几种高效方法

《在Golang中实现定时任务的几种高效方法》本文将详细介绍在Golang中实现定时任务的几种高效方法,包括time包中的Ticker和Timer、第三方库cron的使用,以及基于channel和go... 目录背景介绍目的和范围预期读者文档结构概述术语表核心概念与联系故事引入核心概念解释核心概念之间的关系

在Linux终端中统计非二进制文件行数的实现方法

《在Linux终端中统计非二进制文件行数的实现方法》在Linux系统中,有时需要统计非二进制文件(如CSV、TXT文件)的行数,而不希望手动打开文件进行查看,例如,在处理大型日志文件、数据文件时,了解... 目录在linux终端中统计非二进制文件的行数技术背景实现步骤1. 使用wc命令2. 使用grep命令

Python中Tensorflow无法调用GPU问题的解决方法

《Python中Tensorflow无法调用GPU问题的解决方法》文章详解如何解决TensorFlow在Windows无法识别GPU的问题,需降级至2.10版本,安装匹配CUDA11.2和cuDNN... 当用以下代码查看GPU数量时,gpuspython返回的是一个空列表,说明tensorflow没有找到