Warning in Mobile Robotics

28 views (last 30 days)
성준 윤
성준 윤 on 26 Nov 2021
Answered: Nialle Domzonn on 17 Mar 2023
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);

Accepted Answer

Walter Roberson
Walter Roberson on 26 Nov 2021
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 Comments
성준 윤
성준 윤 on 26 Nov 2021
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 on 26 Nov 2021
You need Robotics System Toolbox

Sign in to comment.

More Answers (1)

Nialle Domzonn
Nialle Domzonn on 17 Mar 2023
%% 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

Products


Release

R2020b

Community Treasure Hunt

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

Start Hunting!