【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

相关文章

Nginx设置连接超时并进行测试的方法步骤

《Nginx设置连接超时并进行测试的方法步骤》在高并发场景下,如果客户端与服务器的连接长时间未响应,会占用大量的系统资源,影响其他正常请求的处理效率,为了解决这个问题,可以通过设置Nginx的连接... 目录设置连接超时目的操作步骤测试连接超时测试方法:总结:设置连接超时目的设置客户端与服务器之间的连接

Java判断多个时间段是否重合的方法小结

《Java判断多个时间段是否重合的方法小结》这篇文章主要为大家详细介绍了Java中判断多个时间段是否重合的方法,文中的示例代码讲解详细,感兴趣的小伙伴可以跟随小编一起学习一下... 目录判断多个时间段是否有间隔判断时间段集合是否与某时间段重合判断多个时间段是否有间隔实体类内容public class D

Python使用国内镜像加速pip安装的方法讲解

《Python使用国内镜像加速pip安装的方法讲解》在Python开发中,pip是一个非常重要的工具,用于安装和管理Python的第三方库,然而,在国内使用pip安装依赖时,往往会因为网络问题而导致速... 目录一、pip 工具简介1. 什么是 pip?2. 什么是 -i 参数?二、国内镜像源的选择三、如何

IDEA编译报错“java: 常量字符串过长”的原因及解决方法

《IDEA编译报错“java:常量字符串过长”的原因及解决方法》今天在开发过程中,由于尝试将一个文件的Base64字符串设置为常量,结果导致IDEA编译的时候出现了如下报错java:常量字符串过长,... 目录一、问题描述二、问题原因2.1 理论角度2.2 源码角度三、解决方案解决方案①:StringBui

Linux使用nload监控网络流量的方法

《Linux使用nload监控网络流量的方法》Linux中的nload命令是一个用于实时监控网络流量的工具,它提供了传入和传出流量的可视化表示,帮助用户一目了然地了解网络活动,本文给大家介绍了Linu... 目录简介安装示例用法基础用法指定网络接口限制显示特定流量类型指定刷新率设置流量速率的显示单位监控多个

Java覆盖第三方jar包中的某一个类的实现方法

《Java覆盖第三方jar包中的某一个类的实现方法》在我们日常的开发中,经常需要使用第三方的jar包,有时候我们会发现第三方的jar包中的某一个类有问题,或者我们需要定制化修改其中的逻辑,那么应该如何... 目录一、需求描述二、示例描述三、操作步骤四、验证结果五、实现原理一、需求描述需求描述如下:需要在

JavaScript中的reduce方法执行过程、使用场景及进阶用法

《JavaScript中的reduce方法执行过程、使用场景及进阶用法》:本文主要介绍JavaScript中的reduce方法执行过程、使用场景及进阶用法的相关资料,reduce是JavaScri... 目录1. 什么是reduce2. reduce语法2.1 语法2.2 参数说明3. reduce执行过程

C#中读取XML文件的四种常用方法

《C#中读取XML文件的四种常用方法》Xml是Internet环境中跨平台的,依赖于内容的技术,是当前处理结构化文档信息的有力工具,下面我们就来看看C#中读取XML文件的方法都有哪些吧... 目录XML简介格式C#读取XML文件方法使用XmlDocument使用XmlTextReader/XmlTextWr

mybatis和mybatis-plus设置值为null不起作用问题及解决

《mybatis和mybatis-plus设置值为null不起作用问题及解决》Mybatis-Plus的FieldStrategy主要用于控制新增、更新和查询时对空值的处理策略,通过配置不同的策略类型... 目录MyBATis-plusFieldStrategy作用FieldStrategy类型每种策略的作

C++初始化数组的几种常见方法(简单易懂)

《C++初始化数组的几种常见方法(简单易懂)》本文介绍了C++中数组的初始化方法,包括一维数组和二维数组的初始化,以及用new动态初始化数组,在C++11及以上版本中,还提供了使用std::array... 目录1、初始化一维数组1.1、使用列表初始化(推荐方式)1.2、初始化部分列表1.3、使用std::