Warning in Mobile Robotics

조회 수: 5 (최근 30일)
성준 윤
성준 윤 2021년 11월 26일
답변: Nialle Domzonn 2023년 3월 17일
I am very new to Matlab. I was following exactly same example from MobileRoboticsSimulationToolbox-Robot Visualizer-Example2 : Maps and Lidar.
And I can't create a map, because this warning and error came up when I run this code below.
viz = Visualizer2D;
viz.showTrajectory = false;
load exampleMap
viz.mapName = 'map';
pose = [3; 4; 0];
viz(pose)
Warning: Variable 'map' originally saved as a robotics.OccupancyGrid
cannot be instantiated as an object and will be read in as a uint32.
error : internal.createMapFromName (line 39)
Map name 'map' must be a robotics.OccupancyGrid or robotics.BinaryOccupancyGrid object.
error : Visualizer2D/setupImpl (line 75)
obj.map = internal.createMapFromName(obj.mapName);

채택된 답변

Walter Roberson
Walter Roberson 2021년 11월 26일
You attempted to load into a MATLAB session that does not have the class definitions for a robotics occupancy grid. Possibly you do not have the toolbox installed.
  댓글 수: 2
성준 윤
성준 윤 2021년 11월 26일
I deleted Mobile Robotic Simulation Toolbox and redownloaded it in case there was an error with the toolbox but it still shows me same warning.. Would it help if I redownload Matlab and toolbox? Maybe I didn't download one of Matlab programs I need.
Walter Roberson
Walter Roberson 2021년 11월 26일
You need Robotics System Toolbox

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Nialle Domzonn
Nialle Domzonn 2023년 3월 17일
%% Creating a 2D object visualizer and loading map
viz2 = Visualizer2D;
viz2.showTrajectory = false;
load exampleMap
viz2.mapName = 'map';
%% Setting the robot's initial pose and visualizing it
pose = [3; 4; 0];
viz2(pose);
%% Creating and attaching a Lidar sensor to the robot
lidar = LidarSensor;
lidar.scanAngles = linspace(-pi/3, pi/3, 7);
attachLidarSensor(viz2, lidar);
%% Animating a spinning robot with Lidar readings
for idx = 1:10
pose = pose + [0; 0; pi/8];
ranges = lidar(pose);
viz2(pose, ranges);
pause(0.25);
end
%% Placing 5 waypoints on the map for the robot to follow
waypoints = [2, 2; 8, 4; 4, 6; 6, 8; 2, 10];
for i = 1:size(waypoints, 1)
target_pose = [waypoints(i, 1); waypoints(i, 2); atan2(waypoints(i, 2)-pose(2), waypoints(i, 1)-pose(1))];
while norm(pose(1:2)-target_pose(1:2)) > 0.1
pose = pose + [0.1*cos(pose(3)); 0.1*sin(pose(3)); 0];
ranges = lidar(pose);
viz2(pose, ranges);
pause(0.01);
end
pose(3) = target_pose(3);
end

카테고리

Help CenterFile Exchange에서 Robotics에 대해 자세히 알아보기

제품


릴리스

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by