32.6 DEVELOPING APPLICATIONS USING GPS RECEIVERS

 < Day Day Up > 



32.6 DEVELOPING APPLICATIONS USING GPS RECEIVERS

The raw data obtained from the GPS receiver-longitude, latitude, altitude, velocity and time-are not of much use unless the positional information is integrated with other software to provide useful information to the user. For instance, the digitized map of a city can be stored in the computer and, based on the GPS data obtained, the information as to where you are can be displayed on the screen. Another application can be to retrieve from a database the hotels/ restaurants/gas stations in the location. For instance, when you enter a new city in your car, the GPS receiver fitted to your mobile phone can send the location data to a local server, and the server will retrieve information about the nearby hotels from the database and send that information to your mobile phone.

start example

To develop a navigation system using GPS technology, the data obtained from the GPS receiver has to be mapped on to a digitized map.

end example

Developing such applications requires integration of the GPS data with digitized maps, databases, and other application software. Commercial software packages such as MapInfo, with interface to popular databases such as Oracle, are available, with which developing applications will be extremely easy. Systems capable of storing, manipulating, and displaying geographic information are called geographic information systems (GIS). GIS in conjunction with GPS is used extensively for automatic vehicle tracking and to provide location-based services.

Note 

For providing location-based services, a GPS receiver can be integrated into a mobile phone. The mobile phone can send the location data to a server, and the server will send the information related to that location to the mobile phone.

Location-based services are catching up very fast, and GPS technology will be an important component for such services.

Summary

In this chapter, the details of the Global Positioning System are presented. The GPS consists of space segment, control segment, and user segment. The space segment has 24 NAVSTAR satellites launched by the U.S. Department of Defense. The space segment is controlled by a master control station and a number of earth stations located all over the world. The user segment consists of GPS receivers located on cars, mobile phones, and even wristwatches. The GPS receiver obtains the positional data from the satellites and, based on this data, calculates its own positional parameters: longitude, latitude, and altitude. In addition, the velocity of the moving vehicle and the time can be displayed on the GPS receiver. The location can be displayed up to an accuracy of about 20 meters. In case more accurate location information is required, differential GPS (DGPS) is used. In DGPS, at a surveyed location (whose longitude and latitude are known exactly), there will be an FM transmitter in addition to the GPS receiver. At this surveyed location, from the GPS receiver data, the error in the positional parameters is calculated and the correction factor is obtained. This correction factor is transmitted over the FM link. The DGPS receiver located on a car, for instance will have a GPS receiver and an FM receiver. The DGPS receiver calculates its positional parameters using the GPS receiver data and then applies the correction factor based on the data received through the FM receiver. Accuracies up to one meter can be achieved using DGPS.

GPS receivers will be very useful as navigational aids. The navigation systems are now being fitted in cars, trucks, ambulances, and so forth. Geographical information systems (GIS) are now being used extensively for a variety of application such as surveying, oil exploration, and defense. In GIS, the positional parameters obtained from the GPS receiver are displayed on a digitized map of a region.

A GPS receiver has now become a consumer item with the availability of low-cost hardware. Location-based services are now considered the next killer applications in mobile communication systems.

References

  • Dreamtech Software Team. Programming for Embedded Systems. Wiley-Dreamtech India Pvt. Ltd., 2002. This book has one chapter that contains the source code for development of an embedded navigation system using a GPS receiver.

  • Dreamtech Software Team. WAP, Bluetooth and 3G Programming. Wiley-Dreamtech India Pvt. Ltd., 2002. This book contains source code for developing location-based services for mobile phones.

  • Mobile phone manufacturers such as Nokia, Motorola, Samsung, and Ericsson have mobile phones with GPS receivers. You can get the information from their Web sites. The following Web sites provide a wealth of information on GPS:

  • http://www.gpsworld.com: Gives information about GPS hardware, software, mapping software, and such.

  • http://www.conexant.com: Gives information about the Conexant GPS receiver.

  • http://www.locationforum.org: Web site of the location interoperability forum. This forum has been formed to ensure interoperability of various location-based applications developed by different vendors.

Questions

  1. What are the three segments of the GPS system? Explain each segment.

  2. What is differential GPS? Explain how the accuracy of location information can be improved using differential GPS.

  3. List the various uses of GPS in defense applications and consumer applications.

  4. Explain the architecture of a GPS receiver.

  5. List the important features of commercial GPS receivers.

