Contenu principal

copy

Class: nav.StatePropagator
Namespace: nav

Create deep copy of state propagator object

Since R2021b

Description

spObj2 = copy(spObj1) creates a deep copy of the specified state propagator object.

example

Input Arguments

expand all

State propagator object to be copied, specified as an object of a subclass of nav.StatePropagator.

Output Arguments

expand all

Copy of the state propagator object, returned as an object of the same class as spObj1.

Attributes

Abstracttrue

To learn about attributes of methods, see Method Attributes.

Examples

expand all

Create a default object of type mobileRobotPropagator, a subclass of nav.StatePropagator.

Load a ternary map matrix from the exampleMaps file, and use the map matrix to create an occupancyMap object. Create the state propagator using the map. By default, the state propagator uses a bicycle kinematic model.

load("exampleMaps","ternaryMap")
map = occupancyMap(ternaryMap,10);

propagator1 = mobileRobotPropagator(Environment=map) % Bicycle model
propagator1 = 
  mobileRobotPropagator with properties:

         GoalDistance: 1
      MaxControlSteps: 10
     SystemParameters: [1×1 struct]
        ControlLimits: [2×2 double]
       KinematicModel: 'bicycle'
           Integrator: 'rungekutta4'
    DistanceEstimator: 'euclidean'
        ControlPolicy: 'linearpursuit'
          Environment: [1×1 occupancyMap]
           StateSpace: [1×1 stateSpaceSE2]
      ControlStepSize: 0.1000
     NumControlOutput: 2

Create a copy of propagator1 and verify that it has the same property values.

propagator2 = copy(propagator1)
propagator2 = 
  mobileRobotPropagator with properties:

         GoalDistance: 1
      MaxControlSteps: 10
     SystemParameters: [1×1 struct]
        ControlLimits: [2×2 double]
       KinematicModel: 'bicycle'
           Integrator: 'rungekutta4'
    DistanceEstimator: 'euclidean'
        ControlPolicy: 'linearpursuit'
          Environment: [1×1 occupancyMap]
           StateSpace: [1×1 stateSpaceSE2]
      ControlStepSize: 0.1000
     NumControlOutput: 2

Verify that the copy is a deep copy by checking that the StateSpace handle properties point to distinct objects in memory. A result of logical 0 confirms they do not share the same underlying data.

propagator1.StateSpace == propagator2.StateSpace
ans = logical
   0

Version History

Introduced in R2021b