Main Content

copy

Create deep copy of object

Since R2020b

    Description

    example

    plannerCopy = copy(planner) creates a deep copy of the trajectoryOptimalFrenet object with the same properties.

    Examples

    collapse all

    Create a binaryOccupancyMap with a obstacle grid map.

    grid = zeros(50,100);
    grid(24:26,48:53) = 1;
    map = binaryOccupancyMap(grid);

    Create a state validator. Assign the map and the state bounds to the state validator.

    validator = validatorOccupancyMap;
    validator.Map = map;
    validator.StateSpace.StateBounds(1:2,:) = [map.XWorldLimits; map.YWorldLimits];

    Create a reference path for the planner.

    refPath = [0,25;100,25];

    Create a trajectoryOptimalFrenet object.

    planner = trajectoryOptimalFrenet(refPath,validator)
    planner = 
      trajectoryOptimalFrenet with properties:
    
                      Weights: [1x1 struct]
        FeasibilityParameters: [1x1 struct]
               TimeResolution: 0.1000
                  NumSegments: 1
              DeviationOffset: 0
                 CostFunction: @trajectoryOptimalFrenet.nullCost
               TrajectoryList: [1x1 struct]
               TerminalStates: [1x1 struct]
                    Waypoints: [2x2 double]
    
    

    Create a copy of trajectoryOptimalFrenet object.

    plannerNew = copy(planner)
    plannerNew = 
      trajectoryOptimalFrenet with properties:
    
                      Weights: [1x1 struct]
        FeasibilityParameters: [1x1 struct]
               TimeResolution: 0.1000
                  NumSegments: 1
              DeviationOffset: 0
                 CostFunction: @trajectoryOptimalFrenet.nullCost
               TrajectoryList: [1x1 struct]
               TerminalStates: [1x1 struct]
                    Waypoints: [2x2 double]
    
    

    Input Arguments

    collapse all

    Trajectory optimal Frenet object, specified as a trajectoryOptimalFrenet object.

    Output Arguments

    collapse all

    Copy of trajectory optimal Frenet object, returned as a trajectoryOptimalFrenet object with the same properties.

    Version History

    Introduced in R2020b