Warning in Mobile Robotics
5 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
성준 윤
am 26 Nov. 2021
Beantwortet: Nialle Domzonn
am 17 Mär. 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);
0 Kommentare
Akzeptierte Antwort
Walter Roberson
am 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 Kommentare
Weitere Antworten (1)
Nialle Domzonn
am 17 Mär. 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
0 Kommentare
Siehe auch
Kategorien
Mehr zu Robotics finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!