【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

相关文章

Spring Boot项目打包和运行的操作方法

《SpringBoot项目打包和运行的操作方法》SpringBoot应用内嵌了Web服务器,所以基于SpringBoot开发的web应用也可以独立运行,无须部署到其他Web服务器中,下面以打包dem... 目录一、打包为JAR包并运行1.打包为可执行的 JAR 包2.运行 JAR 包二、打包为WAR包并运行

ubuntu20.0.4系统中安装Anaconda的超详细图文教程

《ubuntu20.0.4系统中安装Anaconda的超详细图文教程》:本文主要介绍了在Ubuntu系统中如何下载和安装Anaconda,提供了两种方法,详细内容请阅读本文,希望能对你有所帮助... 本文介绍了在Ubuntu系统中如何下载和安装Anaconda。提供了两种方法,包括通过网页手动下载和使用wg

如何在Ubuntu上安装NVIDIA显卡驱动? Ubuntu安装英伟达显卡驱动教程

《如何在Ubuntu上安装NVIDIA显卡驱动?Ubuntu安装英伟达显卡驱动教程》Windows系统不同,Linux系统通常不会自动安装专有显卡驱动,今天我们就来看看Ubuntu系统安装英伟达显卡... 对于使用NVIDIA显卡的Ubuntu用户来说,正确安装显卡驱动是获得最佳图形性能的关键。与Windo

Oracle 通过 ROWID 批量更新表的方法

《Oracle通过ROWID批量更新表的方法》在Oracle数据库中,使用ROWID进行批量更新是一种高效的更新方法,因为它直接定位到物理行位置,避免了通过索引查找的开销,下面给大家介绍Orac... 目录oracle 通过 ROWID 批量更新表ROWID 基本概念性能优化建议性能UoTrFPH优化建议注

Idea插件MybatisX失效的问题解决

《Idea插件MybatisX失效的问题解决》:本文主要介绍Idea插件MybatisX失效的问题解决,详细的介绍了4种问题的解决方法,具有一定的参考价值,感兴趣的可以了解一下... 目录一、重启idea或者卸载重装MyBATis插件(无需多言)二、检查.XML文件与.Java(该文件后缀Idea可能会隐藏

Pandas进行周期与时间戳转换的方法

《Pandas进行周期与时间戳转换的方法》本教程将深入讲解如何在pandas中使用to_period()和to_timestamp()方法,完成时间戳与周期之间的转换,并结合实际应用场景展示这些方法的... 目录to_period() 时间戳转周期基本操作应用示例to_timestamp() 周期转时间戳基

在 PyQt 加载 UI 三种常见方法

《在PyQt加载UI三种常见方法》在PyQt中,加载UI文件通常指的是使用QtDesigner设计的.ui文件,并将其转换为Python代码,以便在PyQt应用程序中使用,这篇文章给大家介绍在... 目录方法一:使用 uic 模块动态加载 (不推荐用于大型项目)方法二:将 UI 文件编译为 python 模

Nginx 访问 /root/下 403 Forbidden问题解决

《Nginx访问/root/下403Forbidden问题解决》在使用Nginx作为Web服务器时,可能会遇到403Forbidden错误,文中通过示例代码介绍的非常详细,对大家的学习或者工作... 目录解决 Nginx 访问 /root/test/1.html 403 Forbidden 问题问题复现Ng

Python将字库文件打包成可执行文件的常见方法

《Python将字库文件打包成可执行文件的常见方法》在Python打包时,如果你想将字库文件一起打包成一个可执行文件,有几种常见的方法,具体取决于你使用的打包工具,下面就跟随小编一起了解下具体的实现方... 目录使用 PyInstaller基本方法 - 使用 --add-data 参数使用 spec 文件(

Python的pip在命令行无法使用问题的解决方法

《Python的pip在命令行无法使用问题的解决方法》PIP是通用的Python包管理工具,提供了对Python包的查找、下载、安装、卸载、更新等功能,安装诸如Pygame、Pymysql等Pyt... 目录前言一. pip是什么?二. 为什么无法使用?1. 当我们在命令行输入指令并回车时,一般主要是出现以