The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Tinkerforge::BrickIMUV2 - Full fledged AHRS with 9 degrees of freedom

CONSTANTS

DEVICE_IDENTIFIER

This constant is used to identify a IMU Brick 2.0.

The get_identity() subroutine and the CALLBACK_ENUMERATE callback of the IP Connection have a device_identifier parameter to specify the Brick's or Bricklet's type.

DEVICE_DISPLAY_NAME

This constant represents the display name of a IMU Brick 2.0.

CALLBACK_ACCELERATION

This constant is used with the register_callback() subroutine to specify the CALLBACK_ACCELERATION callback.

CALLBACK_MAGNETIC_FIELD

This constant is used with the register_callback() subroutine to specify the CALLBACK_MAGNETIC_FIELD callback.

CALLBACK_ANGULAR_VELOCITY

This constant is used with the register_callback() subroutine to specify the CALLBACK_ANGULAR_VELOCITY callback.

CALLBACK_TEMPERATURE

This constant is used with the register_callback() subroutine to specify the CALLBACK_TEMPERATURE callback.

CALLBACK_LINEAR_ACCELERATION

This constant is used with the register_callback() subroutine to specify the CALLBACK_LINEAR_ACCELERATION callback.

CALLBACK_GRAVITY_VECTOR

This constant is used with the register_callback() subroutine to specify the CALLBACK_GRAVITY_VECTOR callback.

CALLBACK_ORIENTATION

This constant is used with the register_callback() subroutine to specify the CALLBACK_ORIENTATION callback.

CALLBACK_QUATERNION

This constant is used with the register_callback() subroutine to specify the CALLBACK_QUATERNION callback.

CALLBACK_ALL_DATA

This constant is used with the register_callback() subroutine to specify the CALLBACK_ALL_DATA callback.

FUNCTION_GET_ACCELERATION

This constant is used with the get_response_expected(), set_response_expected() and set_response_expected_all() subroutines.

FUNCTION_GET_MAGNETIC_FIELD

This constant is used with the get_response_expected(), set_response_expected() and set_response_expected_all() subroutines.

FUNCTION_GET_ANGULAR_VELOCITY

This constant is used with the get_response_expected(), set_response_expected() and set_response_expected_all() subroutines.

FUNCTION_GET_TEMPERATURE

This constant is used with the get_response_expected(), set_response_expected() and set_response_expected_all() subroutines.

FUNCTION_GET_ORIENTATION

This constant is used with the get_response_expected(), set_response_expected() and set_response_expected_all() subroutines.

FUNCTION_GET_LINEAR_ACCELERATION

This constant is used with the get_response_expected(), set_response_expected() and set_response_expected_all() subroutines.

FUNCTION_GET_GRAVITY_VECTOR

This constant is used with the get_response_expected(), set_response_expected() and set_response_expected_all() subroutines.

FUNCTION_GET_QUATERNION

This constant is used with the get_response_expected(), set_response_expected() and set_response_expected_all() subroutines.

FUNCTION_GET_ALL_DATA

This constant is used with the get_response_expected(), set_response_expected() and set_response_expected_all() subroutines.

FUNCTION_LEDS_ON

This constant is used with the get_response_expected(), set_response_expected() and set_response_expected_all() subroutines.

FUNCTION_LEDS_OFF

This constant is used with the get_response_expected(), set_response_expected() and set_response_expected_all() subroutines.

FUNCTION_ARE_LEDS_ON

This constant is used with the get_response_expected(), set_response_expected() and set_response_expected_all() subroutines.

FUNCTION_SAVE_CALIBRATION

This constant is used with the get_response_expected(), set_response_expected() and set_response_expected_all() subroutines.

FUNCTION_SET_ACCELERATION_PERIOD

This constant is used with the get_response_expected(), set_response_expected() and set_response_expected_all() subroutines.

FUNCTION_GET_ACCELERATION_PERIOD

This constant is used with the get_response_expected(), set_response_expected() and set_response_expected_all() subroutines.

FUNCTION_SET_MAGNETIC_FIELD_PERIOD

This constant is used with the get_response_expected(), set_response_expected() and set_response_expected_all() subroutines.

FUNCTION_GET_MAGNETIC_FIELD_PERIOD

This constant is used with the get_response_expected(), set_response_expected() and set_response_expected_all() subroutines.

FUNCTION_SET_ANGULAR_VELOCITY_PERIOD

