python2 安装evo 与 评价MSKCF 等slam系统

参考https://blog.csdn.net/weixin_44386661/article/details/103080551

https://blog.csdn.net/zhiwei121/article/details/105013678

这里用源码安装

#
git clone https://github.com/MichaelGrupp/evo.git
cd evo
# 安装在系统的python2 使用清华源 并开启usr
#可以尝试安装在python3

pip install --editable . --upgrade --no-binary evo -i https://pypi.tuna.tsinghua.edu.cn/simple  --user

#出现问题
#更新numpy 和matplotlib的版本
pip install numpy --upgrade --user
pip install matplotlib --upgrade --user
#如果更新不了 发现加上清华源即可
pip install numpy --upgrade --user  -i https://pypi.tuna.tsinghua.edu.cn/simple
pip install matplotlib --upgrade --user  -i https://pypi.tuna.tsinghua.edu.cn/simple

再次在python2.7装,找不到evo_traj,pip uninstall evo了,以下信息 :

装在了 ./local ??? 什么情况

solved 2020.12.21

首先git所有的内容,采用编译安装的方法

git clone https://github.com/MichaelGrupp/evo.git
cd evo

现在evo又更新了,支持python3.6+,还是习惯用python2.7, 切到这个分支tag https://github.com/MichaelGrupp/evo/tree/v1.12.0

git checkout v1.12.0

安装就完了,pip对应python2, pip3默认对应pthon3

pip install --editable . --upgrade --no-binary evo


WARNING: pip is being invoked by an old script wrapper. This will fail in a future version of pip.
Please see https://github.com/pypa/pip/issues/5599 for advice on fixing the underlying issue.
To avoid this problem you can invoke Python with '-m pip' instead of running pip directly.
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support pip 21.0 will remove support for this functionality.
Defaulting to user installation because normal site-packages is not writeable
Obtaining file:///home/lin/My_lib/evo
Requirement already satisfied, skipping upgrade: numpy in /home/lin/.local/lib/python2.7/site-packages (from evo==1.12.0) (1.16.6)
Requirement already satisfied, skipping upgrade: matplotlib in /home/lin/.local/lib/python2.7/site-packages (from evo==1.12.0) (2.2.5)
Requirement already satisfied, skipping upgrade: scipy>=1.2 in /home/lin/.local/lib/python2.7/site-packages (from evo==1.12.0) (1.2.3)
Requirement already satisfied, skipping upgrade: pandas in /home/lin/.local/lib/python2.7/site-packages (from evo==1.12.0) (0.24.2)
Requirement already satisfied, skipping upgrade: seaborn>=0.9 in /home/lin/.local/lib/python2.7/site-packages (from evo==1.12.0) (0.9.1)
Requirement already satisfied, skipping upgrade: natsort in /home/lin/.local/lib/python2.7/site-packages (from evo==1.12.0) (6.2.1)
Requirement already satisfied, skipping upgrade: argcomplete in /home/lin/.local/lib/python2.7/site-packages (from evo==1.12.0) (1.12.2)
Requirement already satisfied, skipping upgrade: colorama>=0.3 in /home/lin/.local/lib/python2.7/site-packages (from evo==1.12.0) (0.4.4)
Requirement already satisfied, skipping upgrade: pygments in /usr/lib/python2.7/dist-packages (from evo==1.12.0) (2.1)
Requirement already satisfied, skipping upgrade: pyyaml in /usr/lib/python2.7/dist-packages (from evo==1.12.0) (3.11)
Requirement already satisfied, skipping upgrade: pillow in /usr/lib/python2.7/dist-packages (from evo==1.12.0) (3.1.2)
Requirement already satisfied, skipping upgrade: enum34 in /usr/lib/python2.7/dist-packages (from evo==1.12.0) (1.1.2)
Requirement already satisfied, skipping upgrade: python-dateutil>=2.1 in /home/lin/.local/lib/python2.7/site-packages (from matplotlib->evo==1.12.0) (2.8.1)
Requirement already satisfied, skipping upgrade: backports.functools-lru-cache in /home/lin/.local/lib/python2.7/site-packages (from matplotlib->evo==1.12.0) (1.6.1)
Requirement already satisfied, skipping upgrade: six>=1.10 in /usr/lib/python2.7/dist-packages (from matplotlib->evo==1.12.0) (1.10.0)
Requirement already satisfied, skipping upgrade: pyparsing!=2.0.4,!=2.1.2,!=2.1.6,>=2.0.1 in /usr/lib/python2.7/dist-packages (from matplotlib->evo==1.12.0) (2.0.3)
Requirement already satisfied, skipping upgrade: cycler>=0.10 in /home/lin/.local/lib/python2.7/site-packages (from matplotlib->evo==1.12.0) (0.10.0)
Requirement already satisfied, skipping upgrade: kiwisolver>=1.0.1 in /home/lin/.local/lib/python2.7/site-packages (from matplotlib->evo==1.12.0) (1.1.0)
Requirement already satisfied, skipping upgrade: pytz in /usr/lib/python2.7/dist-packages (from matplotlib->evo==1.12.0) (2014.10)
Requirement already satisfied, skipping upgrade: subprocess32 in /home/lin/.local/lib/python2.7/site-packages (from matplotlib->evo==1.12.0) (3.5.4)
Requirement already satisfied, skipping upgrade: importlib-metadata<4,>=0.23; python_version == "2.7" in /home/lin/.local/lib/python2.7/site-packages (from argcomplete->evo==1.12.0) (2.1.1)
Requirement already satisfied, skipping upgrade: setuptools in /usr/lib/python2.7/dist-packages (from kiwisolver>=1.0.1->matplotlib->evo==1.12.0) (20.7.0)
Requirement already satisfied, skipping upgrade: contextlib2; python_version < "3" in /home/lin/.local/lib/python2.7/site-packages (from importlib-metadata<4,>=0.23; python_version == "2.7"->argcomplete->evo==1.12.0) (0.6.0.post1)
Requirement already satisfied, skipping upgrade: pathlib2; python_version < "3" in /home/lin/.local/lib/python2.7/site-packages (from importlib-metadata<4,>=0.23; python_version == "2.7"->argcomplete->evo==1.12.0) (2.3.5)
Requirement already satisfied, skipping upgrade: zipp>=0.5 in /home/lin/.local/lib/python2.7/site-packages (from importlib-metadata<4,>=0.23; python_version == "2.7"->argcomplete->evo==1.12.0) (1.2.0)
Requirement already satisfied, skipping upgrade: configparser>=3.5; python_version < "3" in /home/lin/.local/lib/python2.7/site-packages (from importlib-metadata<4,>=0.23; python_version == "2.7"->argcomplete->evo==1.12.0) (4.0.2)
Requirement already satisfied, skipping upgrade: scandir; python_version < "3.5" in /home/lin/.local/lib/python2.7/site-packages (from pathlib2; python_version < "3"->importlib-metadata<4,>=0.23; python_version == "2.7"->argcomplete->evo==1.12.0) (1.10.0)
Installing collected packages: evo
  Running setup.py develop for evo
