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;

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;
////////////

% grab the video info and first block … send to the vision module

% aviread

% mov = aviread(MOV_FILE, START_FRAME:(BLOCK_READ+START_FRAME));

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)]);
////////////////////////////////
% 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<AGROW>

        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);

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<AGROW>

    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);
'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),

在这里插入图片描述

代码解析:

在这里插入图片描述
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

  • 5
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 13
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值