This is the description of the Shell API bindings for the IMU Bricklet 3.0. General information and technical specifications for the IMU Bricklet 3.0 are summarized in its hardware description.
An installation guide for the Shell API bindings is part of their general description.
The example code below is Public Domain (CC0 1.0).
1 2 3 4 5 6 7 | #!/bin/sh
# Connects to localhost:4223 by default, use --host and --port to change this
uid=XYZ # Change XYZ to the UID of your IMU Bricklet 3.0
# Get current quaternion
tinkerforge call imu-v3-bricklet $uid get-quaternion
|
Download (example-all-data.sh)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | #!/bin/sh
# Connects to localhost:4223 by default, use --host and --port to change this
uid=XYZ # Change XYZ to the UID of your IMU Bricklet 3.0
# Handle incoming all data callbacks
tinkerforge dispatch imu-v3-bricklet $uid all-data &
# Set period for all data callback to 0.1s (100ms)
tinkerforge call imu-v3-bricklet $uid set-all-data-callback-configuration 100 false
echo "Press key to exit"; read dummy
kill -- -$$ # Stop callback dispatch in background
|
Download (example-callback.sh)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | #!/bin/sh
# Connects to localhost:4223 by default, use --host and --port to change this
uid=XYZ # Change XYZ to the UID of your IMU Bricklet 3.0
# Handle incoming quaternion callbacks
tinkerforge dispatch imu-v3-bricklet $uid quaternion &
# Set period for quaternion callback to 0.1s (100ms)
tinkerforge call imu-v3-bricklet $uid set-quaternion-callback-configuration 100 false
echo "Press key to exit"; read dummy
kill -- -$$ # Stop callback dispatch in background
|
Possible exit codes for all tinkerforge
commands are:
argparse
module is missingThe common options of the call
and dispatch
commands are documented
here. The specific command structure is shown below.
call
imu-v3-bricklet
[<option>..] <uid> <function> [<argument>..]¶Parameters: |
|
---|
The call
command is used to call a function of the IMU Bricklet 3.0. It can take several
options:
--help
shows help for the specific call
command and exits--list-functions
shows a list of known functions of the IMU Bricklet 3.0 and exitsdispatch
imu-v3-bricklet
[<option>..] <uid> <callback>¶Parameters: |
|
---|
The dispatch
command is used to dispatch a callback of the IMU Bricklet 3.0. It can
take several options:
--help
shows help for the specific dispatch
command and exits--list-callbacks
shows a list of known callbacks of the IMU Bricklet 3.0 and exitsimu-v3-bricklet
<uid> <function>
[<option>..] [<argument>..]¶Parameters: |
|
---|
The <function>
to be called can take different options depending of its
kind. All functions can take the following options:
--help
shows help for the specific function and exitsGetter functions can take the following options:
--execute <command>
shell command line to execute for each incoming
response (see section about output formatting
for details)Setter functions can take the following options:
--expect-response
requests response and waits for itThe --expect-response
option for setter functions allows to detect
timeouts and other error conditions calls of setters as well. The device will
then send a response for this purpose. If this option is not given for a
setter function then no response is sent and errors are silently ignored,
because they cannot be detected.
imu-v3-bricklet
<uid> <callback>
[<option>..]¶Parameters: |
|
---|
The <callback>
to be dispatched can take several options:
--help
shows help for the specific callback and exits--execute <command>
shell command line to execute for each incoming
response (see section about output formatting
for details)imu-v3-bricklet
<uid> get-orientation
¶Output: |
|
---|
Returns the current orientation (heading, roll, pitch) of the IMU Brick as independent Euler angles. Note that Euler angles always experience a gimbal lock. We recommend that you use quaternions instead, if you need the absolute orientation.
If you want to get the orientation periodically, it is recommended
to use the orientation
callback and set the period with
set-orientation-callback-configuration
.
imu-v3-bricklet
<uid> get-linear-acceleration
¶Output: |
|
---|
Returns the linear acceleration of the IMU Brick for the
x, y and z axis. The acceleration is in the range configured with
set-sensor-configuration
.
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 get-gravity-vector
.
If you want to get the linear acceleration periodically, it is recommended
to use the linear-acceleration
callback and set the period with
set-linear-acceleration-callback-configuration
.
imu-v3-bricklet
<uid> get-gravity-vector
¶Output: |
|
---|
Returns the current gravity vector of the IMU Brick for the x, y and z axis.
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 get-linear-acceleration
.
If you want to get the gravity vector periodically, it is recommended
to use the gravity-vector
callback and set the period with
set-gravity-vector-callback-configuration
.
imu-v3-bricklet
<uid> get-quaternion
¶Output: |
|
---|
Returns the current orientation (w, x, y, z) of the IMU Brick as quaternions.
You have to divide the return 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 quaternion
callback and set the period with
set-quaternion-callback-configuration
.
imu-v3-bricklet
<uid> get-all-data
¶Output: |
|
---|
Return all of the available data of the IMU Brick.
get-acceleration
)get-magnetic-field
)get-angular-velocity
)get-orientation
)get-quaternion
)get-linear-acceleration
)get-gravity-vector
)get-temperature
)The calibration status consists of four pairs of two bits. Each pair of bits represents the status of the current calibration.
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 all-data
callback and set the period with
set-all-data-callback-configuration
.
imu-v3-bricklet
<uid> get-acceleration
¶Output: |
|
---|
Returns the calibrated acceleration from the accelerometer for the
x, y and z axis. The acceleration is in the range configured with
set-sensor-configuration
.
If you want to get the acceleration periodically, it is recommended
to use the acceleration
callback and set the period with
set-acceleration-callback-configuration
.
imu-v3-bricklet
<uid> get-magnetic-field
¶Output: |
|
---|
Returns the calibrated magnetic field from the magnetometer for the x, y and z axis.
If you want to get the magnetic field periodically, it is recommended
to use the magnetic-field
callback and set the period with
set-magnetic-field-callback-configuration
.
imu-v3-bricklet
<uid> get-angular-velocity
¶Output: |
|
---|
Returns the calibrated angular velocity from the gyroscope for the
x, y and z axis. The angular velocity is in the range configured with
set-sensor-configuration
.
If you want to get the angular velocity periodically, it is recommended
to use the angular-velocity
acallback nd set the period with
set-angular-velocity-callback-configuration
.
imu-v3-bricklet
<uid> get-temperature
¶Output: |
|
---|
Returns the temperature of the IMU Brick. The temperature is measured in the core of the BNO055 IC, it is not the ambient temperature
imu-v3-bricklet
<uid> save-calibration
¶Output: |
|
---|
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.
imu-v3-bricklet
<uid> set-sensor-configuration
<magnetometer-rate> <gyroscope-range> <gyroscope-bandwidth> <accelerometer-range> <accelerometer-bandwidth>¶Parameters: |
|
---|---|
Output: |
|
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 following symbols are available for this function:
For <magnetometer-rate>:
For <gyroscope-range>:
For <gyroscope-bandwidth>:
For <accelerometer-range>:
For <accelerometer-bandwidth>:
imu-v3-bricklet
<uid> get-sensor-configuration
¶Output: |
|
---|
Returns the sensor configuration as set by set-sensor-configuration
.
The following symbols are available for this function:
For magnetometer-rate:
For gyroscope-range:
For gyroscope-bandwidth:
For accelerometer-range:
For accelerometer-bandwidth:
imu-v3-bricklet
<uid> set-sensor-fusion-mode
<mode>¶Parameters: |
|
---|---|
Output: |
|
If the fusion mode is turned off, the functions get-acceleration
,
get-magnetic-field
and 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.
Since firmware version 2.0.13 you can also use a fusion mode without fast magnetometer calibration. This mode is the same as the normal fusion mode, but the fast magnetometer calibration is turned off. So to find the orientation the first time will likely take longer, but small magnetic influences might not affect the automatic calibration as much.
The following symbols are available for this function:
For <mode>:
imu-v3-bricklet
<uid> get-sensor-fusion-mode
¶Output: |
|
---|
Returns the sensor fusion mode as set by set-sensor-fusion-mode
.
The following symbols are available for this function:
For mode:
imu-v3-bricklet
<uid> get-spitfp-error-count
¶Output: |
|
---|
Returns the error count for the communication between Brick and Bricklet.
The errors are divided into
The errors counts are for errors that occur on the Bricklet side. All Bricks have a similar function that returns the errors on the Brick side.
imu-v3-bricklet
<uid> set-status-led-config
<config>¶Parameters: |
|
---|---|
Output: |
|
Sets the status LED configuration. By default the LED shows communication traffic between Brick and Bricklet, it flickers once for every 10 received data packets.
You can also turn the LED permanently on/off or show a heartbeat.
If the Bricklet is in bootloader mode, the LED is will show heartbeat by default.
The following symbols are available for this function:
For <config>:
imu-v3-bricklet
<uid> get-status-led-config
¶Output: |
|
---|
Returns the configuration as set by set-status-led-config
The following symbols are available for this function:
For config:
imu-v3-bricklet
<uid> get-chip-temperature
¶Output: |
|
---|
Returns the temperature 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 bad accuracy. Practically it is only useful as an indicator for temperature changes.
imu-v3-bricklet
<uid> reset
¶Output: |
|
---|
Calling this function will reset the Bricklet. All configurations will be lost.
After a reset you have to create new device objects, calling functions on the existing ones will result in undefined behavior!
imu-v3-bricklet
<uid> get-identity
¶Output: |
|
---|
Returns the UID, the UID where the Bricklet is connected to, the position, the hardware and firmware version as well as the device identifier.
The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port). A Bricklet connected to an Isolator Bricklet is always at position 'z'.
The device identifier numbers can be found here.
imu-v3-bricklet
<uid> set-acceleration-callback-configuration
<period> <value-has-to-change>¶Parameters: |
|
---|---|
Output: |
|
The period is the period with which the acceleration
callback
is triggered periodically. A value of 0 turns the callback off.
If the value has to change-parameter is set to true, the callback is only triggered after the value has changed. If the value didn't change within the period, the callback is triggered immediately on change.
If it is set to false, the callback is continuously triggered with the period, independent of the value.
imu-v3-bricklet
<uid> get-acceleration-callback-configuration
¶Output: |
|
---|
Returns the callback configuration as set by set-acceleration-callback-configuration
.
imu-v3-bricklet
<uid> set-magnetic-field-callback-configuration
<period> <value-has-to-change>¶Parameters: |
|
---|---|
Output: |
|
The period is the period with which the magnetic-field
callback
is triggered periodically. A value of 0 turns the callback off.
If the value has to change-parameter is set to true, the callback is only triggered after the value has changed. If the value didn't change within the period, the callback is triggered immediately on change.
If it is set to false, the callback is continuously triggered with the period, independent of the value.
imu-v3-bricklet
<uid> get-magnetic-field-callback-configuration
¶Output: |
|
---|
Returns the callback configuration as set by set-magnetic-field-callback-configuration
.
imu-v3-bricklet
<uid> set-angular-velocity-callback-configuration
<period> <value-has-to-change>¶Parameters: |
|
---|---|
Output: |
|
The period is the period with which the angular-velocity
callback
is triggered periodically. A value of 0 turns the callback off.
If the value has to change-parameter is set to true, the callback is only triggered after the value has changed. If the value didn't change within the period, the callback is triggered immediately on change.
If it is set to false, the callback is continuously triggered with the period, independent of the value.
imu-v3-bricklet
<uid> get-angular-velocity-callback-configuration
¶Output: |
|
---|
Returns the callback configuration as set by set-angular-velocity-callback-configuration
.
imu-v3-bricklet
<uid> set-temperature-callback-configuration
<period> <value-has-to-change>¶Parameters: |
|
---|---|
Output: |
|
The period is the period with which the temperature
callback
is triggered periodically. A value of 0 turns the callback off.
If the value has to change-parameter is set to true, the callback is only triggered after the value has changed. If the value didn't change within the period, the callback is triggered immediately on change.
If it is set to false, the callback is continuously triggered with the period, independent of the value.
imu-v3-bricklet
<uid> get-temperature-callback-configuration
¶Output: |
|
---|
Returns the callback configuration as set by set-temperature-callback-configuration
.
imu-v3-bricklet
<uid> set-orientation-callback-configuration
<period> <value-has-to-change>¶Parameters: |
|
---|---|
Output: |
|
The period is the period with which the orientation
callback
is triggered periodically. A value of 0 turns the callback off.
If the value has to change-parameter is set to true, the callback is only triggered after the value has changed. If the value didn't change within the period, the callback is triggered immediately on change.
If it is set to false, the callback is continuously triggered with the period, independent of the value.
imu-v3-bricklet
<uid> get-orientation-callback-configuration
¶Output: |
|
---|
Returns the callback configuration as set by set-orientation-callback-configuration
.
imu-v3-bricklet
<uid> set-linear-acceleration-callback-configuration
<period> <value-has-to-change>¶Parameters: |
|
---|---|
Output: |
|
The period is the period with which the linear-acceleration
callback
is triggered periodically. A value of 0 turns the callback off.
If the value has to change-parameter is set to true, the callback is only triggered after the value has changed. If the value didn't change within the period, the callback is triggered immediately on change.
If it is set to false, the callback is continuously triggered with the period, independent of the value.
imu-v3-bricklet
<uid> get-linear-acceleration-callback-configuration
¶Output: |
|
---|
Returns the callback configuration as set by set-linear-acceleration-callback-configuration
.
imu-v3-bricklet
<uid> set-gravity-vector-callback-configuration
<period> <value-has-to-change>¶Parameters: |
|
---|---|
Output: |
|
The period is the period with which the gravity-vector
callback
is triggered periodically. A value of 0 turns the callback off.
If the value has to change-parameter is set to true, the callback is only triggered after the value has changed. If the value didn't change within the period, the callback is triggered immediately on change.
If it is set to false, the callback is continuously triggered with the period, independent of the value.
imu-v3-bricklet
<uid> get-gravity-vector-callback-configuration
¶Output: |
|
---|
Returns the callback configuration as set by set-gravity-vector-callback-configuration
.
imu-v3-bricklet
<uid> set-quaternion-callback-configuration
<period> <value-has-to-change>¶Parameters: |
|
---|---|
Output: |
|
The period is the period with which the quaternion
callback
is triggered periodically. A value of 0 turns the callback off.
If the value has to change-parameter is set to true, the callback is only triggered after the value has changed. If the value didn't change within the period, the callback is triggered immediately on change.
If it is set to false, the callback is continuously triggered with the period, independent of the value.
imu-v3-bricklet
<uid> get-quaternion-callback-configuration
¶Output: |
|
---|
Returns the callback configuration as set by set-quaternion-callback-configuration
.
imu-v3-bricklet
<uid> set-all-data-callback-configuration
<period> <value-has-to-change>¶Parameters: |
|
---|---|
Output: |
|
The period is the period with which the all-data
callback
is triggered periodically. A value of 0 turns the callback off.
If the value has to change-parameter is set to true, the callback is only triggered after the value has changed. If the value didn't change within the period, the callback is triggered immediately on change.
If it is set to false, the callback is continuously triggered with the period, independent of the value.
imu-v3-bricklet
<uid> get-all-data-callback-configuration
¶Output: |
|
---|
Returns the callback configuration as set by set-all-data-callback-configuration
.
Callbacks can be used to receive time critical or recurring data from the device:
tinkerforge dispatch imu-v3-bricklet <uid> example
The available callbacks are described below.
Note
Using callbacks for recurring events is always preferred compared to using getters. It will use less USB bandwidth and the latency will be a lot better, since there is no round trip time.
imu-v3-bricklet
<uid> acceleration
¶Output: |
|
---|
This callback is triggered periodically with the period that is set by
set-acceleration-callback-configuration
. The parameters are the acceleration
for the x, y and z axis.
imu-v3-bricklet
<uid> magnetic-field
¶Output: |
|
---|
This callback is triggered periodically with the period that is set by
set-magnetic-field-callback-configuration
. The parameters are the magnetic
field for the x, y and z axis.
imu-v3-bricklet
<uid> angular-velocity
¶Output: |
|
---|
This callback is triggered periodically with the period that is set by
set-angular-velocity-callback-configuration
. The parameters are the angular
velocity for the x, y and z axis.
imu-v3-bricklet
<uid> temperature
¶Output: |
|
---|
This callback is triggered periodically with the period that is set by
set-temperature-callback-configuration
. The parameter is the temperature.
imu-v3-bricklet
<uid> linear-acceleration
¶Output: |
|
---|
This callback is triggered periodically with the period that is set by
set-linear-acceleration-callback-configuration
. The parameters are the
linear acceleration for the x, y and z axis.
imu-v3-bricklet
<uid> gravity-vector
¶Output: |
|
---|
This callback is triggered periodically with the period that is set by
set-gravity-vector-callback-configuration
. The parameters gravity vector
for the x, y and z axis.
imu-v3-bricklet
<uid> orientation
¶Output: |
|
---|
This callback is triggered periodically with the period that is set by
set-orientation-callback-configuration
. The parameters are the orientation
(heading (yaw), roll, pitch) of the IMU Brick in Euler angles. See
get-orientation
for details.
imu-v3-bricklet
<uid> quaternion
¶Output: |
|
---|
This callback is triggered periodically with the period that is set by
set-quaternion-callback-configuration
. The parameters are the orientation
(w, x, y, z) of the IMU Brick in quaternions. See get-quaternion
for details.
imu-v3-bricklet
<uid> all-data
¶Output: |
|
---|
This callback is triggered periodically with the period that is set by
set-all-data-callback-configuration
. The parameters are as for
get-all-data
.
Internal functions are used for maintenance tasks such as flashing a new firmware of changing the UID of a Bricklet. These task should be performed using Brick Viewer instead of using the internal functions directly.
imu-v3-bricklet
<uid> set-bootloader-mode
<mode>¶Parameters: |
|
---|---|
Output: |
|
Sets the bootloader mode and returns the status after the requested mode change was instigated.
You can change from bootloader mode to firmware mode and vice versa. A change from bootloader mode to firmware mode will only take place if the entry function, device identifier and CRC are present and correct.
This function is used by Brick Viewer during flashing. It should not be necessary to call it in a normal user program.
The following symbols are available for this function:
For <mode>:
For status:
imu-v3-bricklet
<uid> get-bootloader-mode
¶Output: |
|
---|
Returns the current bootloader mode, see set-bootloader-mode
.
The following symbols are available for this function:
For mode:
imu-v3-bricklet
<uid> set-write-firmware-pointer
<pointer>¶Parameters: |
|
---|---|
Output: |
|
Sets the firmware pointer for write-firmware
. The pointer has
to be increased by chunks of size 64. The data is written to flash
every 4 chunks (which equals to one page of size 256).
This function is used by Brick Viewer during flashing. It should not be necessary to call it in a normal user program.
imu-v3-bricklet
<uid> write-firmware
<data>¶Parameters: |
|
---|---|
Output: |
|
Writes 64 Bytes of firmware at the position as written by
set-write-firmware-pointer
before. The firmware is written
to flash every 4 chunks.
You can only write firmware in bootloader mode.
This function is used by Brick Viewer during flashing. It should not be necessary to call it in a normal user program.
imu-v3-bricklet
<uid> write-uid
<uid>¶Parameters: |
|
---|---|
Output: |
|
Writes a new UID into flash. If you want to set a new UID you have to decode the Base58 encoded UID string into an integer first.
We recommend that you use Brick Viewer to change the UID.
imu-v3-bricklet
<uid> read-uid
¶Output: |
|
---|
Returns the current UID as an integer. Encode as Base58 to get the usual string version.