Warning in Mobile Robotics

5 次查看(过去 30 天)
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