Main Content

copy

Create deep copy of plannerPRM object

Since R2022a

    Description

    planner2 = copy(planner1) creates a deep copy of the plannerPRM object with the same properties.

    example

    Examples

    collapse all

    Create an occupancy map from an example map and set the map resolution as 10 cells/meter.

    map = load("exampleMaps.mat").simpleMap;
    map = occupancyMap(map,10);

    Create a state space and update the state space bounds to be the same as the map limits.

    ss = stateSpaceSE2;
    ss.StateBounds = [map.XWorldLimits; map.YWorldLimits; [-pi pi]];

    Create a state validator with stateSpaceSE2 using the map and set the validation distance.

    sv = validatorOccupancyMap(ss,Map=map);
    sv.ValidationDistance = 0.01;

    Create a plannerPRM object.

    planner = plannerPRM(ss,sv)
    planner = 
      plannerPRM with properties:
    
                   StateSpace: [1x1 stateSpaceSE2]
               StateValidator: [1x1 validatorOccupancyMap]
                 StateSampler: [1x1 stateSamplerUniform]
        MaxConnectionDistance: Inf
                  MaxNumNodes: 50
    
    

    Create a copy of the plannerPRM object.

    plannerNew = copy(planner)
    plannerNew = 
      plannerPRM with properties:
    
                   StateSpace: [1x1 stateSpaceSE2]
               StateValidator: [1x1 validatorOccupancyMap]
                 StateSampler: [1x1 stateSamplerUniform]
        MaxConnectionDistance: Inf
                  MaxNumNodes: 50
    
    

    Input Arguments

    collapse all

    Path planner, specified as a plannerPRM object.

    Output Arguments

    collapse all

    Copy of path planner, returned as a plannerPRM object.

    Extended Capabilities

    C/C++ Code Generation
    Generate C and C++ code using MATLAB® Coder™.

    Version History

    Introduced in R2022a

    See Also

    Objects

    Functions