how to get each path point for uavDubinsConnection?

2 visualizaciones (últimos 30 días)
Sinem Erdogan
Sinem Erdogan el 23 de Jun. de 2023
Respondida: Raag el 2 de Mayo de 2025
I am trying to turn my 2d dubins path to 3d by using the uavDubinsConnection code. My old code was;
dubinsSpace = stateSpaceDubins([0 500000; -100000 100000;-pi pi]); %In this line I determined the limits of the map
dubinsSpace.MinTurningRadius = 200;
pathobj = navPath(dubinsSpace);
append(pathobj,wayPoints); %waypoints is a matrix which consists 20 waypoints and corresponding angles
interpolate(pathobj,max(size(wayPoints))*10000); %in this line the code divides the path between two waypoints as the number ı have written
When I run this code ı get a pathobj and it has 3 properties in it, which are StateSpace, States ad NumStates.
For uavDubinsConnection I ran the code below.
connectionObj = uavDubinsConnection;
connectionObj.MaxRollAngle = deg2rad(5);
connectionObj.AirSpeed = 300;
for i = 1:1:39
pathSegObj = uavDubinsPathSegment(connectionObj,wayPoints(i,:),wayPoints(i+1,:));
end
%waypoints include x y z and heading degree of each point
When ı run the code aboje ı get a pathSegObj which includes the properties StartPose, GoalPose, FlightPathAngle, AirSpeed, MinTurningRadius, HelixRadius, MotionTypes,MotionLengths and Length. But, I dont get the states as I need. How could I get it, and how could I use the interpolate function for uavDubinsConnection.

Respuestas (1)

Raag
Raag el 2 de Mayo de 2025
Hi Sinem,
From what I gather, you want to obtain all the interpolated states along a 3D Dubins path generated using ‘uavDubinsConnection’, like your previous 2D workflow.
In 3D, the path is constructed as a sequence of ‘uavDubinsPathSegment’ objects, each representing the path between two waypoints. The interpolate methodof each segment object allows you to sample points along it.
Here is how you can do this:
% Example waypoints
wayPoints = [
0 0 0 0;
100 0 10 pi/6;
200 50 20 pi/4
];
connectionObj = uavDubinsConnection;
connectionObj.MaxRollAngle = deg2rad(5);
connectionObj.AirSpeed = 30;
allStates = [];
for i = 1:size(wayPoints,1)-1
pathSegObj = uavDubinsPathSegment(connectionObj, wayPoints(i,:), wayPoints(i+1,:));
N = 20; % Number of samples per segment
lengths = linspace(0, pathSegObj.Length, N);
states = interpolate(pathSegObj, lengths);
if i == 1
allStates = [allStates; states];
else
allStates = [allStates; states(2:end,:)];
end
end
Output:
Here we are using the interpolate method for each uavDubinsPathSegment to obtain path points and then concatenate results for the full path, like your 2D workflow.
For a better understanding of the above solution, refer to the following MATLAB documentations:

Categorías

Más información sobre Interpolation en Help Center y File Exchange.

Productos


Versión

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by