syncWith(map,sourcemap)
updates the map with data from another source map of the same type. Locations in
map that are also found in
sourcemap are updated. All other cells in
map retain their current values.
This example shows how to move a local egocentric map and sync it with a larger world map. This process emulates a vehicle driving in an environment and getting updates on obstacles in the new areas.
Load example maps. Create an occupancy map from the ternaryMap.
Follow a path planned in the world map and update the local map as you move your local frame.
Specify path locations and plot on the map.
path = [100 100
100 250
200 250
300 250];
show(map)
hold on
plot(path(:,1),path(:,2))
hold off
Create a loop for moving between points by the map resolution. Divide the difference between points by the map resolution to see how many incremental moves you can make.
for i = 1:length(path)-1
moveAmount = (path(i+1,:)-path(i,:))/map.Resolution;
for j = 1:abs(moveAmount(1)+moveAmount(2))
moveValue = sign(moveAmount).*map.Resolution;
move(mapLocal,moveValue,"MoveType","relative")
syncWith(mapLocal,map)
show(mapLocal)
drawnow limitrateendend
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window.
Web browsers do not support MATLAB commands.
Website auswählen
Wählen Sie eine Website aus, um übersetzte Inhalte (sofern verfügbar) sowie lokale Veranstaltungen und Angebote anzuzeigen. Auf der Grundlage Ihres Standorts empfehlen wir Ihnen die folgende Auswahl: .
Sie können auch eine Website aus der folgenden Liste auswählen:
So erhalten Sie die bestmögliche Leistung auf der Website
Wählen Sie für die bestmögliche Website-Leistung die Website für China (auf Chinesisch oder Englisch). Andere landesspezifische Websites von MathWorks sind für Besuche von Ihrem Standort aus nicht optimiert.