Webots Reference Manual - chapter 3 - section 27

Webots Reference Manual


3.27 Gyro

Derived from Device.

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

3.27.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.27.2 Field Summary

3.27.3 Gyro Functions



NAME

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

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

  #include <webots/gyro.h>

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

DESCRIPTION

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

The wb_gyro_disable() function turns off the Gyro device.

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

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.

language: C, C++
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 wb_robot_step() or Robot::step(). If these values are needed for a longer period they must be copied.
language: Python
getValues() returns the vector as a list containing three floats.
release 7.0.2
Copyright © 2012 Cyberbotics Ltd. All right reserved.