Dstar/modify_cost Error
4 次查看(过去 30 天)
显示 更早的评论
Hi All,
I was trying to run this code:
clear all; clc; close all;
%Creating Pacman maze
canvas = zeros(300);
canvas(1:10,1:300)=1;
canvas(1:300,1:10)=1;
canvas(290:300,1:300)=1;
canvas(1:300,290:300)=1;
canvas(280:290,40:120)=1;
canvas(280:290,180:260)=1;
canvas(240:250,40:100)=1;
canvas(240:250,120:180)=1;
canvas(240:250,200:260)=1;
canvas(250:270,145:155)=1;
canvas(210:240,50:60)=1;
canvas(210:240,240:250)=1;
canvas(10:50,145:155)=1;
canvas(30:50,30:70)=1;
canvas(30:50,90:130)=1;
canvas(30:50,230:270)=1;
canvas(30:50,170:210)=1;
canvas(210:220,10:30)=1;
canvas(210:220,270:290)=1;
canvas(210:220,80:120)=1;
canvas(210:220,180:220)=1;
canvas(70:160,260:300)=1;
canvas(70:160,1:40)=1;
canvas(70:110,230:240)=1;
canvas(70:110,60:70)=1;
canvas(70:110,200:210)=1;
canvas(70:110,90:100)=1;
canvas(100:110,100:130)=1;
canvas(100:110,170:200)=1;
canvas(70:80,120:180)=1;
canvas(80:110,145:155)=1;
canvas(130:160,120:180)=1;
canvas(180:190,120:180)=1;
canvas(190:220,145:155)=1;
canvas(150:190,90:100)=1;
canvas(150:190,200:210)=1;
canvas(180:190,50:80)=1;
canvas(180:190,220:250)=1;
canvas(150:160,50:80)=1;
canvas(150:160,220:250)=1;
canvas(100:110,50:60)=1;
goal = [198,250]; %goal point, changed a bit as goal location was inside obstacle
start = [20,20]; %start point
%D* Method
ds = Dstar(canvas); %create navigation object
for x = 120:130 %different terrain starting from 130 with a length of 10
for y = 130:140
ds.modify_cost(([x,y]),2); %Set terrain cost to 2
end
end
ds.plan(goal); %create plan for specified goal
ds.query(start); %animate path from this start location
But I keep getting an error that the number of columns of P and C must match. I am trying to increase the cost of the terrain starting from xvalue = 120:130 and yvalue = 130:140 to 2.
0 个评论
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 ROS Toolbox 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!