Webots Reference Manual - chapter 3 - section 25

Webots Reference Manual


3.25 GPS

Derived from Device.

GPS {
  SFString   type         "satellite"
  SFFloat    resolution   0
}

3.25.1 Description

The GPS node is used to model a Global Positioning Sensor (GPS) which can obtain information about its absolute position from the controller program.

3.25.2 Field Summary

3.25.3 GPS Functions



NAME

   wb_gps_enable, wb_gps_disable, wb_gps_get_sampling_period, wb_gps_get_values - enable, disable and read the GPS measurements

SYNOPSIS [C++] [Java] [Python] [Matlab]

  #include <webots/gps.h>

  void wb_gps_enable(WbDeviceTag tag, int ms);
  void wb_gps_disable(WbDeviceTag tag);
  int wb_gps_get_sampling_period(WbDeviceTag tag);
  const double *wb_gps_get_values(WbDeviceTag tag);

DESCRIPTION

wb_gps_enable() allows the user to enable a GPS measurement each ms milliseconds.

wb_gps_disable() turns the GPS off, saving computation time.

The wb_gps_get_sampling_period() function returns the period given into the wb_gps_enable() function, or 0 if the device is disabled.

The wb_gps_get_values() function returns the current GPS measurement. The values are returned as a 3D-vector, therefore only the indices 0, 1, and 2 are valid for accessing the vector. The returned vector indicates the absolute position of the GPS device.

language: C, C++
The returned vector is a pointer to the internal values managed by the GPS node, therefore it is illegal to free this pointer. Furthermore, note that the pointed values are only valid until the next call to wb_robot_step() or Robot::step(). If these values are needed for a longer period they must be copied.
language: Python
getValues() returns the 3D-vector as a list containing three floats.
release 7.0.2
Copyright © 2012 Cyberbotics Ltd. All right reserved.