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

devtools/2024/10/9 15:15:01/

ROS2.html" title=MAVROS2>MAVROS2运行px4.launch文件报错ValueError无法启动的解决方法

    • 问题描述
    • 解决方法

环境:

Ubuntu :20.04 LTS

ROSROS2 Foxy

PX4 :1.13.0

问题描述

在使用命令ros2 launch mavros px4.launch命令启动ROS2.html" title=MAVROS2>MAVROS2与PX4之间的连接时报错,无法启动ROS2.html" title=MAVROS2>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中ROS2.html" title=MAVROS2>MAVROS2的版本问题,Foxy中的ROS2.html" title=MAVROS2>MAVROS2 2.4.0版本会有这个问题,但ROS2.html" title=MAVROS2>MAVROS2 2.7.0修复了这个问题,所以比较好的解决方案就是自己创建工作空间用ROS2.html" title=MAVROS2>MAVROS2 2.7.0搭建环境。

创建ROS2工作空间。

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

下载MAVLink和ROS2.html" title=MAVROS2>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官网下载ROS2.html" title=MAVROS2>MAVROS2的ros2分支的最新版本代码,替换mavros2_ws/src文件夹中的mavros文件夹。

ROS2.html" title=MAVROS2>MAVROS2

编译工作空间。

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

新建一个终端,测试ROS2.html" title=MAVROS2>MAVROS2能否正常启动。

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

参考资料:

How to use mavros2


http://www.ppmy.cn/devtools/36231.html

相关文章

linux学习:线程池

目录 原理 初始线程池 运行中的线程池 相关结构体 api 线程池初始化 投送任务 增加活跃线程 删除活跃线程 销毁线程池 例子 thread_pool.h thread_pool.c test.c 测试程序 原理 一个进程中的线程就好比是一家公司里的员工&#xff0c;员工的数目应该根据公司的…

PyQt 入门

Qt hello - 专注于Qt的技术分享平台 Python体系下GUI框架也多了去了&#xff0c;PyQt算是比较受欢迎的一个。如果对Qt框架熟悉&#xff0c;那掌握这套框架是很简单的。 一&#xff0c;安装 1.PyQt5 pip3 install PyQt5 2.Designer UI工具 pip3 install PyQt5-tools 3.UI…

Go通过CRUD实现学生管理系统

虽然这个项目没有什么含金量&#xff0c;但是可以熟悉go的语法和go开发项目的一般流程 项目结构 项目实现了五个功能&#xff1a; &#xff08;1)增加一个学生 &#xff08;2&#xff09;删除一个学生 &#xff08;3&#xff09;修改一个学生的信息 &#xff08;4&#xf…

iPhone查看本机号码只需要这3招,不再为号码忘记犯愁!

在日常生活中&#xff0c;我们经常需要使用手机号码进行各种通讯活动&#xff0c;但有时候会忘记自己的手机号码&#xff0c;让人感到非常尴尬。不过&#xff0c;如果您是iPhone用户&#xff0c;那么您可以放心了&#xff01;因为在iphone查看本机号码只需要简单的几个步骤&…

路径规划 | 详解混合A*算法Hybrid A*(附ROS C++/Python/Matlab仿真)

目录 0 专栏介绍1 为什么需要Hybrid A*算法?2 Hybrid A*算法原理2.1 基本流程2.2 运动学约束启发式2.3 基于维诺图的路径耗散2.4 连续性节点扩展3 算法仿真3.1 ROS C++ 仿真3.2 Python仿真3.3 Matlab仿真0 专栏介绍 🔥附C++/Python/Matlab全套代码🔥课程设计、毕业设计、…

golang for经典练习 金字塔打印 示例 支持控制台输入要打印的层数

go语言中最经典的for练习程序 金字塔打印 &#xff0c;这也是其他语言中学习循环和条件算法最为经典的联系题。 其核心算法是如何控制内层循环变量j 每行打印的*号数量 j<i*2-1 和空格数量 j1 || j i*2-1 golang中实现实心金字塔 Solid Pyramid和空心金字塔 Hollow Pyram…

归并/快速排序

归并排序 利用分治的思路&#xff0c;将数组都分开&#xff0c;然后比较大小合并成一个数组 #include <bits/stdc.h> using namespace std; const int N 1e6 5; int q[N], tmp[N];int n; void merge_sort(int q[], int l, int r) {if (l > r)return;int mid l r…

yarn的安装和使用

首先在浏览器中打开该链接&#xff1a;https://code.visualstudio.com/首先在浏览器中打开该链接&#xff1a;https://code.visualstudio.com/ 打开该链接后的显示如下图所示 选择下载如下图所示的版本 完成visual studio code的安装后&#xff0c;接着安装node.js,在浏览器中…