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=RF) specifies the reference frame in which the GNSS readings are reported.

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

example

Input Arguments

expand all

Reference frame of the sensor inputs, specified as either 'NED' (North-East-Down) or 'ENU' (East-North-Up).

Data Types: char | string

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   52.2599
   42.2834  -71.3418  -48.7719
   42.2843  -71.3406 -147.1144
   42.2852  -71.3394 -246.3057
   42.2861  -71.3382 -348.1564
   42.2870  -71.3369 -450.0316

velocityReadings = 6×3

    9.9788    9.9988   10.0448
   10.0012   10.0143   10.0055
    9.9764   10.0048   10.0370
    9.9736   10.0235   10.0032
   10.0165    9.9844    9.9788
   10.0018    9.9889   10.0746

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) 

Figure contains an object of type skyplot.

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