• RatSLAM配置(MATLAB版)


    最近开始写毕业论文,为了跑实验,先试一下RatSLAM。

    RatSLAM简介
    RatSLAM系统使用啮齿动物海马的计算模型执行基于视觉的SLAM。RatSLAM能够在室内和室外环境中执行实时在线SLAM。

    澳大利亚昆士兰科技大学(QUT)的科学家Michael Milford和他的同事们在过去的14年中一直在研究以老鼠大脑为模型的机器人导航系统。他们希望以这种生物启发的方法可以帮助机器人在动态环境下进行导航,而不需要高级、昂贵的传感器和计算密集型的算法。

    在这里插入图片描述

    源代码地址:
    https://github.com/davidmball/ratslam_matlab

    由于原官方配套的代码和数据集网站需要QUT校内帐号登录,所以下不了了,就从别的地方找的数据集,但需要外网。

    数据集

    图像:
    https://www.dropbox.com/s/4905nzbx4pnihr7/log_irat_red.avi?dl=0
    里程计text:
    https://www.dropbox.com/s/9ns3uknayad8y1t/log_irat_red.txt?dl=0
    运行俯视图像:
    https://www.dropbox.com/s/ffosfmmyzy9gfkq/log_overhead.avi?dl=0

    配置方法:
    首先打开st_lucia.m 和 axon5.m设置对应的图像数据集和里程计数据集的路径,修改完后还要修改部分代码,因为本身的源代码和数据集的是不对应的

    rs_main.m

    /////////////////////
    
    % specify the movie and the frames to read
    
    movinfo = aviinfo(MOV_FILE);
    
    START_FRAME = 1;
    
    END_FRAME = movinfo.NumFrames;
    
     
    
    % these are the raw image dimensions
    
    % the offset is the number of pixels from the centre of the image to the
    
    % true zero rotation direction
    
    IMAGE_Y_SIZE = movinfo.Height;
    
    IMAGE_X_SIZE = movinfo.Width;
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21

    Can be replaced by follow code

    % specify the movie and the frames to read
    
    movinfo = VideoReader(MOV_FILE);
    
    START_FRAME = 1;
    
    END_FRAME = movinfo.NumberOfFrames;
    
    FRAME_NUMBER = movinfo.NumberOfFrames;
    
     
    
    % these are the raw image dimensions
    
    % the offset is the number of pixels from the centre of the image to the
    
    % true zero rotation direction
    
    IMAGE_Y_SIZE = movinfo.Height;
    
    IMAGE_X_SIZE = movinfo.Width;
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    ////////////
    
    % grab the video info and first block … send to the vision module
    
    % aviread
    
    % mov = aviread(MOV_FILE, START_FRAME:(BLOCK_READ+START_FRAME));
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7

    Can be replaced by follow code

    % grab the video info and first block … send to the vision module
    
    mov_temp = read(movinfo, [START_FRAME (BLOCK_READ+START_FRAME)]);
    
    • 1
    • 2
    • 3
    ////////////////////////////////
    % save the experience map information to the disk for later playback
    
        % read the avi file in blocks and record the delta time
    
        if (mod(frame, BLOCK_READ) == 0)
    
            save(strcat(LOG_FILE, num2str(frame)), 'frame', 'exps', 'exp_history', 'vt_history');
    
            time_delta_s = [time_delta_s; toc]; %#ok
    
            mov = aviread(MOV_FILE, (frame+START_FRAME):min([(frame+BLOCK_READ – 1)+START_FRAME, movinfo.NumFrames]));
    
            if ODO_FILE ~= 0
    
                ododata = csvread(ODO_FILE, frame+START_FRAME, 0, [frame+START_FRAME 0 min([(frame+BLOCK_READ – 1)+START_FRAME, movinfo.NumFrames]) 1]);
    
            end
    
            tic
    
        end
    
     
    
        % visual templates and visual odo uses intensity so convert to grayscale
    
        im = rgb2gray(mov(mod(frame, BLOCK_READ) + 1).cdata);
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28

    Can be replaced by follow code

    % save the experience map information to the disk for later playback
    
    % read the avi file in blocks and record the delta time
    
    if (mod(frame, BLOCK_READ) == 0)
    
        save(strcat(LOG_FILE, num2str(frame)), 'frame', 'exps', 'exp_history', 'vt_history');
    
        time_delta_s = [time_delta_s; toc]; %#ok
    
        mov_temp = read(movinfo, [(frame+START_FRAME) min([(frame+BLOCK_READ – 1)+START_FRAME, FRAME_NUMBER])]);
    
        if ODO_FILE ~= 0
    
            ododata = csvread(ODO_FILE, frame+START_FRAME, 0, [frame+START_FRAME 0 min([(frame+BLOCK_READ – 1)+START_FRAME, FRAME_NUMBER]) 1]);
    
        end
    
        tic
    
    end
    
     
    
    % visual templates and visual odo uses intensity so convert to grayscale
    
    % aviread
    
    % im = rgb2gray(mov(mod(frame, BLOCK_READ) + 1).cdata);
    
      
    
    mov = immovie(mov_temp);
    
    im = rgb2gray(mov(mod(frame, BLOCK_READ) + 1).cdata);
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    'IMAGE_VT_Y_RANGE', (480/2 – 80 – 40):(480/2 + 30 – 40),'IMAGE_VT_X_RANGE', (640/2 – 280 + 15):(640/2 – 10 + 15),'IMAGE_VTRANS_Y_RANGE', 60:230,'IMAGE_VROT_Y_RANGE', 75:235,'IMAGE_ODO_X_RANGE', (180 + 15):(400 + 15),
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9

    在这里插入图片描述

    代码解析:

    在这里插入图片描述
    rat_visual_odometry 视觉里程计
    rs_compare_segments 图像匹配
    rs_create_posecell_weights ratslam创建位姿细胞权重
    rs_exp_playback 经验值回放 播放记录的体验图,可视模板和体验模板
    rs_experience_map_iteration 经验图迭代
    rs_get_posecell_xyth 得到位姿细胞位置
    rs_posecell_iteration 位姿细胞迭代
    rs_visual_odometry 视觉里程计

    参考链接:
    https://www.sciencedirect.com/science/article/pii/S235234092030531X
    https://github.com/davidmball/ratslam_matlab
    http://www.davidmichaelball.com/#contact

  • 相关阅读:
    【SkyWalking】SkyWalking是如何实现跨进程传播链路数据?
    C语言中可变参数函数的实现——printf
    【openGauss】一种可能是目前最快的从ORACLE同步数据到MogDB(openGauss)的方式
    基于粒子群优化算法的冷热电联供型综合能源系统运行优化附Matlab代码
    SystemVerilog Assertions应用指南 第一章(1.28章节 内建的系统函数)
    数据栅格化
    嵌入式MCU学习利器-03-在线做RT-Thread实验
    SystemVerilog——class类
    0基础学习VR全景平台篇 第95篇:VR实景智慧导航操作手册
    【进阶篇】Java 实际开发中积累的几个小技巧(二)
  • 原文地址:https://blog.csdn.net/weixin_44139651/article/details/110470025