栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Python

evo

Python 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

evo

evo_traj报错importError: cannot import name NavigationToolbar2Tk 1、介绍2、安装3、问题及解决

1、介绍

最近做一些slam及运动控制相关的东西 需要对轨迹做一个直观的观察 之前多用plotjuggler 今天想要用一下evo 使用时遇到一个问题 记录一下 关于evo介绍如下
evo是一款用于视觉里程计和slam问题的轨迹评估工具。核心功能是能够绘制相机的轨迹 或评估估计轨迹与真值的误差。支持多种数据集的轨迹格式 TUM、KITTI、EuRoC MAV、ROS的bag 同时支持这些数据格式之间进行相互转换。

2、安装

环境 ubuntu18.04
使用pip安装 更改一下pip的源 安装速度会更快 第一次的安装过程未截图保留 安装成功后再次执行安装指令信息如下

xxx xxx-Lenovo-Legion-Y7000-2020:~$ sudo pip install evo
The directory /home/xxx/.cache/pip/http or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo s -H flag.
The directory /home/xxx/.cache/pip or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo s -H flag.
Requirement already satisfied: evo in /usr/local/lib/python2.7/dist-packages
Requirement already satisfied: argcomplete in /usr/local/lib/python2.7/dist-packages (from evo)
Requirement already satisfied: colorama 0.3 in /usr/lib/python2.7/dist-packages (from evo)
Requirement already satisfied: enum34 in /usr/lib/python2.7/dist-packages (from evo)
Requirement already satisfied: matplotlib in /usr/lib/python2.7/dist-packages (from evo)
Requirement already satisfied: natsort in /usr/local/lib/python2.7/dist-packages (from evo)
Requirement already satisfied: numpy in /usr/lib/python2.7/dist-packages (from evo)
Requirement already satisfied: pandas in /usr/local/lib/python2.7/dist-packages (from evo)
Requirement already satisfied: pillow in /usr/lib/python2.7/dist-packages (from evo)
Requirement already satisfied: pygments in /usr/lib/python2.7/dist-packages (from evo)
Requirement already satisfied: pyyaml in /usr/lib/python2.7/dist-packages (from evo)
Requirement already satisfied: scipy 1.2 in /usr/local/lib/python2.7/dist-packages (from evo)
Requirement already satisfied: seaborn 0.9 in /usr/local/lib/python2.7/dist-packages (from evo)
Requirement already satisfied: importlib-metadata 5, 0.23; python_version 2.7 in /usr/local/lib/python2.7/dist-packages (from argcomplete- evo)
Requirement already satisfied: pytz 2011k in /usr/lib/python2.7/dist-packages (from pandas- evo)
Requirement already satisfied: python-dateutil 2.5.0 in /usr/lib/python2.7/dist-packages (from pandas- evo)
Requirement already satisfied: zipp 0.5 in /usr/local/lib/python2.7/dist-packages (from importlib-metadata 5, 0.23; python_version 2.7 - argcomplete- evo)
Requirement already satisfied: configparser 3.5; python_version 3 in /usr/lib/python2.7/dist-packages (from importlib-metadata 5, 0.23; python_version 2.7 - argcomplete- evo)
Requirement already satisfied: contextlib2; python_version 3 in /usr/local/lib/python2.7/dist-packages (from importlib-metadata 5, 0.23; python_version 2.7 - argcomplete- evo)
Requirement already satisfied: pathlib2; python_version 3 in /usr/local/lib/python2.7/dist-packages (from importlib-metadata 5, 0.23; python_version 2.7 - argcomplete- evo)
Requirement already satisfied: six in /usr/lib/python2.7/dist-packages (from pathlib2; python_version 3 - importlib-metadata 5, 0.23; python_version 2.7 - argcomplete- evo)
Requirement already satisfied: scandir; python_version 3.5 in /usr/local/lib/python2.7/dist-packages (from pathlib2; python_version 3 - importlib-metadata 5, 0.23; python_version 2.7 - argcomplete- evo)
3、问题及解决

运行时遇到问题 如下

xxx xxx-Lenovo-Legion-Y7000-2020:~$ evo_traj bag 2021-09-25-15-40-46.bag --all_topics -p --plot_mode xyz
--------------------------------------------------------------------------------
name: /xxxxxxxx/location/allpose/1
infos: 104 poses, 4.077m path length, 0.000s duration
--------------------------------------------------------------------------------
name: /xxxxxxxx/car/pose/1
infos: 96 poses, 4.042m path length, 0.000s duration
[ERROR] Unhandled error in evo.main_traj
Traceback (most recent call last):
 File /usr/local/lib/python2.7/dist-packages/evo/entry_points.py , line 98, in launch
 main_module.run(args)
 File /usr/local/lib/python2.7/dist-packages/evo/main_traj.py , line 469, in run
 plot_collection.show()
 File /usr/local/lib/python2.7/dist-packages/evo/tools/plot.py , line 166, in show
 self.tabbed_tk_window()
 File /usr/local/lib/python2.7/dist-packages/evo/tools/plot.py , line 125, in tabbed_tk_window
 from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg, NavigationToolbar2Tk
importError: cannot import name NavigationToolbar2Tk
[ERROR] evo module evo.main_traj crashed - no logfile written (disabled)

查找资料说 “NavigationToolbar2TkAgg已经弃用 现在使用NavigationToolbar2Tk”
受到启发 应该是python3弃用 但python2应该使用NavigationToolbar2TkAgg 而不是NavigationToolbar2Tk
所以执行“sudo vim /usr/local/lib/python2.7/dist-packages/evo/tools/plot.py” 将125行和146行两处的NavigationToolbar2Tk改为NavigationToolbar2TkAgg 然后可以正常使用 如下图

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/267555.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号