Main Content

gnssSensor

Simulate GNSS to generate position and velocity readings

Since R2020b

Description

The gnssSensor System object™ simulates a global navigation satellite system (GNSS) to generate position and velocity readings based on local position and velocity data. The object calculates satellite positions and velocities based on the sensor time and data that specifies the satellite orbital parameters. The object uses only the Global Positioning System (GPS) constellations for calculations. To set the starting positions of the satellites, set the InitialTime property.

To generate GNSS position and velocity readings:

  1. Create the gnssSensor object and set its properties.

  2. Call the object with arguments, as if it were a function.

To learn more about how System objects work, see What Are System Objects?

Calling the object increments the time of the sensor and propagates the satellite position and velocities based on the orbital parameters.

Creation

Description

GNSS = gnssSensor returns a gnssSensor System object GNSS that computes global navigation satellite system receiver readings based on local position and velocity input.

GNSS = gnssSensor(ReferenceFrame=frame) specifies the reference frame in which the GNSS readings are reported. Specify frame as 'NED' (north-east-down) or 'ENU' (east-north-up). The default value is 'NED'.

example

GNSS = gnssSensor(___,Name=Value) sets properties using one or more name-value pairs. For example, gnssSensor("SampleRate",2) creates a simulated GNSS with a sample rate of 2 Hz. Enclose each property name in quotes.

Properties

expand all

Unless otherwise indicated, properties are nontunable, which means you cannot change their values after calling the object. Objects lock when you call them, and the release function unlocks them.

If a property is tunable, you can change its value at any time.

For more information on changing property values, see System Design in MATLAB Using System Objects.

Sample rate of the GNSS receiver, specified as a positive scalar in Hz.

Data Types: single | double

Initial time of the GNSS receiver, specified as a datetime object. The object accounts for leap seconds in the conversion between the UTC and the GNSS time.

Origin of the local navigation reference frame, specified as a three-element row vector in geodetic coordinates (latitude in degrees, longitude in degrees, and altitude in meters). Altitude is the height above the reference ellipsoid model WGS84.

Data Types: single | double

Elevation mask angle, specified as a scalar in the range [0, 90] in degrees. Satellites in view but below the mask angle are not used in estimating the position of the receiver.

Tunable: Yes

Data Types: single | double

Standard deviation of the measurement noise of pseudorange, specified as a nonnegative scalar in meters.

Tunable: Yes

Data Types: single | double

Standard deviation of the measurement noise of pseudorange rate, specified as a nonnegative scalar in meters per second.

Tunable: Yes

Data Types: single | double

Random number source, specified as one of these options::

  • "Global stream" –– Random numbers are generated using the current global random number stream.

  • "mt19937ar with seed" –– Random numbers are generated using the mt19937ar algorithm with the seed specified by the Seed property.

Data Types: char | string

Initial seed of an mt19937ar random number generator algorithm, specified as a nonnegative integer.

Dependencies

To enable this property, set RandomStream to "mt19937ar with seed".

Data Types: integer

Usage

Description

[positionReadings,velocityReadings,status] = GNSS(position,velocity) computes global navigation satellite system receiver readings from the position and velocity inputs.

Input Arguments

expand all

Cartesian position of the GNSS receiver in the local navigation coordinate system, specified as an N-by-3 matrix in meters. N is the number of samples.

The default reference frame is NED (north-east-down). For ENU (east-north-up), set the ReferenceFrame name-value argument to"ENU" on creation.

Data Types: single | double

Velocity of the GNSS receiver in the local navigation coordinate system, specified as an N-by-3 matrix in meters per second. N is the number of samples.

Data Types: single | double

The default reference frame is NED (north-east-down). For ENU (east-north-up), set the ReferenceFrame name-value argument to"ENU" on creation.

Output Arguments

expand all

Position readings of the GNSS receiver in the geodetic latitude, longitude, and altitude (LLA) coordinate system, returned as an N-by-3 matrix. Altitude is the height above the reference ellipsoid model, WGS84. N is the number of samples in the input argument. Latitude and longitude are in degrees. Altitude is in meters.

