Webots Reference Manual

previous page go up next page

Thanks

1. Introduction

2. Node Chart

3. Nodes and API Functions

4. Motion Functions

5. Prototypes

6. Physics Plugin

7. Fast2D Plugin

8. MTN Functions

9. Webots World Files

     

3.20 GPS

Derived from Solid.

GPS {
  SFString   type         "satellite"
  SFFloat    resolution   0.001
}

3.20.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.20.2 Field Summary

  • type: This field defines the type of GPS technology used like "satellite" or "laser" (currently ignored).

  • resolution: This field defines the precision of the GPS, that is the maximum error (expressed in meter) in the absolute position.

3.20.3 GPS Functions

NAME

   wb_gps_enable, wb_gps_disable - enable and disable the GPS measurements

C SYNOPSIS

  #include <webots/gps.h>

  void wb_gps_enable(WbDeviceTag gps, int ms);
  void wb_gps_disable(WbDeviceTag gps);

C++ SYNOPSIS

  #include <webots/GPS.hpp>

  void GPS::enable(int ms);
  void GPS::disable();

JAVA SYNOPSIS

  import com.cyberbotics.webots.controller.GPS;

  void GPS.enable(int ms);
  void GPS.disable();

PYTHON SYNOPSIS

  from controller import GPS

  none GPS.enable(int ms)
  none GPS.disable()

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.

NAME

   wb_compass_get_values - read the output values of the gps device

C SYNOPSIS

  #include <webots/gps.h>

  const double *wb_gps_get_values(WbDeviceTag sensor);

C++ SYNOPSIS

  #include <webots/GPS.hpp>

  const double *GPS::getValues();

JAVA SYNOPSIS

  import com.cyberbotics.webots.controller.GPS;

  double[] GPS.getValues();

PYTHON SYNOPSIS

  from controller import GPS

  list<float> GPS.getValues()

DESCRIPTION

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.

Note: For the C/C++ API: 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 the wb_robot_step() function. If these values are needed for a longer period they must be copied.

previous page go up next page
^ page top ^

  E-mail to webmaster Last updated: Copyright © 2008 Cyberbotics Ltd.