Webots Reference Manual - chapter 3 - section 31

Webots Reference Manual


3.31 InertialUnit

Derived from Device.

InertialUnit {
  MFVec3f    lookupTable    []    # interpolation
  SFBool     xAxis          TRUE  # compute roll
  SFBool     yAxis          TRUE  # compute yaw
  SFBool     zAxis          TRUE  # compute pitch
}

3.31.1 Description

The InertialUnit node simulates an Inertial Measurement Unit (IMU). The InertialUnit computes and returns its roll, pitch and yaw angles with respect to a global coordinate system defined in the WorldInfo node. If you would like to measure an acceleration or an angular velocity, please use the Accelerometer or Gyro node instead. The InertialUnit node must be placed on the Robot so that its x-axis points in the direction of the Robot's forward motion (longitudinal axis). The positive z-axis must point towards the Robot's right side, e.g. right arm, right wing (lateral axis). The positive y-axis must point to the Robot's up/top direction. If the InertialUnit has this orientation, then the roll, pitch and yaw angles correspond to the usual automotive, aeronautics or spatial meaning.

3.31.2 Field Summary

3.31.3 InertialUnit Functions



NAME

   wb_inertial_unit_enable, wb_inertial_unit_disable, wb_inertial_unit_get_sampling_period, wb_inertial_unit_get_roll_pitch_yaw - enable, disable and read the output values of the inertial unit

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

  #include <webots/inertial_unit.h>

  void wb_inertial_unit_enable(WbDeviceTag tag, int ms);
  void wb_inertial_unit_disable(WbDeviceTag tag);
  int wb_inertial_unit_get_sampling_period(WbDeviceTag tag);
  const double *wb_inertial_unit_get_roll_pitch_yaw(WbDeviceTag tag);

DESCRIPTION

The wb_inertial_unit_enable() function turns on the angle measurement each ms milliseconds.

The wb_inertial_unit_disable() function turns off the InertialUnit device.

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

The wb_inertial_unit_get_roll_pitch_yaw() function returns the current roll, pitch and yaw angles of the InertialUnit. The values are returned as an array of 3 components therefore only the indices 0, 1, and 2 are valid for accessing the returned array. Note that the indices 0, 1 and 2 return the roll, pitch and yaw angles respectively.

The roll angle indicates the unit's rotation angle about its x-axis, in the interval [-π,π]. The roll angle is zero when the InertialUnit is horizontal, i.e. when its z-axis is parallel to the ground plane. The WorldInfo.gravity vector defines the orientation of the ground plane.

The pitch angle indicates the unit's rotation angle about is z-axis, in the interval [-π/2,π/2]. The pitch angle is zero when the InertialUnit is horizontal, i.e. when its x-axis is parallel to the ground plane. If the InertialUnit is placed on the Robot with a standard orientation, then the pitch angle is negative when the Robot is going down, and positive when the robot is going up.

The yaw angle indicates the unit orientation, in the interval [-π,π], with respect to WorldInfo.northDirection. The yaw angle is zero when the InertialUnit's x-axis is aligned with the north direction, it is π/2 when the unit is heading east, and -π/2 when the unit is oriented towards the west. The yaw angle can be used as a compass.

language: C, C++
The returned vector is a pointer to internal values managed by the Webots, 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
getRollPitchYaw() returns the angles as a list containing three floats.
release 7.0.2
Copyright © 2012 Cyberbotics Ltd. All right reserved.