Data Types: single | double

Velocity reading of the GNSS receiver in the local navigation coordinate system in meters per second, returned as an N-by-3 matrix. N is the number of samples in the input arguments.

Data Types: single | double

Status information of visible satellites, returned as an N-element array of structures. N is the number of samples in the input arguments. Each structure contains these four fields:

Field NameDescription
SatelliteAzimuthAzimuth angles of visible satellites, returned as an M-element vector in degrees. M is the number of visible satellites.
SatelliteElevationElevation angles of visible satellites, returned as an M-element vector in degrees. M is the number of visible satellites.
HDOPHorizontal dilution of precision, returned as a scalar.
VDOPVertical dilution of precision, returned as a scalar.

To plot the satellite positions, see the skyplot function.

Object Functions

To use an object function, specify the System object as the first input argument. For example, to release system resources of a System object named obj, use this syntax:

release(obj)

expand all

cloneCreate duplicate System object
stepRun System object algorithm
releaseRelease resources and allow changes to System object property values and input characteristics
resetReset internal states of System object
isDoneEnd-of-data status

Examples

collapse all

Generate target positions and velocities based on a waypoint trajectory.

rng(2020) % For repeatable results
fs = 0.1;
tArrival = 50;
tspan = 0:1/fs:tArrival;
% Create a waypoint trajectory.
trajectory = waypointTrajectory([0,0,0;1,1,1]*500,[0,tArrival]);
[positions,~,velocities] = lookupPose(trajectory,tspan)
positions = 6×3

         0         0         0
  100.0000  100.0000  100.0000
  200.0000  200.0000  200.0000
  300.0000  300.0000  300.0000
  400.0000  400.0000  400.0000
  500.0000  500.0000  500.0000

velocities = 6×3

   10.0000   10.0000   10.0000
   10.0000   10.0000   10.0000
   10.0000   10.0000   10.0000
   10.0000   10.0000   10.0000
   10.0000   10.0000   10.0000
   10.0000   10.0000   10.0000

Create a GNSS System object. Use the LLA position for Natick, MA as the local reference frame origin of the trajectory.

refLocNatick = [42.2825 -71.343 53.0352];
gnss = gnssSensor('SampleRate',fs, ...
    'ReferenceLocation',refLocNatick);

Generate position and velocity readings based on the GNSS object.

[llaReadings,velocityReadings,status] = gnss(positions,velocities)
llaReadings = 6×3

   42.2825  -71.3430   53.9165
   42.2834  -71.3418  -44.4010
   42.2843  -71.3406 -144.8032
   42.2852  -71.3394 -246.7995
   42.2861  -71.3381 -349.6827
   42.2870  -71.3369 -447.4122

velocityReadings = 6×3

   10.0102   10.0032    9.9819
    9.9863    9.9923    9.9524
   10.0399   10.0143   10.0135
   10.0203    9.9884   10.0171
    9.9958   10.0039    9.9277
    9.9763   10.0227   10.0561

status=6×1 struct array with fields:
    SatelliteAzimuth
    SatelliteElevation
    HDOP
    VDOP

Create a GNSS sensor model as a gnssSensor System object™.

gnss = gnssSensor; 

Specify the position and velocity of the sensor. This example assumes a stationary sensor at the position of [0 0 0] in the NED reference frame. Simulate the sensor readings and get the status from visible satellites. Store the azimuth and elevation angles as vectors.

pos = [0 0 0]; 
vel = [0 0 0]; 
[~,~,status] = gnss(pos,vel); 
satAz = status.SatelliteAzimuth; 
satEl = status.SatelliteElevation; 

Plot the satellite positions.

skyplot(satAz,satEl) 

More About

expand all

References

[1] Groves, Paul D. Principles of GNSS, Inertial, and Multisensor Integrated Navigation Systems. 2nd ed, Artech House, 2013.

Extended Capabilities

Version History

Introduced in R2020b