# factorGPS

Factor for GPS measurement

Since R2022a

## Description

The `factorGPS` object adds a constraint to a node in a `factorGraph` by using a GPS position measurement.

## Creation

### Syntax

``F = factorGPS(NodeID)``
``F = factorGPS(NodeID,Name=Value)``

### Description

````F = factorGPS(NodeID)` returns a `factorGPS` object, `F`, with the node identification number set to `NodeID`. The GPS factor adds a constraint to the corresponding factor graph node by using a GPS position measurement.```

example

````F = factorGPS(NodeID,Name=Value)` specifies properties using one or more name-value arguments. For example, `factorGPS(1,VDOP=1)` sets the `VDOP` property of the `factorGPS` object to `1`.```

## Properties

expand all

Node ID number, specified as a nonnegative integer. The `factorGPS` object factor connects to a node of type `POSE_SE3` in the factor graph using the specified node ID.

If a factor in the `factorGPS` object specifies ID that does not correspond to a node in the factor graph, the factor graph automatically creates an `POSE_SE3` type node with that ID and adds it to the factor graph when adding the factor to the factor graph.

You must specify this property at object creation.

For more information about the expected node types of all supported factors, see Expected Node Types of Factor Objects.

Geodetic position measurement, specified as a three-element row vector of geodetic coordinates in the form (`latitude` `longitude` `altitude`). Latitude and longitude are in degrees and altitude is in meters.

Horizontal dilution of precision, specified as a positive scalar.

Vertical dilution of precision, specified as a positive scalar.

Origin of the local coordinate system, specified as a three-element row vector of geodetic coordinates in the form (`latitude` `longitude` `altitude`). Latitude and longitude are in degrees and altitude is in meters.

Altitude is the height above the reference ellipsoid mode, WGS84.

Reference frame for the local coordinate system, specified as `"ENU"` (east-north-up) or `"NED"` (north-east-down).

Data Types: `string` | `char`

## Object Functions

 `nodeType` Get node type of node in factor graph

## Examples

collapse all

Set up parameters such as the connected node ID, and reference location. Then create a GPS factor with these parameters as arguments, and set the reference frame to "`NED"`.

```id = 1; loc = [5 5 1000]; hdop = 1.5; vdop = 2.4; refloc = [0 0 100]; f = factorGPS(id,Location=loc,HDOP=hdop,VDOP=vdop,ReferenceLocation=refloc,ReferenceFrame="NED");```

Create a default factor graph and add the factor to the graph using the `addFactor` function.

```g = factorGraph; addFactor(g,f);```