This constant is used with the get_response_expected(), set_response_expected() and set_response_expected_all() subroutines.

FUNCTION_GET_ANGULAR_VELOCITY_PERIOD

This constant is used with the get_response_expected(), set_response_expected() and set_response_expected_all() subroutines.

FUNCTION_SET_TEMPERATURE_PERIOD

This constant is used with the get_response_expected(), set_response_expected() and set_response_expected_all() subroutines.

FUNCTION_GET_TEMPERATURE_PERIOD

This constant is used with the get_response_expected(), set_response_expected() and set_response_expected_all() subroutines.

FUNCTION_SET_ORIENTATION_PERIOD

This constant is used with the get_response_expected(), set_response_expected() and set_response_expected_all() subroutines.

FUNCTION_GET_ORIENTATION_PERIOD

This constant is used with the get_response_expected(), set_response_expected() and set_response_expected_all() subroutines.

FUNCTION_SET_LINEAR_ACCELERATION_PERIOD

This constant is used with the get_response_expected(), set_response_expected() and set_response_expected_all() subroutines.

FUNCTION_GET_LINEAR_ACCELERATION_PERIOD

This constant is used with the get_response_expected(), set_response_expected() and set_response_expected_all() subroutines.

FUNCTION_SET_GRAVITY_VECTOR_PERIOD

This constant is used with the get_response_expected(), set_response_expected() and set_response_expected_all() subroutines.

FUNCTION_GET_GRAVITY_VECTOR_PERIOD

This constant is used with the get_response_expected(), set_response_expected() and set_response_expected_all() subroutines.

FUNCTION_SET_QUATERNION_PERIOD

This constant is used with the get_response_expected(), set_response_expected() and set_response_expected_all() subroutines.

FUNCTION_GET_QUATERNION_PERIOD

This constant is used with the get_response_expected(), set_response_expected() and set_response_expected_all() subroutines.

FUNCTION_SET_ALL_DATA_PERIOD

This constant is used with the get_response_expected(), set_response_expected() and set_response_expected_all() subroutines.

FUNCTION_GET_ALL_DATA_PERIOD

This constant is used with the get_response_expected(), set_response_expected() and set_response_expected_all() subroutines.

FUNCTION_SET_SENSOR_CONFIGURATION

This constant is used with the get_response_expected(), set_response_expected() and set_response_expected_all() subroutines.

FUNCTION_GET_SENSOR_CONFIGURATION

This constant is used with the get_response_expected(), set_response_expected() and set_response_expected_all() subroutines.

FUNCTION_SET_SENSOR_FUSION_MODE

This constant is used with the get_response_expected(), set_response_expected() and set_response_expected_all() subroutines.

FUNCTION_GET_SENSOR_FUSION_MODE

This constant is used with the get_response_expected(), set_response_expected() and set_response_expected_all() subroutines.

FUNCTION_SET_SPITFP_BAUDRATE_CONFIG

This constant is used with the get_response_expected(), set_response_expected() and set_response_expected_all() subroutines.

FUNCTION_GET_SPITFP_BAUDRATE_CONFIG

This constant is used with the get_response_expected(), set_response_expected() and set_response_expected_all() subroutines.

FUNCTION_GET_SEND_TIMEOUT_COUNT

This constant is used with the get_response_expected(), set_response_expected() and set_response_expected_all() subroutines.

FUNCTION_SET_SPITFP_BAUDRATE

This constant is used with the get_response_expected(), set_response_expected() and set_response_expected_all() subroutines.

FUNCTION_GET_SPITFP_BAUDRATE

This constant is used with the get_response_expected(), set_response_expected() and set_response_expected_all() subroutines.

FUNCTION_GET_SPITFP_ERROR_COUNT

This constant is used with the get_response_expected(), set_response_expected() and set_response_expected_all() subroutines.

FUNCTION_ENABLE_STATUS_LED

This constant is used with the get_response_expected(), set_response_expected() and set_response_expected_all() subroutines.

FUNCTION_DISABLE_STATUS_LED

This constant is used with the get_response_expected(), set_response_expected() and set_response_expected_all() subroutines.

FUNCTION_IS_STATUS_LED_ENABLED

This constant is used with the get_response_expected(), set_response_expected() and set_response_expected_all() subroutines.

FUNCTION_GET_PROTOCOL1_BRICKLET_NAME

This constant is used with the get_response_expected(), set_response_expected() and set_response_expected_all() subroutines.

