Robotics toolbox Custom map compile error

조회 수: 8 (최근 30일)
Divyanshu Divyanshu
Divyanshu Divyanshu 2019년 2월 8일
답변: Cam Salzberger 2019년 2월 8일
Hey there,
I am using MATLAB 2018a and i have robotics toolbox installed.
I am using it for path planning, the "exampleMaps.mat" map that is already there works just fine but when I make a custom maps it doesn't work.
It shows compile error:
""Undefined function or variable 'simpleMap'.
Error in Untitled12 (line 4)
map = robotics.OccupancyGrid(simpleMap,2);""
this error doesn't come when when i use "exampleMaps.mat"
this is my code
function b=map()
filePath = fullfile(fileparts(which('PathPlanningExample')),'data','exampleMaps.mat');
load(filePath)
map = robotics.OccupancyGrid(simpleMap,2);
prmSimple = robotics.PRM(map,50);
s=[2 2];
e=[10 2];
path=findpath(prmSimple,s,e)
show(prmSimple)
end
For your information let me tell you that my map is in same directory as "exampleMaps.mat"

답변 (1개)

Cam Salzberger
Cam Salzberger 2019년 2월 8일
Hello Divyanshu,
Does your MAT file have a variable in it called "simpleMap"? Because that is what the code is looking for - a variable called simpleMap that has been loaded into the function workspace. If your MAT file uses a different variable name for the map data, simply change "simpleMap" to reference that instead.
As an aside, I prefer to use the load('myMatFile.mat', varName1, varName2) syntax when calling load. That makes it obvious where the variables are coming from.
-Cam

태그

제품


릴리스

R2018a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by