Successfully installed evo

####### so

pip uninstall evo
WARNING: pip is being invoked by an old script wrapper. This will fail in a future version of pip.
Please see https://github.com/pypa/pip/issues/5599 for advice on fixing the underlying issue.
To avoid this problem you can invoke Python with '-m pip' instead of running pip directly.
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support pip 21.0 will remove support for this functionality.
Found existing installation: evo 1.12.0
Uninstalling evo-1.12.0:
  Would remove:
    /home/lin/.local/lib/python2.7/site-packages/evo.egg-link
Proceed (y/n)? y
  Successfully uninstalled evo-1.12.0

这样装完,发现上面的问题  安在了/.local,这本来也是python的习惯,但是导致 evo的evo_ape等等命令找不到

于是 用sudo ,evo可以被tab了

sudo pip install --editable . --upgrade --no-binary evo
[sudo] lin 的密码: 

WARNING: pip is being invoked by an old script wrapper. This will fail in a future version of pip.
Please see https://github.com/pypa/pip/issues/5599 for advice on fixing the underlying issue.
To avoid this problem you can invoke Python with '-m pip' instead of running pip directly.
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support pip 21.0 will remove support for this functionality.
WARNING: The directory '/home/lin/.cache/pip' or its parent directory is not owned or is not writable by the current user. The cache has been disabled. Check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.