FUNCTION_GET_CHIP_TEMPERATURE

This constant is used with the get_response_expected(), set_response_expected() and set_response_expected_all() subroutines.

FUNCTION_RESET

This constant is used with the get_response_expected(), set_response_expected() and set_response_expected_all() subroutines.

FUNCTION_GET_IDENTITY

This constant is used with the get_response_expected(), set_response_expected() and set_response_expected_all() subroutines.

FUNCTIONS

new()

Creates an object with the unique device ID *uid* and adds it to the IP Connection *ipcon*.

get_acceleration()

Returns the calibrated acceleration from the accelerometer for the x, y and z axis in 1/100 m/s².

If you want to get the acceleration periodically, it is recommended to use the :cb:`Acceleration` callback and set the period with :func:`Set Acceleration Period`.

get_magnetic_field()

Returns the calibrated magnetic field from the magnetometer for the x, y and z axis in 1/16 µT (Microtesla).

If you want to get the magnetic field periodically, it is recommended to use the :cb:`Magnetic Field` callback and set the period with :func:`Set Magnetic Field Period`.

get_angular_velocity()

Returns the calibrated angular velocity from the gyroscope for the x, y and z axis in 1/16 °/s.

If you want to get the angular velocity periodically, it is recommended to use the :cb:`Angular Velocity` acallback nd set the period with :func:`Set Angular Velocity Period`.

get_temperature()

Returns the temperature of the IMU Brick. The temperature is given in °C. The temperature is measured in the core of the BNO055 IC, it is not the ambient temperature

get_orientation()

Returns the current orientation (heading, roll, pitch) of the IMU Brick as independent Euler angles in 1/16 degree. Note that Euler angles always experience a `gimbal lock <https://en.wikipedia.org/wiki/Gimbal_lock>`__. We recommend that you use quaternions instead, if you need the absolute orientation.

The rotation angle has the following ranges:

* heading: 0° to 360° * roll: -90° to +90° * pitch: -180° to +180°

If you want to get the orientation periodically, it is recommended to use the :cb:`Orientation` callback and set the period with :func:`Set Orientation Period`.

get_linear_acceleration()

Returns the linear acceleration of the IMU Brick for the x, y and z axis in 1/100 m/s².

The linear acceleration is the acceleration in each of the three axis of the IMU Brick with the influences of gravity removed.

It is also possible to get the gravity vector with the influence of linear acceleration removed, see :func:`Get Gravity Vector`.

If you want to get the linear acceleration periodically, it is recommended to use the :cb:`Linear Acceleration` callback and set the period with :func:`Set Linear Acceleration Period`.

get_gravity_vector()

Returns the current gravity vector of the IMU Brick for the x, y and z axis in 1/100 m/s².

The gravity vector is the acceleration that occurs due to gravity. Influences of additional linear acceleration are removed.

It is also possible to get the linear acceleration with the influence of gravity removed, see :func:`Get Linear Acceleration`.

If you want to get the gravity vector periodically, it is recommended to use the :cb:`Gravity Vector` callback and set the period with :func:`Set Gravity Vector Period`.

get_quaternion()

Returns the current orientation (w, x, y, z) of the IMU Brick as `quaternions <https://en.wikipedia.org/wiki/Quaternions_and_spatial_rotation>`__.

You have to divide the returns values by 16383 (14 bit) to get the usual range of -1.0 to +1.0 for quaternions.

If you want to get the quaternions periodically, it is recommended to use the :cb:`Quaternion` callback and set the period with :func:`Set Quaternion Period`.

get_all_data()

Return all of the available data of the IMU Brick.

* acceleration in 1/100 m/s² (see :func:`Get Acceleration`) * magnetic field in 1/16 µT (see :func:`Get Magnetic Field`) * angular velocity in 1/16 °/s (see :func:`Get Angular Velocity`) * Euler angles in 1/16 ° (see :func:`Get Orientation`) * quaternion 1/16383 (see :func:`Get Quaternion`) * linear acceleration 1/100 m/s² (see :func:`Get Linear Acceleration`) * gravity vector 1/100 m/s² (see :func:`Get Gravity Vector`) * temperature in 1 °C (see :func:`Get Temperature`) * calibration status (see below)

The calibration status consists of four pairs of two bits. Each pair of bits represents the status of the current calibration.

* bit 0-1: Magnetometer * bit 2-3: Accelerometer * bit 4-5: Gyroscope * bit 6-7: System

