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.23 Gyro

Derived from Solid.

Gyro {
  MFVec3f    lookupTable    []    # interpolation
  SFBool     xAxis          TRUE  # compute x-axis
  SFBool     yAxis          TRUE  # compute y-axis
  SFBool     zAxis          TRUE  # compute z-axis
}

3.23.1 Description

The Gyro node is used to model 1, 2 and 3-axis angular velocity sensors (gyroscope). The angular velocity is measured in radians per second [rad/s].

3.23.2 Field Summary

  • lookupTable: This field optionally specifies a lookup table that can be used for mapping the raw angular velocity values [rad/s] to device specific output values. With the lookup table it is also possible to add noise and to define the min and max output values. By default the lookup table is empty and therefore the raw values are returned (no mapping).

  • xAxis, yAxis, zAxis: Each of these boolean fields specifies if the computation should be enabled or disabled for the specified axis. If one of these fields is set to FALSE, then the corresponding vector element will not be computed and it will return 0.0. For example if zAxis is FALSE, then wb_gyro_get_values()[2] returns 0.0. The default is that all three axes are enabled (TRUE).

3.23.3 Gyro Functions

NAME

   wb_gyro_enable, wb_gyro_disable, wb_gyro_get_values - enable, disable and read the output values of the gyro device

C SYNOPSIS

  #include <webots/gyro.h>

  void wb_gyro_enable(WbDeviceTag sensor, int ms);
  void wb_gyro_disable(WbDeviceTag sensor);
  const double *wb_gyro_get_values(WbDeviceTag sensor);

C++ SYNOPSIS

  #include <webots/Gyro.hpp>

  void Gyro::enable(int ms);
  void Gyro::disable();
  const double *Gyro::getValues();

JAVA SYNOPSIS

  import com.cyberbotics.webots.controller.Gyro;

  void Gyro.enable(int ms);
  void Gyro.disable();
  double[] Gyro.getValues();

PYTHON SYNOPSIS

  from controller import Gyro

  none Gyro.enable(int ms)
  none Gyro.disable()
  list<float> Gyro.getValues()

DESCRIPTION

The wb_gyro_enable() function turn on the angular velocity measurement each ms milliseconds.

The wb_gyro_disable() function turns off the Gyro device.

The wb_gyro_get_values() function returns the current measurement of the Gyro device. The values are returned as a 3d-vector therefore only the indices 0, 1, and 2 are valid for accessing the vector. Each vector element represents the angular velocity about one of the axes of the Gyro node, expressed in radians per second [rad/s]. The first element corresponds to the angular velocity about the x-axis, the second element to the y-axis, etc.

Note: For the C/C++ API: the returned vector is a pointer to the internal values managed by the Gyro 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.