Obtaining file:///home/lin/My_lib/evo
Requirement already satisfied, skipping upgrade: numpy in /home/lin/.local/lib/python2.7/site-packages (from evo==1.12.0) (1.16.6)
Requirement already satisfied, skipping upgrade: matplotlib in /home/lin/.local/lib/python2.7/site-packages (from evo==1.12.0) (2.2.5)
Requirement already satisfied, skipping upgrade: scipy>=1.2 in /home/lin/.local/lib/python2.7/site-packages (from evo==1.12.0) (1.2.3)
Requirement already satisfied, skipping upgrade: pandas in /home/lin/.local/lib/python2.7/site-packages (from evo==1.12.0) (0.24.2)
Requirement already satisfied, skipping upgrade: seaborn>=0.9 in /home/lin/.local/lib/python2.7/site-packages (from evo==1.12.0) (0.9.1)
Requirement already satisfied, skipping upgrade: natsort in /home/lin/.local/lib/python2.7/site-packages (from evo==1.12.0) (6.2.1)
Requirement already satisfied, skipping upgrade: argcomplete in /home/lin/.local/lib/python2.7/site-packages (from evo==1.12.0) (1.12.2)
Requirement already satisfied, skipping upgrade: colorama>=0.3 in /home/lin/.local/lib/python2.7/site-packages (from evo==1.12.0) (0.4.4)
Requirement already satisfied, skipping upgrade: pygments in /usr/lib/python2.7/dist-packages (from evo==1.12.0) (2.1)
Requirement already satisfied, skipping upgrade: pyyaml in /usr/lib/python2.7/dist-packages (from evo==1.12.0) (3.11)
Requirement already satisfied, skipping upgrade: pillow in /usr/lib/python2.7/dist-packages (from evo==1.12.0) (3.1.2)
Requirement already satisfied, skipping upgrade: enum34 in /usr/lib/python2.7/dist-packages (from evo==1.12.0) (1.1.2)
Requirement already satisfied, skipping upgrade: python-dateutil>=2.1 in /home/lin/.local/lib/python2.7/site-packages (from matplotlib->evo==1.12.0) (2.8.1)
Requirement already satisfied, skipping upgrade: backports.functools-lru-cache in /home/lin/.local/lib/python2.7/site-packages (from matplotlib->evo==1.12.0) (1.6.1)
Requirement already satisfied, skipping upgrade: six>=1.10 in /usr/lib/python2.7/dist-packages (from matplotlib->evo==1.12.0) (1.10.0)
Requirement already satisfied, skipping upgrade: pyparsing!=2.0.4,!=2.1.2,!=2.1.6,>=2.0.1 in /usr/lib/python2.7/dist-packages (from matplotlib->evo==1.12.0) (2.0.3)
Requirement already satisfied, skipping upgrade: cycler>=0.10 in /home/lin/.local/lib/python2.7/site-packages (from matplotlib->evo==1.12.0) (0.10.0)
Requirement already satisfied, skipping upgrade: kiwisolver>=1.0.1 in /home/lin/.local/lib/python2.7/site-packages (from matplotlib->evo==1.12.0) (1.1.0)
Requirement already satisfied, skipping upgrade: pytz in /usr/lib/python2.7/dist-packages (from matplotlib->evo==1.12.0) (2014.10)
Requirement already satisfied, skipping upgrade: subprocess32 in /home/lin/.local/lib/python2.7/site-packages (from matplotlib->evo==1.12.0) (3.5.4)
Requirement already satisfied, skipping upgrade: importlib-metadata<4,>=0.23; python_version == "2.7" in /home/lin/.local/lib/python2.7/site-packages (from argcomplete->evo==1.12.0) (2.1.1)
Requirement already satisfied, skipping upgrade: setuptools in /usr/lib/python2.7/dist-packages (from kiwisolver>=1.0.1->matplotlib->evo==1.12.0) (20.7.0)
Requirement already satisfied, skipping upgrade: contextlib2; python_version < "3" in /home/lin/.local/lib/python2.7/site-packages (from importlib-metadata<4,>=0.23; python_version == "2.7"->argcomplete->evo==1.12.0) (0.6.0.post1)
Requirement already satisfied, skipping upgrade: pathlib2; python_version < "3" in /home/lin/.local/lib/python2.7/site-packages (from importlib-metadata<4,>=0.23; python_version == "2.7"->argcomplete->evo==1.12.0) (2.3.5)
Requirement already satisfied, skipping upgrade: zipp>=0.5 in /home/lin/.local/lib/python2.7/site-packages (from importlib-metadata<4,>=0.23; python_version == "2.7"->argcomplete->evo==1.12.0) (1.2.0)
Requirement already satisfied, skipping upgrade: configparser>=3.5; python_version < "3" in /home/lin/.local/lib/python2.7/site-packages (from importlib-metadata<4,>=0.23; python_version == "2.7"->argcomplete->evo==1.12.0) (4.0.2)
Requirement already satisfied, skipping upgrade: scandir; python_version < "3.5" in /home/lin/.local/lib/python2.7/site-packages (from pathlib2; python_version < "3"->importlib-metadata<4,>=0.23; python_version == "2.7"->argcomplete->evo==1.12.0) (1.10.0)
Installing collected packages: evo
  Running setup.py develop for evo
Successfully installed evo


######################

pip uninstall evo

WARNING: pip is being invoked by an old script wrapper. This will fail in a future version of pip.
Please see https://github.com/pypa/pip/issues/5599 for advice on fixing the underlying issue.
To avoid this problem you can invoke Python with '-m pip' instead of running pip directly.
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support pip 21.0 will remove support for this functionality.
Found existing installation: evo 1.12.0
Uninstalling evo-1.12.0:
  Would remove:
    /usr/local/lib/python2.7/dist-packages/evo.egg-link
Proceed (y/n)? ^CERROR: Operation cancelled by user

 

 

修改mskcf 保存轨迹