A value of 0 means for "not calibrated" and a value of 3 means "fully calibrated". In your program you should always be able to ignore the calibration status, it is used by the calibration window of the Brick Viewer and it can be ignored after the first calibration. See the documentation in the calibration window for more information regarding the calibration of the IMU Brick.

If you want to get the data periodically, it is recommended to use the :cb:`All Data` callback and set the period with :func:`Set All Data Period`.

leds_on()

Turns the orientation and direction LEDs of the IMU Brick on.

leds_off()

Turns the orientation and direction LEDs of the IMU Brick off.

are_leds_on()

Returns *true* if the orientation and direction LEDs of the IMU Brick are on, *false* otherwise.

save_calibration()

A call of this function saves the current calibration to be used as a starting point for the next restart of continuous calibration of the IMU Brick.

A return value of *true* means that the calibration could be used and *false* means that it could not be used (this happens if the calibration status is not "fully calibrated").

This function is used by the calibration window of the Brick Viewer, you should not need to call it in your program.

set_acceleration_period()

Sets the period in ms with which the :cb:`Acceleration` callback is triggered periodically. A value of 0 turns the callback off.

The default value is 0.

get_acceleration_period()

Returns the period as set by :func:`Set Acceleration Period`.

set_magnetic_field_period()

Sets the period in ms with which the :cb:`Magnetic Field` callback is triggered periodically. A value of 0 turns the callback off.

get_magnetic_field_period()

Returns the period as set by :func:`Set Magnetic Field Period`.

set_angular_velocity_period()

Sets the period in ms with which the :cb:`Angular Velocity` callback is triggered periodically. A value of 0 turns the callback off.

get_angular_velocity_period()

Returns the period as set by :func:`Set Angular Velocity Period`.

set_temperature_period()

Sets the period in ms with which the :cb:`Temperature` callback is triggered periodically. A value of 0 turns the callback off.

get_temperature_period()

Returns the period as set by :func:`Set Temperature Period`.

set_orientation_period()

Sets the period in ms with which the :cb:`Orientation` callback is triggered periodically. A value of 0 turns the callback off.

get_orientation_period()

Returns the period as set by :func:`Set Orientation Period`.

set_linear_acceleration_period()

Sets the period in ms with which the :cb:`Linear Acceleration` callback is triggered periodically. A value of 0 turns the callback off.

get_linear_acceleration_period()

Returns the period as set by :func:`Set Linear Acceleration Period`.

set_gravity_vector_period()

Sets the period in ms with which the :cb:`Gravity Vector` callback is triggered periodically. A value of 0 turns the callback off.

get_gravity_vector_period()

Returns the period as set by :func:`Set Gravity Vector Period`.

set_quaternion_period()

Sets the period in ms with which the :cb:`Quaternion` callback is triggered periodically. A value of 0 turns the callback off.

get_quaternion_period()

Returns the period as set by :func:`Set Quaternion Period`.

set_all_data_period()

Sets the period in ms with which the :cb:`All Data` callback is triggered periodically. A value of 0 turns the callback off.

get_all_data_period()

Returns the period as set by :func:`Set All Data Period`.

set_sensor_configuration()

Sets the available sensor configuration for the Magnetometer, Gyroscope and Accelerometer. The Accelerometer Range is user selectable in all fusion modes, all other configurations are auto-controlled in fusion mode.

The default values are:

* Magnetometer Rate 20Hz * Gyroscope Range 2000°/s * Gyroscope Bandwidth 32Hz * Accelerometer Range +/-4G * Accelerometer Bandwidth 62.5Hz

.. versionadded:: 2.0.5$nbsp;(Firmware)

get_sensor_configuration()

Returns the sensor configuration as set by :func:`Set Sensor Configuration`.

.. versionadded:: 2.0.5$nbsp;(Firmware)

set_sensor_fusion_mode()

If the fusion mode is turned off, the functions :func:`Get Acceleration`, :func:`Get Magnetic Field` and :func:`Get Angular Velocity` return uncalibrated and uncompensated sensor data. All other sensor data getters return no data.

Since firmware version 2.0.6 you can also use a fusion mode without magnetometer. In this mode the calculated orientation is relative (with magnetometer it is absolute with respect to the earth). However, the calculation can't be influenced by spurious magnetic fields.

By default sensor fusion is on.

.. versionadded:: 2.0.5$nbsp;(Firmware)

get_sensor_fusion_mode()

