メインコンテンツ

uavFormationMetrics

UAV trajectory ensemble for formation performance metrics

Since R2024b

    Description

    The uavFormationMetrics object creates a UAV formation trajectory ensemble that you can use to compute the formation performance metrics for a UAV formation that consist of safety, order, connectivity, union, distance, and graph.

    Creation

    Description

    trajectoryEnsemble = uavFormationMetrics(traj) creates a UAV trajectory ensemble object from the specified UAV trajectories traj.

    trajectoryEnsemble = uavFormationMetrics(traj,Name=Value) specifies properties using one or more name-value arguments. For example, uavFormationMetrics(trajObject,SafetyRadius=5) sets the safety radius to 5 meters.

    example

    Input Arguments

    expand all

    Trajectories of UAVs in the formation, specified as cell array of timetable, where each timetable stores the trajectory of a UAV in the formation.

    Each timetable must consist of a time value, specified as an N-element vector , where N is the number of positions in the trajectory and each value is the arrival time of the UAV at the corresponding position, and these variables:

    VariableDescription
    Var1

    Position, specified as a N-by-3 matrix in the north-east-down (NED) reference frame, in meters. Each row contains the [X Y Z] position of the UAV at the corresponding time.

    Var2

    Velocity, specified as an N-by-3 matrix in the north-east-down (NED) reference frame, in meters per second. Each row contains the[Vx Vy Vz] velocity of the UAV at the corresponding position.

    Properties

    expand all

    Safety radius of the UAVs in the formation, specified as a positive numeric scalar in meters. In a formation flight, a collision occurs if the distance between any two UAVs is less than twice of this radius.

    Data Types: double

    Maximum connection range of the UAVs in the formation, specified as a positive numeric scalar in meters. This property determines the maximum distance at which UAVs can establish connections to one another.

    Data Types: double

    Maximum number of neighbors of each UAV in the formation, specified as a nonnegative integer. This property specifies the maximum number of other UAVs that each UAV can connect to.

    Data Types: double

    Object Functions

    metricsGet UAV formation performance and inter-UAV distance metrics
    formationInfoGet UAV formation graph, positions, and inter-UAV distances

    Examples

    collapse all

    Specify the number of UAVs in a UAV formation, and create the timestamps for the UAV trajectories.

    % Number of UAVs in the formation
    numUAV = 4;
    
    % Timestamps
    time = [0; 1];

    Specify the position of each UAV in ENU frame in meters at 0 and 1 seconds.

    uav1_position = [1 0 10;
                    1 0 10.5];
    uav2_position = [0.5 0.8 10;
                    0.5 1.8 11];
    uav3_position = [1.5 1 10;
                    1.5 1.8 11];
    uav4_position = [2 0 10;
                    1.5 0 10.5];

    Specify the velocity of each UAV in ENU frame in m/s at 0 and 1 seconds.

    uav1_velocity = [0 0 0.5; 
                    1 0 0];
    uav2_velocity = [0 1 1;
                    1 0 0];
    uav3_velocity = [0 1 1;
                    1 0 0];
    uav4_velocity = [0 0 0.5;
                    1 0 0];

    Store the trajectory of each UAV in a timetable, and store the timetables in a cell array.

    trajData1=timetable(seconds(time),uav1_position,uav1_velocity,VariableNames={'Position','Velocity'});
    trajData2=timetable(seconds(time),uav2_position,uav2_velocity,VariableNames={'Position','Velocity'});
    trajData3=timetable(seconds(time),uav3_position,uav3_velocity,VariableNames={'Position','Velocity'});
    trajData4=timetable(seconds(time),uav4_position,uav4_velocity,VariableNames={'Position','Velocity'});

    Create a UAV trajectory ensemble object. Specify the safety radius as 0.25 meters, a maximum connectivity range of 1.5 meters, and a maximum number of neighbors of 5.

    trajectoryEnsemble = uavFormationMetrics({trajData1,trajData2,trajData3,trajData4},SafetyRadius=0.25,ConnectivityRange=1.5,...
        MaxNumNeighbors=5);

    Obtain the performance and distance metrics of the UAV formation.

    [perfMetrics,distMetrics] = metrics(trajectoryEnsemble);

    Plot the formation performance metrics.

    stackedplot(perfMetrics)
    grid on
    title("Formation Performance Metrics")

    Figure contains an object of type stackedplot. The chart of type stackedplot has title Formation Performance Metrics.

    Plot the distance performance metrics.

    stackedplot(distMetrics)
    grid on
    title("Distance Metrics")

    Figure contains an object of type stackedplot. The chart of type stackedplot has title Distance Metrics.

    Obtain the UAV formation information.

    info = formationInfo(trajectoryEnsemble);

    Plot the UAV formation at the initial time step.

    % Create edge label for UAV distance at 0 seconds
    edgeLabel0 = info.FormationGraph{1}.Edges.Weight;
    
    % Plot the formation at 0 seconds
    plot(info.FormationGraph{1},EdgeLabel=edgeLabel0, ...
        XData=info.PositionX(1,:),YData=info.PositionY(1,:), ...
        ZData=info.PositionZ(1,:));
    
    % Add title labels to each axis
    title("UAV Formation at t = 0 seconds")
    xlabel("East")
    ylabel("North")
    zlabel("Up")

    Figure contains an axes object. The axes object with title UAV Formation at t = 0 seconds, xlabel East, ylabel North contains an object of type graphplot.

    Plot the UAV formation after movement at t = 1 second. In this time, some UAVs are out of the connectivity range and form 2 connected subgroups.

    % Create edge label for UAV distance at 1 second
    edgeLabel1 = info.FormationGraph{2}.Edges.Weight;
    
    % Plot the formation at 1 second
    plot(info.FormationGraph{2},EdgeLabel=edgeLabel1, ...
        XData=info.PositionX(2,:),YData=info.PositionY(1,:), ...
        ZData=info.PositionZ(2,:)); 
    
    % Add labels to each axis
    title("UAV Formation at t = 1 second")
    xlabel("East")
    ylabel("North")
    zlabel("Up")

    Figure contains an axes object. The axes object with title UAV Formation at t = 1 second, xlabel East, ylabel North contains an object of type graphplot.

    Obtain the inter-UAV distance for all UAV pairs in the formation at t = 1 second.

    info.InterUAVDistance{2}
    ans=6×2 table
        UAVPair    Distance
        _______    ________
    
        1    2      1.9339 
        1    3      1.9339 
        1    4         0.5 
        2    3           1 
        2    4       2.119 
        3    4      1.8682 
    
    

    Version History

    Introduced in R2024b