DriveWorks SDK Reference
3.0.4260 Release
For Test and Development only

Reading GPS data from sensor
Note
SW Release Applicability: This tutorial is applicable to modules in both NVIDIA DriveWorks and NVIDIA DRIVE Software releases.

The dwSensorGPS_readFrame() function reads the next available GPS data frame with a given timeout. The function call is blocking, until a GPS frame is available or the timeout is exceeded. Frames read from the sensor do not have to be returned because the messages are copied.

Depending on the particular GPS sensor capabilities, a GPS frame can be only partially filled with data. The dwGPSFlags are used to indicate which fields in dwGPSFrame are valid.

Example

The following code shows the general structure of a program reading data from a GPS sensor.

params.protocol = "gps.uart";
params.parameters = "device=/dev/<serial device>,baud=<baudrate>";
dwSensorHandle_t gpsSensor;
dwSAL_createSensor(&gpsSensor, params, ...);
dwSensor_start(gpsSensor);
while(loop)
{
dwGPSFrame frame;
dwSensorGPS_readFrame(&frame, 50000, gpsSensor);
...
}
dwSensor_stop(gpsSensor);
dwSAL_releaseSensor(&gpsSensor);

For more details see GPS Location Logger Sample