Returns the sensor fusion mode as set by :func:`Set Sensor Fusion Mode`.

.. versionadded:: 2.0.5$nbsp;(Firmware)

set_spitfp_baudrate_config()

The SPITF protocol can be used with a dynamic baudrate. If the dynamic baudrate is enabled, the Brick will try to adapt the baudrate for the communication between Bricks and Bricklets according to the amount of data that is transferred.

The baudrate will be increased exponetially if lots of data is send/receieved and decreased linearly if little data is send/received.

This lowers the baudrate in applications where little data is transferred (e.g. a weather station) and increases the robustness. If there is lots of data to transfer (e.g. Thermal Imaging Bricklet) it automatically increases the baudrate as needed.

In cases where some data has to transferred as fast as possible every few seconds (e.g. RS485 Bricklet with a high baudrate but small payload) you may want to turn the dynamic baudrate off to get the highest possible performance.

The maximum value of the baudrate can be set per port with the function :func:`Set SPITFP Baudrate`. If the dynamic baudrate is disabled, the baudrate as set by :func:`Set SPITFP Baudrate` will be used statically.

The minimum dynamic baudrate has a value range of 400000 to 2000000 baud.

By default dynamic baudrate is enabled and the minimum dynamic baudrate is 400000.

.. versionadded:: 2.0.10$nbsp;(Firmware)

get_spitfp_baudrate_config()

Returns the baudrate config, see :func:`Set SPITFP Baudrate Config`.

.. versionadded:: 2.0.10$nbsp;(Firmware)

get_send_timeout_count()

Returns the timeout count for the different communication methods.

The methods 0-2 are available for all Bricks, 3-7 only for Master Bricks.

This function is mostly used for debugging during development, in normal operation the counters should nearly always stay at 0.

.. versionadded:: 2.0.7$nbsp;(Firmware)

set_spitfp_baudrate()

Sets the baudrate for a specific Bricklet port ('a' - 'd'). The baudrate can be in the range 400000 to 2000000.

If you want to increase the throughput of Bricklets you can increase the baudrate. If you get a high error count because of high interference (see :func:`Get SPITFP Error Count`) you can decrease the baudrate.

If the dynamic baudrate feature is enabled, the baudrate set by this function corresponds to the maximum baudrate (see :func:`Set SPITFP Baudrate Config`).

Regulatory testing is done with the default baudrate. If CE compatability or similar is necessary in you applications we recommend to not change the baudrate.

The default baudrate for all ports is 1400000.

.. versionadded:: 2.0.5$nbsp;(Firmware)

get_spitfp_baudrate()

Returns the baudrate for a given Bricklet port, see :func:`Set SPITFP Baudrate`.

.. versionadded:: 2.0.5$nbsp;(Firmware)

get_spitfp_error_count()

Returns the error count for the communication between Brick and Bricklet.

The errors are divided into

* ACK checksum errors, * message checksum errors, * frameing errors and * overflow errors.

The errors counts are for errors that occur on the Brick side. All Bricklets have a similar function that returns the errors on the Bricklet side.

.. versionadded:: 2.0.5$nbsp;(Firmware)

enable_status_led()

Enables the status LED.

The status LED is the blue LED next to the USB connector. If enabled is is on and it flickers if data is transfered. If disabled it is always off.

The default state is enabled.

disable_status_led()

Disables the status LED.

The status LED is the blue LED next to the USB connector. If enabled is is on and it flickers if data is transfered. If disabled it is always off.

The default state is enabled.

is_status_led_enabled()

Returns *true* if the status LED is enabled, *false* otherwise.

get_protocol1_bricklet_name()

Returns the firmware and protocol version and the name of the Bricklet for a given port.

This functions sole purpose is to allow automatic flashing of v1.x.y Bricklet plugins.

get_chip_temperature()

Returns the temperature in °C/10 as measured inside the microcontroller. The value returned is not the ambient temperature!

The temperature is only proportional to the real temperature and it has an accuracy of +-15%. Practically it is only useful as an indicator for temperature changes.

reset()

Calling this function will reset the Brick. Calling this function on a Brick inside of a stack will reset the whole stack.

After a reset you have to create new device objects, calling functions on the existing ones will result in undefined behavior!

get_identity()

Returns the UID, the UID where the Brick is connected to, the position, the hardware and firmware version as well as the device identifier.

The position can be '0'-'8' (stack position).

The device identifier numbers can be found :ref:`here <device_identifier>`. |device_identifier_constant|