Exercises

1. 

Study the format in which location data is received from an RS232 interface of a commercial GPS receiver.

the format of the location data received at the rs232 interface needs to be obtained from the data sheet of the gps receiver vendor. the code given in listing c.13 is for the conexant ( http://www.conexant.com ) gps receiver. as you can see from the code, the longitude and latitude positions are obtained as a series of characters. figure c.11 gives a digitized map. digitized map. location data from the gps receiver. /* receive the data from the gps modem */ void cgpsdlg::gpsreceiver() {cstring temp;cpoint point;int ilat, ilon;unsigned char ch[1],lat[12],lon[13],alt[11],string[60];unsigned int i;cserial serobj;if(!serobj.open(1,9600,'n',8,1))// comm port opening using given settings{ afxmessagebox(`failed to open comm port`);return;}while(1){ if(serobj.readdata(ch,1) - 0) { if((ch[0] == 'g') || (ch[0] == 'g')) { serobj.readdata(ch,1); if((ch[0] == 'p') || (ch[0] == 'p')) { serobj.readdata(ch,1); if((ch[0] == 'g') || (ch[0] == 'g')) { serobj.readdata(ch,1); if((ch[0] == 'g') || (ch[0] == 'g')) { serobj.readdata(ch,1);if((ch[0] == 'a') || (ch[0] == 'a')) { serobj.readdata(ch,1); // ',' if(ch[0] != ',') continue; serobj.readdata(ch,1); //first char of time of ',' if(ch[0] == ',')continue;serobj.readdata(string,55);//remaining char of timestring[55] = '\0';// assigning latitude value lat[0] = string[6];lat[1] = string[7];lat[2] = string[8];lat[3] = string[9];lat[4] = string[10];lat[5] = string[11];lat[6] = string[12];lat[7] = string[13];lat[8] = string[14];lat[9] = ' ';lat[10] = string[16];lat[11] = '\0';// assigning longitude valuelon[0] = string[18];lon[1] = string[19];lon[2] = string[20];lon[3] = string[21];lon[4] = string[22];lon[5] = string[23];lon[6] = string[24];lon[7] = string[25];lon[8] = string[26];lon[9] = string[27];lon[10] = ' ';lon[11] = string[29];lon[12] = '\0';// assigning altitude valuefor(i=0;i-10;i++){alt[i] = string[41+i];if(string[41+i] == 'm'){ alt[41+i-1] = ' ';alt[41+i+1] = '\0';break;}}temp.format(`lat : %s`,lat);m_lat.setwindowtext(temp); temp.format(`lon : %s`,lon);m_lon.setwindowtext(temp); temp.format(`alt : %s`,alt);m_alt.setwindowtext(temp);lat[4] = '\0'; lon[5] = '\0';temp.format(`%s`,lat); ilat = atoi(temp);temp.format(`%s`,lon);ilon = atoi(temp);point.x = ilon; point.y = ilat;// plot the location on the mapm_location.setwindowpos(null, point.x, point.y, 0, 0, swp_nosize);continue;}}}}}}} }

2. 

Derive the formula to calculate the distance between two points when the longitude and latitude of the two points are known.

to develop a navigation system, you need to calculate the distance between two points when the longitude and latitude of the two points are known. * at point p1, longitude = x1 and latitude = y1 * at point p2, longitude = x2 and latitude = y2 * distance between p1 and p2 = ((x2 − x1) 2 + (y2 − y1) 2 ) * note that 1 = 60 minutes, 1 = 3600 seconds (1 minute = 60 seconds) and 1 corresponds to 108 km (1 second corresponds to 30 meters) * the listing of the program to calculate the distance given the longitude and latitude of two points is given in listing c.14 . calculation of distance between two points given their latitude and longitude. #include `stdafx.h` #include -cmath-int main(int argc, char* argv[]) {float p1longitude, p1latitude, p2longitude, p2latitude;double res1, res2, fres;printf(`\n \n distance between two points when longitude and latitude are known \t\n\n`);printf(`longitude of i point: `);scanf(`%f`,&p1longitude);printf(`latitude of i point: `);scanf(`%f`,&p1latitude);printf(`\nlongitude of ii point: `);scanf(`%f`,&p2longitude);printf(`latitude of ii point: `);scanf(`%f`,&p2latitude); res1 = pow((double)(p2longitude - p1longitude),2.0);res2 = pow((double)(p2latitude - p1latitude),2.0); fres = pow((double)(res1 + res2),0.5) * 108;//(since 1 degree = 108 km) printf(`\ndistance between two points: %lf km \n`,fres); return 0; } the output screen is shown in figure c.12 . screenshot showing the output of the program to calculate distance.

3. 

Study the features of commercially available databases that facilitate development of Geological information systems.

information about the gis software can be obtained from the following sites: http://www.mapinfo.com , http://www.freegis.org , and http://www.opensourcegis.org .

4. 

The concept used in differential GPS can be used to track a person continuously. Work out a framework for this type of tracking. Discuss the pros and cons of such a technology. Think of applications of such a technology for public safety and also the applications that are against the privacy of individuals.

in differential gps, the mobile devices will have a gps receiver and an fm receiver using which the location parameters can be found very accurately. if the mobile device is also fitted with another fm transmitter that continuously transmits its gps data to a centralized location, then the mobile device can be continuously tracked. without the owner's knowledge, such a gadget can be fixed to a car and the car movement can be continuously tracked. such applications are required for organizations involved in public safety. but certainly, this is invading the privacy of individuals.

Answers

1. 

The format of the location data received at the RS232 interface needs to be obtained from the data sheet of the GPS receiver vendor. The code given in Listing C.13 is for the Conexant (http://www.conexant.com) GPS receiver. As you can see from the code, the longitude and latitude positions are obtained as a series of characters. Figure C.11 gives a digitized map.

click to expand
Figure C.11: Digitized map.

Listing C.13: Location data from the GPS receiver.

start example
 /* Receive the data from the GPS modem */ void CGPSDlg::GpsReceiver() {    CString temp;    CPoint point;    int iLat, iLon;    unsigned char ch[1],Lat[12],Lon[13],Alt[11],string[60];    unsigned int i;    CSerial serObj;    if(!serObj.Open(1,9600,'n',8,1))    // Comm port opening using given settings    {       AfxMessageBox("failed to open Comm Port");          return;    }    while(1)    {       if(serObj.ReadData(ch,1) > 0)       {             if((ch[0] == 'g') || (ch[0] == 'G'))             {                   serObj.ReadData(ch,1);                   if((ch[0] == 'p') || (ch[0] == 'P'))                   {                         serObj.ReadData(ch,1);                         if((ch[0] == 'g') || (ch[0] == 'G'))                         {                               serObj.ReadData(ch,1);                   if((ch[0] == 'g') || (ch[0] == 'G'))                         {                   serObj.ReadData(ch,1);                   if((ch[0] == 'a') || (ch[0] == 'A'))                               {                         serObj.ReadData(ch,1); // ','                               if(ch[0] != ',')                               continue;                   serObj.ReadData(ch,1); //first char of time of ','                                      if(ch[0] == ',')                                            continue; serObj.ReadData(string,55);                            //remaining char of time                                              string[55] = '\0';                            // Assigning Latitude value                                              Lat[0] = string[6];                                              Lat[1] = string[7];                                              Lat[2] = string[8];                            Lat[3] = string[9];                            Lat[4] = string[10];                            Lat[5] = string[11];                            Lat[6] = string[12];                            Lat[7] = string[13];                            Lat[8] = string[14];                            Lat[9] = ' ';                            Lat[10] = string[16];                                  Lat[11] = '\0';                      // Assigning Longitude value                                  Lon[0] = string[18];                                  Lon[1] = string[19];                                  Lon[2] = string[20];                                  Lon[3] = string[21];                                  Lon[4] = string[22];                                  Lon[5] = string[23];                                  Lon[6] = string[24];                                  Lon[7] = string[25];                                  Lon[8] = string[26];                                  Lon[9] = string[27];                                        Lon[10] = ' ';                                  Lon[11] = string[29];                                        Lon[12] = '\0';                // Assigning Altitude value                                  for(i=0;i<10;i++)                                        {                                  Alt[i] = string[41+i];                                  if(string[41+i] == 'M')                                        { Alt[41+i-1] = ' ';                                        Alt[41+i+1] = '\0';                                        break;                                        }                                        }                            temp.Format("Lat : %s",Lat); m_lat.SetWindowText(temp);                            temp.Format("Lon : %s",Lon); m_lon.SetWindowText(temp);                            temp.Format("Alt : %s",Alt); m_alt.SetWindowText(temp);                                             Lat[4] = '\0';                                             Lon[5] = '\0';                                      temp.Format("%s",Lat);                                             iLat = atoi(temp); temp.Format("%s",Lon);                                             iLon = atoi(temp);                                             point.x = iLon;                                             point.y = iLat;    // Plot the location on the map m_location.SetWindowPos(NULL, point.x, point.y, 0, 0, SWP_NOSIZE);                                                continue;                                        }                                  }                            }                      }                }          }    } } 
end example

2. 

To develop a navigation system, you need to calculate the distance between two points when the longitude and latitude of the two points are known.

  • At point P1, longitude = x1 and latitude = y1

  • At point P2, longitude = x2 and latitude = y2

  • Distance between P1 and P2 =*Ö((x2 x1) 2 + (y2 y1) 2)

  • Note that 1° = 60 minutes, 1° = 3600 seconds (1 minute = 60 seconds) and 1° corresponds to 108 KM (1 second corresponds to 30 Meters)

  • The listing of the program to calculate the distance given the longitude and latitude of two points is given in Listing C.14.

Listing C.14: Calculation of distance between two points given their latitude and longitude.

start example
 #include "stdafx.h" #include <cmath> int main(int argc, char* argv[]) {    float p1Longitude, p1Latitude, p2Longitude, p2Latitude;    double res1, res2, fres;    printf("\n \n Distance between two points when Longitude       and Latitude are known \t\n\n");    printf("Longitude of I point: ");    scanf("%f",&p1Longitude);    printf("Latitude of I point: ");    scanf("%f",&p1Latitude);    printf("\nLongitude of II point: ");    scanf("%f",&p2Longitude);    printf("Latitude of II point: ");    scanf("%f",&p2Latitude);    res1 = pow((double)(p2Longitude - p1Longitude),2.0);    res2 = pow((double)(p2Latitude - p1Latitude),2.0);    fres = pow((double)(res1 + res2),0.5) * 108;    //(Since 1 degree = 108 KM)    printf("\nDistance between two points: %lf KM \n",fres);    return 0; } 
end example

The output screen is shown in Figure C.12.

click to expand
Figure C.12: Screenshot showing the output of the program to calculate distance.

3. 

Information about the GIS software can be obtained from the following sites: http://www.mapinfo.com, http://www.freegis.org, and http://www.opensourcegis.org.

4. 

In differential GPS, the mobile devices will have a GPS receiver and an FM receiver using which the location parameters can be found very accurately. If the mobile device is also fitted with another FM transmitter that continuously transmits its GPS data to a centralized location, then the mobile device can be continuously tracked. Without the owner's knowledge, such a gadget can be fixed to a car and the car movement can be continuously tracked. Such applications are required for organizations involved in public safety. But certainly, this is invading the privacy of individuals.

Projects

  1. If you have access to a GPS receiver, develop software that reads the data from the GPS receiver (through RS232 or USB port). Interface this software to mapping software. If the software is loaded on a laptop and you travel in a car, the location of the car has to be displayed on the map.

  2. Generate a digital map of the city in which you live. You can take a laptop fitted with a GPS receiver and go around in the city and note the longitude and latitude values of the important places and bus stops. This information can be transferred onto the map. This map can be used for developing location-based services, a navigation system, and so forth. And, you can sell such a map for a good price too!

  3. Develop a Web site that has location-based information. When a user visits this Web site, a form can be presented to the user asking him to input the longitude and latitude of the place in which he is located. Based on this information, the location-based information (nearby hotels, restaurants, theaters, places of historical importance) needs to be provided to the user.



 < Day Day Up > 



Principles of Digital Communication Systems and Computer Networks
Principles Digital Communication System & Computer Networks (Charles River Media Computer Engineering)
ISBN: 1584503297
EAN: 2147483647
Year: 2003
Pages: 313
Authors: K V Prasad

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net