参考 https://github.com/symao/msckf_vio/blob/evaluation/src/msckf_vio.cpp

https://github.com/symao/vio_evaluation

修改msckf源码,用tum格式(为了便于用evo 进行euroc的评价)

在msckf_vio.cpp开头增加如下

#在头文件增加
#include <thread>  

#在这一句map<int, double> MsckfVio::chi_squared_test_table; 大概50行之后增加:
#if 1
static const int p_max_cnt = 10000;
static const int p_cols = 8;
static double *p_log_data = new double[p_max_cnt * p_cols];
static int p_cnt = 0;
void mylog()
{
    FILE* fp = fopen("/home/lincent/s_msckf_ws/vio.txt","w");
    int k = 0;
    while(1)
    {
        if(k < p_cnt)
        {
            for(int i=0; i<p_cols; i++)
            {
                if(i > 0) fprintf(fp, " ");
                fprintf(fp, "%f", p_log_data[p_cols * k + i]);
            }
            fprintf(fp, "\n");
            fflush(fp);
            k++;
        }
        else
        {
            usleep(100000);
        }
    }
    fclose(fp);
}
static std::thread th_log(mylog);
#endif

完成上述 大约在470行

if (processing_time > 1.0/frame_rate) { ...}   后增加:

#if 1
    const auto& s = state_server.imu_state;
    const auto& p = s.position;
    const auto& q = s.orientation;
    const auto& v = s.velocity;
    const auto& ba = s.acc_bias;
    const auto& bg = s.gyro_bias;
    double *lp = p_log_data + p_cnt * p_cols;
    lp[0] = s.time;
    lp[1] = p(0);
    lp[2] = p(1);
    lp[3] = p(2);
    lp[4] = q.w();
    lp[5] = q.x();
    lp[6] = q.y();
    lp[7] = q.z();
    //lp[8] = v(0);
    //lp[9] = v(1);
    //lp[10] = v(2);
    //lp[11] = ba(0);
    //lp[12] = ba(1);
    //lp[13] = ba(2);
    //lp[14] = bg(0);
    //lp[15] = bg(1);
    //lp[16] = bg(2);
    //lp[17] = processing_time;
    p_cnt++;
#endif

重新编译msckf,运行得到结果vio.txt

#!!!注意:这里一定要用release进行make,不然运行会出现大问题
catkin_make --pkg msckf_vio --cmake-args -DCMAKE_BUILD_TYPE=Release
source devel/setup.bash
#运行,结束得到 位姿txt
roslaunch msckf_vio msckf_vio_euroc.launch
rosbag play ~/dataset/Euroc/MH_04_difficult.bag 

evo评价步骤

#先把euroc的真值转换为tum
evo_traj euroc ~/dataset/Euroc/MH_04_difficult/state_groundtruth_estimate0/data.csv --save_as_tum

#输出轨迹、ape、rpe, p表示plot, va进行轨迹对齐
evo_traj tum ours.txt --ref ground\ truth.tum -p -va
evo_ape tum ground\ truth.tum ours.txt -p -va
evo_rpe tum ground\ truth.tum ours.txt -p -va

参考:

官方文档 https://github.com/MichaelGrupp/evo/wiki/evo_traj

APE、RPE的计算:

EVO使用方法详解 https://blog.csdn.net/dcq1609931832/article/details/102465071

https://blog.csdn.net/weixin_41969600/article/details/89891610

https://zhuanlan.zhihu.com/p/88223106

使用 evo 工具评测 VI ORB SLAM2 在 EuRoC 上的结果
http://www.liuxiao.org/2017/11/%E4%BD%BF%E7%94%A8-evo-%E5%B7%A5%E5%85%B7%E8%AF%84%E6%B5%8B-vi-orb-slam2-%E5%9C%A8-euroc-%E4%B8%8A%E7%9A%84%E7%BB%93%E6%9E%9C/

vins-mono保存、重载地图、evo工具测试

https://blog.csdn.net/Hanghang_/article/details/104535370#evo_84

另外,评价TUM数据集的另外两个评价工具:evaluate_ate.py evaluate_rpe.py
参考 https://blog.csdn.net/Darlingqiang/article/details/89059466

RGB-D SLAM系统评估的基准---TUM https://blog.csdn.net/weixin_36662031/article/details/83088781

视觉SLAM基础:算法精度评价指标(ATE、RPE)https://zhuanlan.zhihu.com/p/105428199

各数据集的格式: https://blog.csdn.net/Darlingqiang/article/details/102631102

KITTI评价说明

 

解决pip下载速度慢的问题

https://blog.csdn.net/wolflikeinnocence/article/details/80140064

C++多线程(一)thread类

https://blog.csdn.net/coolwriter/article/details/79883253

  • 4
    点赞
  • 35
    收藏
    觉得还不错? 一键收藏
  • 9
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 9
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值