quality is saved so that if the application cannot see any
satellites, it stops updating the GPS location of the robot. If
this is not done, you will start reading invalid values.
latitude
long
i
tude
Building the Web Page
Once you know the location of your bot, it is time to
map out the location in the Google Maps API. The Google
Maps API lets you embed Google Maps in your own web
page. With a latitude/longitude, the server is able to map
the location of the device on a web page. If the device is
located on a street that supports Google Street View, then
this is also drawn on the web page. (See the figure for the
web page example.)
The web page that is displayed to the user is separated
into two different maps. On the left, a map is centered on
the area that was last received by the local GPS location
object. On the right, a panoramic picture of the nearest
street location supported by Google Street View is
displayed. If no nearby street is supported by Google Street
View, the image is not rendered.
Initializing, drawing, and centering the map are
completed with two lines of code calling the Google API.
var map = new GMap2(document.getElement
ById(“map_canvas”));
map.setCenter(new GLatLng(<!
————————FUNCTIONCALL getLat —>,<!—
FUNCTIONCALL getLon —>), 16);
The FUNCTIONCALL comment in the HTML code is a
utility function provided by NetBurner that allows HTML
code to call C/C++ functions prior to rendering the web
page. In this case, the functions getLat and getLon are
called. These are functions that return the most recent
latitude and longitude in plain text.
Creating the panoramic view works in a nearly identical
way. The difference is that instead of creating a GMap2
object, a GStreetviewPanorama object is created. Once
created, you center the view on your location with a
setLocationAndPOV API call.
Additional Capabilities
Many options exist to extend this application with a
little work. Logging incoming data to your web server will
allow you to create a path in Google Maps to track the
entire journey of your robots. Directions could be sent to
the robot via text messages, turning any phone into a
navigational device. SV
MOD5270LC Development Kit
Netburner NNDK-MOD5270LC-KIT
Parts
GM862 Evaluation Kit; SparkFun CEL-00479
54 SERVO 07.2010