public class BrickIMU extends Device
Modifier and Type | Class and Description |
---|---|
class |
BrickIMU.Acceleration |
static interface |
BrickIMU.AccelerationListener
This listener is triggered periodically with the period that is set by
setAccelerationPeriod(long) . |
class |
BrickIMU.AllData |
static interface |
BrickIMU.AllDataListener
This listener is triggered periodically with the period that is set by
setAllDataPeriod(long) . |
class |
BrickIMU.AngularVelocity |
static interface |
BrickIMU.AngularVelocityListener
This listener is triggered periodically with the period that is set by
setAngularVelocityPeriod(long) . |
class |
BrickIMU.MagneticField |
static interface |
BrickIMU.MagneticFieldListener
This listener is triggered periodically with the period that is set by
setMagneticFieldPeriod(long) . |
class |
BrickIMU.Orientation |
static interface |
BrickIMU.OrientationListener
This listener is triggered periodically with the period that is set by
setOrientationPeriod(long) . |
class |
BrickIMU.Protocol1BrickletName |
class |
BrickIMU.Quaternion |
static interface |
BrickIMU.QuaternionListener
This listener is triggered periodically with the period that is set by
setQuaternionPeriod(long) . |
class |
BrickIMU.SPITFPBaudrateConfig |
class |
BrickIMU.SPITFPErrorCount |
Device.Identity
Constructor and Description |
---|
BrickIMU(java.lang.String uid,
IPConnection ipcon)
Creates an object with the unique device ID \c uid.
|
Modifier and Type | Method and Description |
---|---|
void |
addAccelerationListener(BrickIMU.AccelerationListener listener)
Adds a Acceleration listener.
|
void |
addAllDataListener(BrickIMU.AllDataListener listener)
Adds a AllData listener.
|
void |
addAngularVelocityListener(BrickIMU.AngularVelocityListener listener)
Adds a AngularVelocity listener.
|
void |
addMagneticFieldListener(BrickIMU.MagneticFieldListener listener)
Adds a MagneticField listener.
|
void |
addOrientationListener(BrickIMU.OrientationListener listener)
Adds a Orientation listener.
|
void |
addQuaternionListener(BrickIMU.QuaternionListener listener)
Adds a Quaternion listener.
|
boolean |
areLedsOn()
Returns *true* if the orientation and direction LEDs of the IMU Brick
are on, *false* otherwise.
|
void |
disableStatusLED()
Disables the status LED.
|
void |
enableStatusLED()
Enables the status LED.
|
BrickIMU.Acceleration |
getAcceleration()
Returns the calibrated acceleration from the accelerometer for the
x, y and z axis.
|
long |
getAccelerationPeriod()
Returns the period as set by
setAccelerationPeriod(long) . |
short |
getAccelerationRange()
Not implemented yet.
|
BrickIMU.AllData |
getAllData()
Returns the data from
getAcceleration() , getMagneticField()
and getAngularVelocity() as well as the temperature of the IMU Brick. |
long |
getAllDataPeriod()
Returns the period as set by
setAllDataPeriod(long) . |
BrickIMU.AngularVelocity |
getAngularVelocity()
Returns the calibrated angular velocity from the gyroscope for the
x, y and z axis in °/14.375s (you have to divide by 14.375 to
get the value in °/s).
|
long |
getAngularVelocityPeriod()
Returns the period as set by
setAngularVelocityPeriod(long) . |
short[] |
getCalibration(short typ)
Returns the calibration for a given type as set by
setCalibration(short, short[]) . |
short |
getChipTemperature()
Returns the temperature as measured inside the microcontroller.
|
int |
getConvergenceSpeed()
Returns the convergence speed as set by
setConvergenceSpeed(int) . |
Device.Identity |
getIdentity()
Returns the UID, the UID where the Brick is connected to,
the position, the hardware and firmware version as well as the
device identifier.
|
short |
getIMUTemperature()
Returns the temperature of the IMU Brick.
|
BrickIMU.MagneticField |
getMagneticField()
Returns the calibrated magnetic field from the magnetometer for the
x, y and z axis.
|
long |
getMagneticFieldPeriod()
Returns the period as set by
setMagneticFieldPeriod(long) . |
short |
getMagnetometerRange()
Not implemented yet.
|
BrickIMU.Orientation |
getOrientation()
Returns the current orientation (roll, pitch, yaw) of the IMU Brick as Euler
angles.
|
long |
getOrientationPeriod()
Returns the period as set by
setOrientationPeriod(long) . |
BrickIMU.Protocol1BrickletName |
getProtocol1BrickletName(char port)
Returns the firmware and protocol version and the name of the Bricklet for a
given port.
|
BrickIMU.Quaternion |
getQuaternion()
Returns the current orientation (x, y, z, w) of the IMU as
`quaternions <https://en.wikipedia.org/wiki/Quaternions_and_spatial_rotation>`__.
|
long |
getQuaternionPeriod()
Returns the period as set by
setQuaternionPeriod(long) . |
long |
getSendTimeoutCount(short communicationMethod)
Returns the timeout count for the different communication methods.
|
long |
getSPITFPBaudrate(char brickletPort)
Returns the baudrate for a given Bricklet port, see
setSPITFPBaudrate(char, long) . |
BrickIMU.SPITFPBaudrateConfig |
getSPITFPBaudrateConfig()
Returns the baudrate config, see
setSPITFPBaudrateConfig(boolean, long) . |
BrickIMU.SPITFPErrorCount |
getSPITFPErrorCount(char brickletPort)
Returns the error count for the communication between Brick and Bricklet.
|
boolean |
isOrientationCalculationOn()
Returns *true* if the orientation calculation of the IMU Brick
is on, *false* otherwise.
|
boolean |
isStatusLEDEnabled()
Returns *true* if the status LED is enabled, *false* otherwise.
|
void |
ledsOff()
Turns the orientation and direction LEDs of the IMU Brick off.
|
void |
ledsOn()
Turns the orientation and direction LEDs of the IMU Brick on.
|
void |
orientationCalculationOff()
Turns the orientation calculation of the IMU Brick off.
|
void |
orientationCalculationOn()
Turns the orientation calculation of the IMU Brick on.
|
short[] |
readBrickletPlugin(char port,
short offset)
Reads 32 bytes of firmware from the bricklet attached at the given port.
|
void |
removeAccelerationListener(BrickIMU.AccelerationListener listener)
Removes a Acceleration listener.
|
void |
removeAllDataListener(BrickIMU.AllDataListener listener)
Removes a AllData listener.
|
void |
removeAngularVelocityListener(BrickIMU.AngularVelocityListener listener)
Removes a AngularVelocity listener.
|
void |
removeMagneticFieldListener(BrickIMU.MagneticFieldListener listener)
Removes a MagneticField listener.
|
void |
removeOrientationListener(BrickIMU.OrientationListener listener)
Removes a Orientation listener.
|
void |
removeQuaternionListener(BrickIMU.QuaternionListener listener)
Removes a Quaternion listener.
|
void |
reset()
Calling this function will reset the Brick.
|
void |
setAccelerationPeriod(long period)
Sets the period with which the
BrickIMU.AccelerationListener listener is triggered
periodically. |
void |
setAccelerationRange(short range)
Not implemented yet.
|
void |
setAllDataPeriod(long period)
Sets the period with which the
BrickIMU.AllDataListener listener is triggered
periodically. |
void |
setAngularVelocityPeriod(long period)
Sets the period with which the
BrickIMU.AngularVelocityListener listener is
triggered periodically. |
void |
setCalibration(short typ,
short[] data)
There are several different types that can be calibrated:
\verbatim
"Type", "Description", "Values"
"0", "Accelerometer Gain", "``[mul x, mul y, mul z, div x, div y, div z, 0, 0, 0, 0]``"
"1", "Accelerometer Bias", "``[bias x, bias y, bias z, 0, 0, 0, 0, 0, 0, 0]``"
"2", "Magnetometer Gain", "``[mul x, mul y, mul z, div x, div y, div z, 0, 0, 0, 0]``"
"3", "Magnetometer Bias", "``[bias x, bias y, bias z, 0, 0, 0, 0, 0, 0, 0]``"
"4", "Gyroscope Gain", "``[mul x, mul y, mul z, div x, div y, div z, 0, 0, 0, 0]``"
"5", "Gyroscope Bias", "``[bias xl, bias yl, bias zl, temp l, bias xh, bias yh, bias zh, temp h, 0, 0]``"
\endverbatim
The calibration via gain and bias is done with the following formula::
new_value = (bias + orig_value) * gain_mul / gain_div
If you really want to write your own calibration software, please keep
in mind that you first have to undo the old calibration (set bias to 0 and
gain to 1/1) and that you have to average over several thousand values
to obtain a usable result in the end.
|
void |
setConvergenceSpeed(int speed)
Sets the convergence speed of the IMU Brick.
|
void |
setMagneticFieldPeriod(long period)
Sets the period with which the
BrickIMU.MagneticFieldListener listener is
triggered periodically. |
void |
setMagnetometerRange(short range)
Not implemented yet.
|
void |
setOrientationPeriod(long period)
Sets the period with which the
BrickIMU.OrientationListener listener is triggered
periodically. |
void |
setQuaternionPeriod(long period)
Sets the period with which the
BrickIMU.QuaternionListener listener is triggered
periodically. |
void |
setSPITFPBaudrate(char brickletPort,
long baudrate)
Sets the baudrate for a specific Bricklet port.
|
void |
setSPITFPBaudrateConfig(boolean enableDynamicBaudrate,
long minimumDynamicBaudrate)
The SPITF protocol can be used with a dynamic baudrate.
|
void |
writeBrickletPlugin(char port,
short offset,
short[] chunk)
Writes 32 bytes of firmware to the bricklet attached at the given port.
|
getAPIVersion, getResponseExpected, setResponseExpected, setResponseExpectedAll
public static final int DEVICE_IDENTIFIER
public static final java.lang.String DEVICE_DISPLAY_NAME
public static final byte FUNCTION_GET_ACCELERATION
public static final byte FUNCTION_GET_MAGNETIC_FIELD
public static final byte FUNCTION_GET_ANGULAR_VELOCITY
public static final byte FUNCTION_GET_ALL_DATA
public static final byte FUNCTION_GET_ORIENTATION
public static final byte FUNCTION_GET_QUATERNION
public static final byte FUNCTION_GET_IMU_TEMPERATURE
public static final byte FUNCTION_LEDS_ON
public static final byte FUNCTION_LEDS_OFF
public static final byte FUNCTION_ARE_LEDS_ON
public static final byte FUNCTION_SET_ACCELERATION_RANGE
public static final byte FUNCTION_GET_ACCELERATION_RANGE
public static final byte FUNCTION_SET_MAGNETOMETER_RANGE
public static final byte FUNCTION_GET_MAGNETOMETER_RANGE
public static final byte FUNCTION_SET_CONVERGENCE_SPEED
public static final byte FUNCTION_GET_CONVERGENCE_SPEED
public static final byte FUNCTION_SET_CALIBRATION
public static final byte FUNCTION_GET_CALIBRATION
public static final byte FUNCTION_SET_ACCELERATION_PERIOD
public static final byte FUNCTION_GET_ACCELERATION_PERIOD
public static final byte FUNCTION_SET_MAGNETIC_FIELD_PERIOD
public static final byte FUNCTION_GET_MAGNETIC_FIELD_PERIOD
public static final byte FUNCTION_SET_ANGULAR_VELOCITY_PERIOD
public static final byte FUNCTION_GET_ANGULAR_VELOCITY_PERIOD
public static final byte FUNCTION_SET_ALL_DATA_PERIOD
public static final byte FUNCTION_GET_ALL_DATA_PERIOD
public static final byte FUNCTION_SET_ORIENTATION_PERIOD
public static final byte FUNCTION_GET_ORIENTATION_PERIOD
public static final byte FUNCTION_SET_QUATERNION_PERIOD
public static final byte FUNCTION_GET_QUATERNION_PERIOD
public static final byte FUNCTION_ORIENTATION_CALCULATION_ON
public static final byte FUNCTION_ORIENTATION_CALCULATION_OFF
public static final byte FUNCTION_IS_ORIENTATION_CALCULATION_ON
public static final byte FUNCTION_SET_SPITFP_BAUDRATE_CONFIG
public static final byte FUNCTION_GET_SPITFP_BAUDRATE_CONFIG
public static final byte FUNCTION_GET_SEND_TIMEOUT_COUNT
public static final byte FUNCTION_SET_SPITFP_BAUDRATE
public static final byte FUNCTION_GET_SPITFP_BAUDRATE
public static final byte FUNCTION_GET_SPITFP_ERROR_COUNT
public static final byte FUNCTION_ENABLE_STATUS_LED
public static final byte FUNCTION_DISABLE_STATUS_LED
public static final byte FUNCTION_IS_STATUS_LED_ENABLED
public static final byte FUNCTION_GET_PROTOCOL1_BRICKLET_NAME
public static final byte FUNCTION_GET_CHIP_TEMPERATURE
public static final byte FUNCTION_RESET
public static final byte FUNCTION_WRITE_BRICKLET_PLUGIN
public static final byte FUNCTION_READ_BRICKLET_PLUGIN
public static final byte FUNCTION_GET_IDENTITY
public static final short CALIBRATION_TYPE_ACCELEROMETER_GAIN
public static final short CALIBRATION_TYPE_ACCELEROMETER_BIAS
public static final short CALIBRATION_TYPE_MAGNETOMETER_GAIN
public static final short CALIBRATION_TYPE_MAGNETOMETER_BIAS
public static final short CALIBRATION_TYPE_GYROSCOPE_GAIN
public static final short CALIBRATION_TYPE_GYROSCOPE_BIAS
public static final short COMMUNICATION_METHOD_NONE
public static final short COMMUNICATION_METHOD_USB
public static final short COMMUNICATION_METHOD_SPI_STACK
public static final short COMMUNICATION_METHOD_CHIBI
public static final short COMMUNICATION_METHOD_RS485
public static final short COMMUNICATION_METHOD_WIFI
public static final short COMMUNICATION_METHOD_ETHERNET
public static final short COMMUNICATION_METHOD_WIFI_V2
public BrickIMU(java.lang.String uid, IPConnection ipcon)
public BrickIMU.Acceleration getAcceleration() throws TinkerforgeException
BrickIMU.AccelerationListener
listener and set the period with
setAccelerationPeriod(long)
.TinkerforgeException
public BrickIMU.MagneticField getMagneticField() throws TinkerforgeException
BrickIMU.MagneticFieldListener
listener and set the period with
setMagneticFieldPeriod(long)
.TinkerforgeException
public BrickIMU.AngularVelocity getAngularVelocity() throws TinkerforgeException
BrickIMU.AngularVelocityListener
listener and set the period with
setAngularVelocityPeriod(long)
.TinkerforgeException
public BrickIMU.AllData getAllData() throws TinkerforgeException
getAcceleration()
, getMagneticField()
and getAngularVelocity()
as well as the temperature of the IMU Brick.
If you want to get the data periodically, it is recommended
to use the BrickIMU.AllDataListener
listener and set the period with
setAllDataPeriod(long)
.TinkerforgeException
public BrickIMU.Orientation getOrientation() throws TinkerforgeException
BrickIMU.OrientationListener
listener and set the period with
setOrientationPeriod(long)
.TinkerforgeException
public BrickIMU.Quaternion getQuaternion() throws TinkerforgeException
BrickIMU.QuaternionListener
listener and set the period with
setQuaternionPeriod(long)
.TinkerforgeException
public short getIMUTemperature() throws TinkerforgeException
TinkerforgeException
public void ledsOn() throws TinkerforgeException
TinkerforgeException
public void ledsOff() throws TinkerforgeException
TinkerforgeException
public boolean areLedsOn() throws TinkerforgeException
TinkerforgeException
public void setAccelerationRange(short range) throws TinkerforgeException
TinkerforgeException
public short getAccelerationRange() throws TinkerforgeException
TinkerforgeException
public void setMagnetometerRange(short range) throws TinkerforgeException
TinkerforgeException
public short getMagnetometerRange() throws TinkerforgeException
TinkerforgeException
public void setConvergenceSpeed(int speed) throws TinkerforgeException
TinkerforgeException
public int getConvergenceSpeed() throws TinkerforgeException
setConvergenceSpeed(int)
.TinkerforgeException
public void setCalibration(short typ, short[] data) throws TinkerforgeException
TinkerforgeException
public short[] getCalibration(short typ) throws TinkerforgeException
setCalibration(short, short[])
.TinkerforgeException
public void setAccelerationPeriod(long period) throws TinkerforgeException
BrickIMU.AccelerationListener
listener is triggered
periodically. A value of 0 turns the listener off.TinkerforgeException
public long getAccelerationPeriod() throws TinkerforgeException
setAccelerationPeriod(long)
.TinkerforgeException
public void setMagneticFieldPeriod(long period) throws TinkerforgeException
BrickIMU.MagneticFieldListener
listener is
triggered periodically. A value of 0 turns the listener off.TinkerforgeException
public long getMagneticFieldPeriod() throws TinkerforgeException
setMagneticFieldPeriod(long)
.TinkerforgeException
public void setAngularVelocityPeriod(long period) throws TinkerforgeException
BrickIMU.AngularVelocityListener
listener is
triggered periodically. A value of 0 turns the listener off.TinkerforgeException
public long getAngularVelocityPeriod() throws TinkerforgeException
setAngularVelocityPeriod(long)
.TinkerforgeException
public void setAllDataPeriod(long period) throws TinkerforgeException
BrickIMU.AllDataListener
listener is triggered
periodically. A value of 0 turns the listener off.TinkerforgeException
public long getAllDataPeriod() throws TinkerforgeException
setAllDataPeriod(long)
.TinkerforgeException
public void setOrientationPeriod(long period) throws TinkerforgeException
BrickIMU.OrientationListener
listener is triggered
periodically. A value of 0 turns the listener off.TinkerforgeException
public long getOrientationPeriod() throws TinkerforgeException
setOrientationPeriod(long)
.TinkerforgeException
public void setQuaternionPeriod(long period) throws TinkerforgeException
BrickIMU.QuaternionListener
listener is triggered
periodically. A value of 0 turns the listener off.TinkerforgeException
public long getQuaternionPeriod() throws TinkerforgeException
setQuaternionPeriod(long)
.TinkerforgeException
public void orientationCalculationOn() throws TinkerforgeException
TinkerforgeException
public void orientationCalculationOff() throws TinkerforgeException
getOrientation()
will return
the last calculated value until the calculation is turned on again.
The trigonometric functions that are needed to calculate the orientation
are very expensive. We recommend to turn the orientation calculation
off if the orientation is not needed, to free calculation time for the
sensor fusion algorithm.
As default the calculation is on.
.. versionadded:: 2.0.2$nbsp;(Firmware)TinkerforgeException
public boolean isOrientationCalculationOn() throws TinkerforgeException
TinkerforgeException
public void setSPITFPBaudrateConfig(boolean enableDynamicBaudrate, long minimumDynamicBaudrate) throws TinkerforgeException
setSPITFPBaudrate(char, long)
. If the dynamic baudrate is disabled, the baudrate
as set by setSPITFPBaudrate(char, long)
will be used statically.
.. versionadded:: 2.3.5$nbsp;(Firmware)TinkerforgeException
public BrickIMU.SPITFPBaudrateConfig getSPITFPBaudrateConfig() throws TinkerforgeException
setSPITFPBaudrateConfig(boolean, long)
.
.. versionadded:: 2.3.5$nbsp;(Firmware)TinkerforgeException
public long getSendTimeoutCount(short communicationMethod) throws TinkerforgeException
TinkerforgeException
public void setSPITFPBaudrate(char brickletPort, long baudrate) throws TinkerforgeException
getSPITFPErrorCount(char)
) you can decrease the
baudrate.
If the dynamic baudrate feature is enabled, the baudrate set by this
function corresponds to the maximum baudrate (see setSPITFPBaudrateConfig(boolean, long)
).
Regulatory testing is done with the default baudrate. If CE compatibility
or similar is necessary in your applications we recommend to not change
the baudrate.
.. versionadded:: 2.3.3$nbsp;(Firmware)TinkerforgeException
public long getSPITFPBaudrate(char brickletPort) throws TinkerforgeException
setSPITFPBaudrate(char, long)
.
.. versionadded:: 2.3.3$nbsp;(Firmware)TinkerforgeException
public BrickIMU.SPITFPErrorCount getSPITFPErrorCount(char brickletPort) throws TinkerforgeException
TinkerforgeException
public void enableStatusLED() throws TinkerforgeException
TinkerforgeException
public void disableStatusLED() throws TinkerforgeException
TinkerforgeException
public boolean isStatusLEDEnabled() throws TinkerforgeException
TinkerforgeException
public BrickIMU.Protocol1BrickletName getProtocol1BrickletName(char port) throws TinkerforgeException
TinkerforgeException
public short getChipTemperature() throws TinkerforgeException
TinkerforgeException
public void reset() throws TinkerforgeException
TinkerforgeException
public void writeBrickletPlugin(char port, short offset, short[] chunk) throws TinkerforgeException
TinkerforgeException
public short[] readBrickletPlugin(char port, short offset) throws TinkerforgeException
TinkerforgeException
public Device.Identity getIdentity() throws TinkerforgeException
getIdentity
in class Device
TinkerforgeException
public void addAccelerationListener(BrickIMU.AccelerationListener listener)
public void removeAccelerationListener(BrickIMU.AccelerationListener listener)
public void addMagneticFieldListener(BrickIMU.MagneticFieldListener listener)
public void removeMagneticFieldListener(BrickIMU.MagneticFieldListener listener)
public void addAngularVelocityListener(BrickIMU.AngularVelocityListener listener)
public void removeAngularVelocityListener(BrickIMU.AngularVelocityListener listener)
public void addAllDataListener(BrickIMU.AllDataListener listener)
public void removeAllDataListener(BrickIMU.AllDataListener listener)
public void addOrientationListener(BrickIMU.OrientationListener listener)
public void removeOrientationListener(BrickIMU.OrientationListener listener)
public void addQuaternionListener(BrickIMU.QuaternionListener listener)
public void removeQuaternionListener(BrickIMU.QuaternionListener listener)
Copyright © 2021 Tinkerforge GmbH. All rights reserved.