append
Ajouter des états à la fin du chemin
Syntaxe
Description
Exemples
Créez un objet navPath
basé sur plusieurs waypoints dans un espace Dubins.
dubinsSpace = stateSpaceDubins([0 25; 0 25; -pi pi])
dubinsSpace = stateSpaceDubins with properties: SE2 Properties Name: 'SE2 Dubins' StateBounds: [3x2 double] NumStateVariables: 3 Dubins Vehicle Properties MinTurningRadius: 1
pathobj = navPath(dubinsSpace)
pathobj = navPath with properties: StateSpace: [1x1 stateSpaceDubins] States: [0x3 double] NumStates: 0 MaxNumStates: Inf
waypoints = [8 10 pi/2; 7 14 pi/4; 10 17 pi/2; 10 10 -pi]; append(pathobj,waypoints)
Interpolez ce chemin pour qu'il contienne exactement 250 points.
interpolate(pathobj,250)
Visualisez le chemin interpolé et les waypoints d'origine.
figure grid on axis equal hold on plot(pathobj.States(:,1),pathobj.States(:,2),".b") plot(waypoints(:,1),waypoints(:,2),"*r","MarkerSize",10)
Calculez la longueur du chemin.
len = pathLength(pathobj);
disp("Path length = " + num2str(len))
Path length = 19.4722
Chargez une carte d'occupation 3D d'un pâté de maisons dans l'espace de travail. Spécifiez le seuil pour considérer les cellules comme sans obstacle.
mapData = load("dMapCityBlock.mat");
omap = mapData.omap;
omap.FreeThreshold = 0.5;
Gonflez la carte d'occupation pour ajouter une zone tampon pour un fonctionnement sûr autour des obstacles.
inflate(omap,1)
Créez un objet d'espace d'état SE(3) avec des limites pour les variables d'état.
ss = stateSpaceSE3([0 220;0 220;0 100;inf inf;inf inf;inf inf;inf inf]);
Créez un objet navPath
basé sur plusieurs waypoints dans un espace d'état SE(3).
path = navPath(ss); waypoints = [40 180 15 0.7 0.2 0 0.1; 55 120 20 0.6 0.2 0 0.1; 100 100 25 0.5 0.2 0 0.1; 130 90 30 0.4 0 0.1 0.6; 150 33 35 0.3 0 0.1 0.6]; append(path,waypoints)
Interpolez ce chemin pour qu'il contienne exactement 250 points.
interpolate(path,250)
Visualisez le chemin interpolé et les waypoints d'origine.
show(omap) axis equal view([-10 55]) hold on % Start state scatter3(waypoints(1,1),waypoints(1,2),waypoints(1,3),"g","filled") % Goal state scatter3(waypoints(end,1),waypoints(end,2),waypoints(end,3),"r","filled") % Intermediate waypoints scatter3(waypoints(2:end-1,1),waypoints(2:end-1,2), ... waypoints(2:end-1,3),"y","filled") % Path plot3(path.States(:,1),path.States(:,2),path.States(:,3), ... "r-",LineWidth=2)
Calculez la longueur du chemin.
len = pathLength(path);
disp("Path length = " + num2str(len))
Path length = 204.1797
Arguments d'entrée
Objet Path, spécifié comme objet navPath
.
États du chemin, spécifiés sous la forme d'une matrice M-par- N à valeur réelle. M est le nombre d'états ajoutés au chemin, et N est la dimension de chaque état. La dimension de chaque état est régie par l'espace d'état défini dans la propriété StateSpace de navPath
. Les états en dehors du StateBounds
de l'espace d'état du chemin sont élagués aux limites.
Exemple : [0 0 0; 1 1 0; 2 2 0]
Exemple : [0 0 0 1 0 0 0; 1 1 1 1 0 0 0; 2 2 1 1 0 0 0]
Types de données : double
Capacités étendues
Génération de code C/C++
Générez du code C et C++ avec MATLAB® Coder™.
Historique des versions
Introduit dans R2019b
MATLAB Command
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.
Sélectionner un site web
Choisissez un site web pour accéder au contenu traduit dans votre langue (lorsqu'il est disponible) et voir les événements et les offres locales. D’après votre position, nous vous recommandons de sélectionner la région suivante : .
Vous pouvez également sélectionner un site web dans la liste suivante :
Comment optimiser les performances du site
Pour optimiser les performances du site, sélectionnez la région Chine (en chinois ou en anglais). Les sites de MathWorks pour les autres pays ne sont pas optimisés pour les visites provenant de votre région.
Amériques
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)