Documentation ¶
Overview ¶
Full fledged AHRS with 9 degrees of freedom.
See also the documentation here: https://www.tinkerforge.com/en/doc/Software/Bricklets/IMUV3_Bricklet_Go.html.
Index ¶
- Constants
- type AccelerometerBandwidth
- type AccelerometerRange
- type BootloaderMode
- type BootloaderStatus
- type Function
- type GyroscopeBandwidth
- type GyroscopeRange
- type IMUV3Bricklet
- func (device *IMUV3Bricklet) DeregisterAccelerationCallback(registrationId uint64)
- func (device *IMUV3Bricklet) DeregisterAllDataCallback(registrationId uint64)
- func (device *IMUV3Bricklet) DeregisterAngularVelocityCallback(registrationId uint64)
- func (device *IMUV3Bricklet) DeregisterGravityVectorCallback(registrationId uint64)
- func (device *IMUV3Bricklet) DeregisterLinearAccelerationCallback(registrationId uint64)
- func (device *IMUV3Bricklet) DeregisterMagneticFieldCallback(registrationId uint64)
- func (device *IMUV3Bricklet) DeregisterOrientationCallback(registrationId uint64)
- func (device *IMUV3Bricklet) DeregisterQuaternionCallback(registrationId uint64)
- func (device *IMUV3Bricklet) DeregisterTemperatureCallback(registrationId uint64)
- func (device *IMUV3Bricklet) GetAPIVersion() [3]uint8
- func (device *IMUV3Bricklet) GetAcceleration() (x int16, y int16, z int16, err error)
- func (device *IMUV3Bricklet) GetAccelerationCallbackConfiguration() (period uint32, valueHasToChange bool, err error)
- func (device *IMUV3Bricklet) GetAllData() (acceleration [3]int16, magneticField [3]int16, angularVelocity [3]int16, ...)
- func (device *IMUV3Bricklet) GetAllDataCallbackConfiguration() (period uint32, valueHasToChange bool, err error)
- func (device *IMUV3Bricklet) GetAngularVelocity() (x int16, y int16, z int16, err error)
- func (device *IMUV3Bricklet) GetAngularVelocityCallbackConfiguration() (period uint32, valueHasToChange bool, err error)
- func (device *IMUV3Bricklet) GetBootloaderMode() (mode BootloaderMode, err error)
- func (device *IMUV3Bricklet) GetChipTemperature() (temperature int16, err error)
- func (device *IMUV3Bricklet) GetGravityVector() (x int16, y int16, z int16, err error)
- func (device *IMUV3Bricklet) GetGravityVectorCallbackConfiguration() (period uint32, valueHasToChange bool, err error)
- func (device *IMUV3Bricklet) GetIdentity() (uid string, connectedUid string, position rune, hardwareVersion [3]uint8, ...)
- func (device *IMUV3Bricklet) GetLinearAcceleration() (x int16, y int16, z int16, err error)
- func (device *IMUV3Bricklet) GetLinearAccelerationCallbackConfiguration() (period uint32, valueHasToChange bool, err error)
- func (device *IMUV3Bricklet) GetMagneticField() (x int16, y int16, z int16, err error)
- func (device *IMUV3Bricklet) GetMagneticFieldCallbackConfiguration() (period uint32, valueHasToChange bool, err error)
- func (device *IMUV3Bricklet) GetOrientation() (heading int16, roll int16, pitch int16, err error)
- func (device *IMUV3Bricklet) GetOrientationCallbackConfiguration() (period uint32, valueHasToChange bool, err error)
- func (device *IMUV3Bricklet) GetQuaternion() (w int16, x int16, y int16, z int16, err error)
- func (device *IMUV3Bricklet) GetQuaternionCallbackConfiguration() (period uint32, valueHasToChange bool, err error)
- func (device *IMUV3Bricklet) GetResponseExpected(functionID Function) (bool, error)
- func (device *IMUV3Bricklet) GetSPITFPErrorCount() (errorCountAckChecksum uint32, errorCountMessageChecksum uint32, ...)
- func (device *IMUV3Bricklet) GetSensorConfiguration() (magnetometerRate MagnetometerRate, gyroscopeRange GyroscopeRange, ...)
- func (device *IMUV3Bricklet) GetSensorFusionMode() (mode SensorFusion, err error)
- func (device *IMUV3Bricklet) GetStatusLEDConfig() (config StatusLEDConfig, err error)
- func (device *IMUV3Bricklet) GetTemperature() (temperature int8, err error)
- func (device *IMUV3Bricklet) GetTemperatureCallbackConfiguration() (period uint32, valueHasToChange bool, err error)
- func (device *IMUV3Bricklet) ReadUID() (uid uint32, err error)
- func (device *IMUV3Bricklet) RegisterAccelerationCallback(fn func(int16, int16, int16)) uint64
- func (device *IMUV3Bricklet) RegisterAllDataCallback(...) uint64
- func (device *IMUV3Bricklet) RegisterAngularVelocityCallback(fn func(int16, int16, int16)) uint64
- func (device *IMUV3Bricklet) RegisterGravityVectorCallback(fn func(int16, int16, int16)) uint64
- func (device *IMUV3Bricklet) RegisterLinearAccelerationCallback(fn func(int16, int16, int16)) uint64
- func (device *IMUV3Bricklet) RegisterMagneticFieldCallback(fn func(int16, int16, int16)) uint64
- func (device *IMUV3Bricklet) RegisterOrientationCallback(fn func(int16, int16, int16)) uint64
- func (device *IMUV3Bricklet) RegisterQuaternionCallback(fn func(int16, int16, int16, int16)) uint64
- func (device *IMUV3Bricklet) RegisterTemperatureCallback(fn func(int8)) uint64
- func (device *IMUV3Bricklet) Reset() (err error)
- func (device *IMUV3Bricklet) SaveCalibration() (calibrationDone bool, err error)
- func (device *IMUV3Bricklet) SetAccelerationCallbackConfiguration(period uint32, valueHasToChange bool) (err error)
- func (device *IMUV3Bricklet) SetAllDataCallbackConfiguration(period uint32, valueHasToChange bool) (err error)
- func (device *IMUV3Bricklet) SetAngularVelocityCallbackConfiguration(period uint32, valueHasToChange bool) (err error)
- func (device *IMUV3Bricklet) SetBootloaderMode(mode BootloaderMode) (status BootloaderStatus, err error)
- func (device *IMUV3Bricklet) SetGravityVectorCallbackConfiguration(period uint32, valueHasToChange bool) (err error)
- func (device *IMUV3Bricklet) SetLinearAccelerationCallbackConfiguration(period uint32, valueHasToChange bool) (err error)
- func (device *IMUV3Bricklet) SetMagneticFieldCallbackConfiguration(period uint32, valueHasToChange bool) (err error)
- func (device *IMUV3Bricklet) SetOrientationCallbackConfiguration(period uint32, valueHasToChange bool) (err error)
- func (device *IMUV3Bricklet) SetQuaternionCallbackConfiguration(period uint32, valueHasToChange bool) (err error)
- func (device *IMUV3Bricklet) SetResponseExpected(functionID Function, responseExpected bool) error
- func (device *IMUV3Bricklet) SetResponseExpectedAll(responseExpected bool)
- func (device *IMUV3Bricklet) SetSensorConfiguration(magnetometerRate MagnetometerRate, gyroscopeRange GyroscopeRange, ...) (err error)
- func (device *IMUV3Bricklet) SetSensorFusionMode(mode SensorFusion) (err error)
- func (device *IMUV3Bricklet) SetStatusLEDConfig(config StatusLEDConfig) (err error)
- func (device *IMUV3Bricklet) SetTemperatureCallbackConfiguration(period uint32, valueHasToChange bool) (err error)
- func (device *IMUV3Bricklet) SetWriteFirmwarePointer(pointer uint32) (err error)
- func (device *IMUV3Bricklet) WriteFirmware(data [64]uint8) (status uint8, err error)
- func (device *IMUV3Bricklet) WriteUID(uid uint32) (err error)
- type MagnetometerRate
- type SensorFusion
- type StatusLEDConfig
Constants ¶
const DeviceDisplayName = "IMU Bricklet 3.0"
const DeviceIdentifier = 2161
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AccelerometerBandwidth ¶
type AccelerometerBandwidth = uint8
const ( AccelerometerBandwidth7_81Hz AccelerometerBandwidth = 0 AccelerometerBandwidth15_63Hz AccelerometerBandwidth = 1 AccelerometerBandwidth31_25Hz AccelerometerBandwidth = 2 AccelerometerBandwidth62_5Hz AccelerometerBandwidth = 3 AccelerometerBandwidth125Hz AccelerometerBandwidth = 4 AccelerometerBandwidth250Hz AccelerometerBandwidth = 5 AccelerometerBandwidth500Hz AccelerometerBandwidth = 6 AccelerometerBandwidth1000Hz AccelerometerBandwidth = 7 )
type AccelerometerRange ¶
type AccelerometerRange = uint8
const ( AccelerometerRange2G AccelerometerRange = 0 AccelerometerRange4G AccelerometerRange = 1 AccelerometerRange8G AccelerometerRange = 2 AccelerometerRange16G AccelerometerRange = 3 )
type BootloaderMode ¶
type BootloaderMode = uint8
const ( BootloaderModeBootloader BootloaderMode = 0 BootloaderModeFirmware BootloaderMode = 1 BootloaderModeBootloaderWaitForReboot BootloaderMode = 2 BootloaderModeFirmwareWaitForReboot BootloaderMode = 3 BootloaderModeFirmwareWaitForEraseAndReboot BootloaderMode = 4 )
type BootloaderStatus ¶
type BootloaderStatus = uint8
const ( BootloaderStatusOK BootloaderStatus = 0 BootloaderStatusInvalidMode BootloaderStatus = 1 BootloaderStatusNoChange BootloaderStatus = 2 BootloaderStatusEntryFunctionNotPresent BootloaderStatus = 3 BootloaderStatusDeviceIdentifierIncorrect BootloaderStatus = 4 BootloaderStatusCRCMismatch BootloaderStatus = 5 )
type Function ¶
type Function = uint8
const ( FunctionGetAcceleration Function = 1 FunctionGetMagneticField Function = 2 FunctionGetAngularVelocity Function = 3 FunctionGetTemperature Function = 4 FunctionGetOrientation Function = 5 FunctionGetLinearAcceleration Function = 6 FunctionGetGravityVector Function = 7 FunctionGetQuaternion Function = 8 FunctionGetAllData Function = 9 FunctionSaveCalibration Function = 10 FunctionSetSensorConfiguration Function = 11 FunctionGetSensorConfiguration Function = 12 FunctionSetSensorFusionMode Function = 13 FunctionGetSensorFusionMode Function = 14 FunctionSetAccelerationCallbackConfiguration Function = 15 FunctionGetAccelerationCallbackConfiguration Function = 16 FunctionSetMagneticFieldCallbackConfiguration Function = 17 FunctionGetMagneticFieldCallbackConfiguration Function = 18 FunctionSetAngularVelocityCallbackConfiguration Function = 19 FunctionGetAngularVelocityCallbackConfiguration Function = 20 FunctionSetTemperatureCallbackConfiguration Function = 21 FunctionGetTemperatureCallbackConfiguration Function = 22 FunctionSetOrientationCallbackConfiguration Function = 23 FunctionGetOrientationCallbackConfiguration Function = 24 FunctionSetLinearAccelerationCallbackConfiguration Function = 25 FunctionGetLinearAccelerationCallbackConfiguration Function = 26 FunctionSetGravityVectorCallbackConfiguration Function = 27 FunctionGetGravityVectorCallbackConfiguration Function = 28 FunctionSetQuaternionCallbackConfiguration Function = 29 FunctionGetQuaternionCallbackConfiguration Function = 30 FunctionSetAllDataCallbackConfiguration Function = 31 FunctionGetAllDataCallbackConfiguration Function = 32 FunctionGetSPITFPErrorCount Function = 234 FunctionSetBootloaderMode Function = 235 FunctionGetBootloaderMode Function = 236 FunctionSetWriteFirmwarePointer Function = 237 FunctionWriteFirmware Function = 238 FunctionSetStatusLEDConfig Function = 239 FunctionGetStatusLEDConfig Function = 240 FunctionGetChipTemperature Function = 242 FunctionReset Function = 243 FunctionWriteUID Function = 248 FunctionReadUID Function = 249 FunctionGetIdentity Function = 255 FunctionCallbackAcceleration Function = 33 FunctionCallbackMagneticField Function = 34 FunctionCallbackAngularVelocity Function = 35 FunctionCallbackTemperature Function = 36 FunctionCallbackLinearAcceleration Function = 37 FunctionCallbackGravityVector Function = 38 FunctionCallbackOrientation Function = 39 FunctionCallbackQuaternion Function = 40 FunctionCallbackAllData Function = 41 )
type GyroscopeBandwidth ¶
type GyroscopeBandwidth = uint8
const ( GyroscopeBandwidth523Hz GyroscopeBandwidth = 0 GyroscopeBandwidth230Hz GyroscopeBandwidth = 1 GyroscopeBandwidth116Hz GyroscopeBandwidth = 2 GyroscopeBandwidth47Hz GyroscopeBandwidth = 3 GyroscopeBandwidth23Hz GyroscopeBandwidth = 4 GyroscopeBandwidth12Hz GyroscopeBandwidth = 5 GyroscopeBandwidth64Hz GyroscopeBandwidth = 6 GyroscopeBandwidth32Hz GyroscopeBandwidth = 7 )
type GyroscopeRange ¶
type GyroscopeRange = uint8
const ( GyroscopeRange2000DPS GyroscopeRange = 0 GyroscopeRange1000DPS GyroscopeRange = 1 GyroscopeRange500DPS GyroscopeRange = 2 GyroscopeRange250DPS GyroscopeRange = 3 GyroscopeRange125DPS GyroscopeRange = 4 )
type IMUV3Bricklet ¶
type IMUV3Bricklet struct {
// contains filtered or unexported fields
}
func New ¶
func New(uid string, ipcon *ipconnection.IPConnection) (IMUV3Bricklet, error)
Creates an object with the unique device ID `uid`. This object can then be used after the IP Connection `ipcon` is connected.
func (*IMUV3Bricklet) DeregisterAccelerationCallback ¶
func (device *IMUV3Bricklet) DeregisterAccelerationCallback(registrationId uint64)
Remove a registered Acceleration callback.
func (*IMUV3Bricklet) DeregisterAllDataCallback ¶
func (device *IMUV3Bricklet) DeregisterAllDataCallback(registrationId uint64)
Remove a registered All Data callback.
func (*IMUV3Bricklet) DeregisterAngularVelocityCallback ¶
func (device *IMUV3Bricklet) DeregisterAngularVelocityCallback(registrationId uint64)
Remove a registered Angular Velocity callback.
func (*IMUV3Bricklet) DeregisterGravityVectorCallback ¶
func (device *IMUV3Bricklet) DeregisterGravityVectorCallback(registrationId uint64)
Remove a registered Gravity Vector callback.
func (*IMUV3Bricklet) DeregisterLinearAccelerationCallback ¶
func (device *IMUV3Bricklet) DeregisterLinearAccelerationCallback(registrationId uint64)
Remove a registered Linear Acceleration callback.
func (*IMUV3Bricklet) DeregisterMagneticFieldCallback ¶
func (device *IMUV3Bricklet) DeregisterMagneticFieldCallback(registrationId uint64)
Remove a registered Magnetic Field callback.
func (*IMUV3Bricklet) DeregisterOrientationCallback ¶
func (device *IMUV3Bricklet) DeregisterOrientationCallback(registrationId uint64)
Remove a registered Orientation callback.
func (*IMUV3Bricklet) DeregisterQuaternionCallback ¶
func (device *IMUV3Bricklet) DeregisterQuaternionCallback(registrationId uint64)
Remove a registered Quaternion callback.
func (*IMUV3Bricklet) DeregisterTemperatureCallback ¶
func (device *IMUV3Bricklet) DeregisterTemperatureCallback(registrationId uint64)
Remove a registered Temperature callback.
func (*IMUV3Bricklet) GetAPIVersion ¶
func (device *IMUV3Bricklet) GetAPIVersion() [3]uint8
Returns the version of the API definition (major, minor, revision) implemented by this API bindings. This is neither the release version of this API bindings nor does it tell you anything about the represented Brick or Bricklet.
func (*IMUV3Bricklet) GetAcceleration ¶
func (device *IMUV3Bricklet) GetAcceleration() (x int16, y int16, z int16, err error)
Returns the calibrated acceleration from the accelerometer for the x, y and z axis. The acceleration is in the range configured with SetSensorConfiguration.
If you want to get the acceleration periodically, it is recommended to use the RegisterAccelerationCallback callback and set the period with SetAccelerationCallbackConfiguration.
func (*IMUV3Bricklet) GetAccelerationCallbackConfiguration ¶
func (device *IMUV3Bricklet) GetAccelerationCallbackConfiguration() (period uint32, valueHasToChange bool, err error)
Returns the callback configuration as set by SetAccelerationCallbackConfiguration.
func (*IMUV3Bricklet) GetAllData ¶
func (device *IMUV3Bricklet) GetAllData() (acceleration [3]int16, magneticField [3]int16, angularVelocity [3]int16, eulerAngle [3]int16, quaternion [4]int16, linearAcceleration [3]int16, gravityVector [3]int16, temperature int8, calibrationStatus uint8, err error)
Return all of the available data of the IMU Brick.
* acceleration (see GetAcceleration) * magnetic field (see GetMagneticField) * angular velocity (see GetAngularVelocity) * Euler angles (see GetOrientation) * quaternion (see GetQuaternion) * linear acceleration (see GetLinearAcceleration) * gravity vector (see GetGravityVector) * temperature (see GetTemperature) * 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 RegisterAllDataCallback callback and set the period with SetAllDataCallbackConfiguration.
func (*IMUV3Bricklet) GetAllDataCallbackConfiguration ¶
func (device *IMUV3Bricklet) GetAllDataCallbackConfiguration() (period uint32, valueHasToChange bool, err error)
Returns the callback configuration as set by SetAllDataCallbackConfiguration.
func (*IMUV3Bricklet) GetAngularVelocity ¶
func (device *IMUV3Bricklet) GetAngularVelocity() (x int16, y int16, z int16, err error)
Returns the calibrated angular velocity from the gyroscope for the x, y and z axis. The angular velocity is in the range configured with SetSensorConfiguration.
If you want to get the angular velocity periodically, it is recommended to use the RegisterAngularVelocityCallback acallback nd set the period with SetAngularVelocityCallbackConfiguration.
func (*IMUV3Bricklet) GetAngularVelocityCallbackConfiguration ¶
func (device *IMUV3Bricklet) GetAngularVelocityCallbackConfiguration() (period uint32, valueHasToChange bool, err error)
Returns the callback configuration as set by SetAngularVelocityCallbackConfiguration.
func (*IMUV3Bricklet) GetBootloaderMode ¶
func (device *IMUV3Bricklet) GetBootloaderMode() (mode BootloaderMode, err error)
Returns the current bootloader mode, see SetBootloaderMode.
Associated constants:
- BootloaderModeBootloader
- BootloaderModeFirmware
- BootloaderModeBootloaderWaitForReboot
- BootloaderModeFirmwareWaitForReboot
- BootloaderModeFirmwareWaitForEraseAndReboot
func (*IMUV3Bricklet) GetChipTemperature ¶
func (device *IMUV3Bricklet) GetChipTemperature() (temperature int16, err error)
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.
func (*IMUV3Bricklet) GetGravityVector ¶
func (device *IMUV3Bricklet) GetGravityVector() (x int16, y int16, z int16, err error)
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 GetLinearAcceleration.
If you want to get the gravity vector periodically, it is recommended to use the RegisterGravityVectorCallback callback and set the period with SetGravityVectorCallbackConfiguration.
func (*IMUV3Bricklet) GetGravityVectorCallbackConfiguration ¶
func (device *IMUV3Bricklet) GetGravityVectorCallbackConfiguration() (period uint32, valueHasToChange bool, err error)
Returns the callback configuration as set by SetGravityVectorCallbackConfiguration.
func (*IMUV3Bricklet) GetIdentity ¶
func (device *IMUV3Bricklet) GetIdentity() (uid string, connectedUid string, position rune, hardwareVersion [3]uint8, firmwareVersion [3]uint8, deviceIdentifier uint16, err error)
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 <isolator_bricklet>` is always at position 'z'.
The device identifier numbers can be found `here <device_identifier>`. |device_identifier_constant|
func (*IMUV3Bricklet) GetLinearAcceleration ¶
func (device *IMUV3Bricklet) GetLinearAcceleration() (x int16, y int16, z int16, err error)
Returns the linear acceleration of the IMU Brick for the x, y and z axis. The acceleration is in the range configured with SetSensorConfiguration.
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 GetGravityVector.
If you want to get the linear acceleration periodically, it is recommended to use the RegisterLinearAccelerationCallback callback and set the period with SetLinearAccelerationCallbackConfiguration.
func (*IMUV3Bricklet) GetLinearAccelerationCallbackConfiguration ¶
func (device *IMUV3Bricklet) GetLinearAccelerationCallbackConfiguration() (period uint32, valueHasToChange bool, err error)
Returns the callback configuration as set by SetLinearAccelerationCallbackConfiguration.
func (*IMUV3Bricklet) GetMagneticField ¶
func (device *IMUV3Bricklet) GetMagneticField() (x int16, y int16, z int16, err error)
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 RegisterMagneticFieldCallback callback and set the period with SetMagneticFieldCallbackConfiguration.
func (*IMUV3Bricklet) GetMagneticFieldCallbackConfiguration ¶
func (device *IMUV3Bricklet) GetMagneticFieldCallbackConfiguration() (period uint32, valueHasToChange bool, err error)
Returns the callback configuration as set by SetMagneticFieldCallbackConfiguration.
func (*IMUV3Bricklet) GetOrientation ¶
func (device *IMUV3Bricklet) GetOrientation() (heading int16, roll int16, pitch int16, err error)
Returns the current orientation (heading, roll, pitch) of the IMU Brick as independent Euler angles. Note that Euler angles always experience a https://en.wikipedia.org/wiki/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 RegisterOrientationCallback callback and set the period with SetOrientationCallbackConfiguration.
func (*IMUV3Bricklet) GetOrientationCallbackConfiguration ¶
func (device *IMUV3Bricklet) GetOrientationCallbackConfiguration() (period uint32, valueHasToChange bool, err error)
Returns the callback configuration as set by SetOrientationCallbackConfiguration.
func (*IMUV3Bricklet) GetQuaternion ¶
Returns the current orientation (w, x, y, z) of the IMU Brick as https://en.wikipedia.org/wiki/Quaternions_and_spatial_rotation.
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 RegisterQuaternionCallback callback and set the period with SetQuaternionCallbackConfiguration.
func (*IMUV3Bricklet) GetQuaternionCallbackConfiguration ¶
func (device *IMUV3Bricklet) GetQuaternionCallbackConfiguration() (period uint32, valueHasToChange bool, err error)
Returns the callback configuration as set by SetQuaternionCallbackConfiguration.
func (*IMUV3Bricklet) GetResponseExpected ¶
func (device *IMUV3Bricklet) GetResponseExpected(functionID Function) (bool, error)
Returns the response expected flag for the function specified by the function ID parameter. It is true if the function is expected to send a response, false otherwise.
For getter functions this is enabled by default and cannot be disabled, because those functions will always send a response. For callback configuration functions it is enabled by default too, but can be disabled by SetResponseExpected. For setter functions it is disabled by default and can be enabled.
Enabling the response expected flag for a setter function allows to detect timeouts and other error conditions calls of this setter as well. The device will then send a response for this purpose. If this flag is disabled for a setter function then no response is sent and errors are silently ignored, because they cannot be detected.
See SetResponseExpected for the list of function ID constants available for this function.
func (*IMUV3Bricklet) GetSPITFPErrorCount ¶
func (device *IMUV3Bricklet) GetSPITFPErrorCount() (errorCountAckChecksum uint32, errorCountMessageChecksum uint32, errorCountFrame uint32, errorCountOverflow uint32, err error)
Returns the error count for the communication between Brick and Bricklet.
The errors are divided into ¶
* ACK checksum errors, * message checksum errors, * framing errors and * overflow errors.
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.
func (*IMUV3Bricklet) GetSensorConfiguration ¶
func (device *IMUV3Bricklet) GetSensorConfiguration() (magnetometerRate MagnetometerRate, gyroscopeRange GyroscopeRange, gyroscopeBandwidth GyroscopeBandwidth, accelerometerRange AccelerometerRange, accelerometerBandwidth AccelerometerBandwidth, err error)
Returns the sensor configuration as set by SetSensorConfiguration.
Associated constants:
- MagnetometerRate2Hz
- MagnetometerRate6Hz
- MagnetometerRate8Hz
- MagnetometerRate10Hz
- MagnetometerRate15Hz
- MagnetometerRate20Hz
- MagnetometerRate25Hz
- MagnetometerRate30Hz
- GyroscopeRange2000DPS
- GyroscopeRange1000DPS
- GyroscopeRange500DPS
- GyroscopeRange250DPS
- GyroscopeRange125DPS
- GyroscopeBandwidth523Hz
- GyroscopeBandwidth230Hz
- GyroscopeBandwidth116Hz
- GyroscopeBandwidth47Hz
- GyroscopeBandwidth23Hz
- GyroscopeBandwidth12Hz
- GyroscopeBandwidth64Hz
- GyroscopeBandwidth32Hz
- AccelerometerRange2G
- AccelerometerRange4G
- AccelerometerRange8G
- AccelerometerRange16G
- AccelerometerBandwidth781Hz
- AccelerometerBandwidth1563Hz
- AccelerometerBandwidth3125Hz
- AccelerometerBandwidth625Hz
- AccelerometerBandwidth125Hz
- AccelerometerBandwidth250Hz
- AccelerometerBandwidth500Hz
- AccelerometerBandwidth1000Hz
func (*IMUV3Bricklet) GetSensorFusionMode ¶
func (device *IMUV3Bricklet) GetSensorFusionMode() (mode SensorFusion, err error)
Returns the sensor fusion mode as set by SetSensorFusionMode.
Associated constants:
- SensorFusionOff
- SensorFusionOn
- SensorFusionOnWithoutMagnetometer
- SensorFusionOnWithoutFastMagnetometerCalibration
func (*IMUV3Bricklet) GetStatusLEDConfig ¶
func (device *IMUV3Bricklet) GetStatusLEDConfig() (config StatusLEDConfig, err error)
Returns the configuration as set by SetStatusLEDConfig
Associated constants:
- StatusLEDConfigOff
- StatusLEDConfigOn
- StatusLEDConfigShowHeartbeat
- StatusLEDConfigShowStatus
func (*IMUV3Bricklet) GetTemperature ¶
func (device *IMUV3Bricklet) GetTemperature() (temperature int8, err error)
Returns the temperature of the IMU Brick. The temperature is measured in the core of the BNO055 IC, it is not the ambient temperature
func (*IMUV3Bricklet) GetTemperatureCallbackConfiguration ¶
func (device *IMUV3Bricklet) GetTemperatureCallbackConfiguration() (period uint32, valueHasToChange bool, err error)
Returns the callback configuration as set by SetTemperatureCallbackConfiguration.
func (*IMUV3Bricklet) ReadUID ¶
func (device *IMUV3Bricklet) ReadUID() (uid uint32, err error)
Returns the current UID as an integer. Encode as Base58 to get the usual string version.
func (*IMUV3Bricklet) RegisterAccelerationCallback ¶
func (device *IMUV3Bricklet) RegisterAccelerationCallback(fn func(int16, int16, int16)) uint64
This callback is triggered periodically with the period that is set by SetAccelerationCallbackConfiguration. The parameters are the acceleration for the x, y and z axis.
func (*IMUV3Bricklet) RegisterAllDataCallback ¶
func (device *IMUV3Bricklet) RegisterAllDataCallback(fn func([3]int16, [3]int16, [3]int16, [3]int16, [4]int16, [3]int16, [3]int16, int8, uint8)) uint64
This callback is triggered periodically with the period that is set by SetAllDataCallbackConfiguration. The parameters are as for GetAllData.
func (*IMUV3Bricklet) RegisterAngularVelocityCallback ¶
func (device *IMUV3Bricklet) RegisterAngularVelocityCallback(fn func(int16, int16, int16)) uint64
This callback is triggered periodically with the period that is set by SetAngularVelocityCallbackConfiguration. The parameters are the angular velocity for the x, y and z axis.
func (*IMUV3Bricklet) RegisterGravityVectorCallback ¶
func (device *IMUV3Bricklet) RegisterGravityVectorCallback(fn func(int16, int16, int16)) uint64
This callback is triggered periodically with the period that is set by SetGravityVectorCallbackConfiguration. The parameters gravity vector for the x, y and z axis.
func (*IMUV3Bricklet) RegisterLinearAccelerationCallback ¶
func (device *IMUV3Bricklet) RegisterLinearAccelerationCallback(fn func(int16, int16, int16)) uint64
This callback is triggered periodically with the period that is set by SetLinearAccelerationCallbackConfiguration. The parameters are the linear acceleration for the x, y and z axis.
func (*IMUV3Bricklet) RegisterMagneticFieldCallback ¶
func (device *IMUV3Bricklet) RegisterMagneticFieldCallback(fn func(int16, int16, int16)) uint64
This callback is triggered periodically with the period that is set by SetMagneticFieldCallbackConfiguration. The parameters are the magnetic field for the x, y and z axis.
func (*IMUV3Bricklet) RegisterOrientationCallback ¶
func (device *IMUV3Bricklet) RegisterOrientationCallback(fn func(int16, int16, int16)) uint64
This callback is triggered periodically with the period that is set by SetOrientationCallbackConfiguration. The parameters are the orientation (heading (yaw), roll, pitch) of the IMU Brick in Euler angles. See GetOrientation for details.
func (*IMUV3Bricklet) RegisterQuaternionCallback ¶
This callback is triggered periodically with the period that is set by SetQuaternionCallbackConfiguration. The parameters are the orientation (w, x, y, z) of the IMU Brick in quaternions. See GetQuaternion for details.
func (*IMUV3Bricklet) RegisterTemperatureCallback ¶
func (device *IMUV3Bricklet) RegisterTemperatureCallback(fn func(int8)) uint64
This callback is triggered periodically with the period that is set by SetTemperatureCallbackConfiguration. The parameter is the temperature.
func (*IMUV3Bricklet) Reset ¶
func (device *IMUV3Bricklet) Reset() (err error)
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!
func (*IMUV3Bricklet) SaveCalibration ¶
func (device *IMUV3Bricklet) SaveCalibration() (calibrationDone bool, err error)
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.
func (*IMUV3Bricklet) SetAccelerationCallbackConfiguration ¶
func (device *IMUV3Bricklet) SetAccelerationCallbackConfiguration(period uint32, valueHasToChange bool) (err error)
The period is the period with which the RegisterAccelerationCallback 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.
func (*IMUV3Bricklet) SetAllDataCallbackConfiguration ¶
func (device *IMUV3Bricklet) SetAllDataCallbackConfiguration(period uint32, valueHasToChange bool) (err error)
The period is the period with which the RegisterAllDataCallback 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.
func (*IMUV3Bricklet) SetAngularVelocityCallbackConfiguration ¶
func (device *IMUV3Bricklet) SetAngularVelocityCallbackConfiguration(period uint32, valueHasToChange bool) (err error)
The period is the period with which the RegisterAngularVelocityCallback 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.
func (*IMUV3Bricklet) SetBootloaderMode ¶
func (device *IMUV3Bricklet) SetBootloaderMode(mode BootloaderMode) (status BootloaderStatus, err error)
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.
Associated constants:
- BootloaderModeBootloader
- BootloaderModeFirmware
- BootloaderModeBootloaderWaitForReboot
- BootloaderModeFirmwareWaitForReboot
- BootloaderModeFirmwareWaitForEraseAndReboot
- BootloaderStatusOK
- BootloaderStatusInvalidMode
- BootloaderStatusNoChange
- BootloaderStatusEntryFunctionNotPresent
- BootloaderStatusDeviceIdentifierIncorrect
- BootloaderStatusCRCMismatch
func (*IMUV3Bricklet) SetGravityVectorCallbackConfiguration ¶
func (device *IMUV3Bricklet) SetGravityVectorCallbackConfiguration(period uint32, valueHasToChange bool) (err error)
The period is the period with which the RegisterGravityVectorCallback 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.
func (*IMUV3Bricklet) SetLinearAccelerationCallbackConfiguration ¶
func (device *IMUV3Bricklet) SetLinearAccelerationCallbackConfiguration(period uint32, valueHasToChange bool) (err error)
The period is the period with which the RegisterLinearAccelerationCallback 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.
func (*IMUV3Bricklet) SetMagneticFieldCallbackConfiguration ¶
func (device *IMUV3Bricklet) SetMagneticFieldCallbackConfiguration(period uint32, valueHasToChange bool) (err error)
The period is the period with which the RegisterMagneticFieldCallback 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.
func (*IMUV3Bricklet) SetOrientationCallbackConfiguration ¶
func (device *IMUV3Bricklet) SetOrientationCallbackConfiguration(period uint32, valueHasToChange bool) (err error)
The period is the period with which the RegisterOrientationCallback 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.
func (*IMUV3Bricklet) SetQuaternionCallbackConfiguration ¶
func (device *IMUV3Bricklet) SetQuaternionCallbackConfiguration(period uint32, valueHasToChange bool) (err error)
The period is the period with which the RegisterQuaternionCallback 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.
func (*IMUV3Bricklet) SetResponseExpected ¶
func (device *IMUV3Bricklet) SetResponseExpected(functionID Function, responseExpected bool) error
Changes the response expected flag of the function specified by the function ID parameter. This flag can only be changed for setter (default value: false) and callback configuration functions (default value: true). For getter functions it is always enabled.
Enabling the response expected flag for a setter function allows to detect timeouts and other error conditions calls of this setter as well. The device will then send a response for this purpose. If this flag is disabled for a setter function then no response is sent and errors are silently ignored, because they cannot be detected.
func (*IMUV3Bricklet) SetResponseExpectedAll ¶
func (device *IMUV3Bricklet) SetResponseExpectedAll(responseExpected bool)
Changes the response expected flag for all setter and callback configuration functions of this device at once.
func (*IMUV3Bricklet) SetSensorConfiguration ¶
func (device *IMUV3Bricklet) SetSensorConfiguration(magnetometerRate MagnetometerRate, gyroscopeRange GyroscopeRange, gyroscopeBandwidth GyroscopeBandwidth, accelerometerRange AccelerometerRange, accelerometerBandwidth AccelerometerBandwidth) (err error)
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.
Associated constants:
- MagnetometerRate2Hz
- MagnetometerRate6Hz
- MagnetometerRate8Hz
- MagnetometerRate10Hz
- MagnetometerRate15Hz
- MagnetometerRate20Hz
- MagnetometerRate25Hz
- MagnetometerRate30Hz
- GyroscopeRange2000DPS
- GyroscopeRange1000DPS
- GyroscopeRange500DPS
- GyroscopeRange250DPS
- GyroscopeRange125DPS
- GyroscopeBandwidth523Hz
- GyroscopeBandwidth230Hz
- GyroscopeBandwidth116Hz
- GyroscopeBandwidth47Hz
- GyroscopeBandwidth23Hz
- GyroscopeBandwidth12Hz
- GyroscopeBandwidth64Hz
- GyroscopeBandwidth32Hz
- AccelerometerRange2G
- AccelerometerRange4G
- AccelerometerRange8G
- AccelerometerRange16G
- AccelerometerBandwidth781Hz
- AccelerometerBandwidth1563Hz
- AccelerometerBandwidth3125Hz
- AccelerometerBandwidth625Hz
- AccelerometerBandwidth125Hz
- AccelerometerBandwidth250Hz
- AccelerometerBandwidth500Hz
- AccelerometerBandwidth1000Hz
func (*IMUV3Bricklet) SetSensorFusionMode ¶
func (device *IMUV3Bricklet) SetSensorFusionMode(mode SensorFusion) (err error)
If the fusion mode is turned off, the functions GetAcceleration, GetMagneticField and GetAngularVelocity 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.
Associated constants:
- SensorFusionOff
- SensorFusionOn
- SensorFusionOnWithoutMagnetometer
- SensorFusionOnWithoutFastMagnetometerCalibration
func (*IMUV3Bricklet) SetStatusLEDConfig ¶
func (device *IMUV3Bricklet) SetStatusLEDConfig(config StatusLEDConfig) (err error)
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.
Associated constants:
- StatusLEDConfigOff
- StatusLEDConfigOn
- StatusLEDConfigShowHeartbeat
- StatusLEDConfigShowStatus
func (*IMUV3Bricklet) SetTemperatureCallbackConfiguration ¶
func (device *IMUV3Bricklet) SetTemperatureCallbackConfiguration(period uint32, valueHasToChange bool) (err error)
The period is the period with which the RegisterTemperatureCallback 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.
func (*IMUV3Bricklet) SetWriteFirmwarePointer ¶
func (device *IMUV3Bricklet) SetWriteFirmwarePointer(pointer uint32) (err error)
Sets the firmware pointer for WriteFirmware. 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.
func (*IMUV3Bricklet) WriteFirmware ¶
func (device *IMUV3Bricklet) WriteFirmware(data [64]uint8) (status uint8, err error)
Writes 64 Bytes of firmware at the position as written by SetWriteFirmwarePointer 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.
func (*IMUV3Bricklet) WriteUID ¶
func (device *IMUV3Bricklet) WriteUID(uid uint32) (err error)
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.
type MagnetometerRate ¶
type MagnetometerRate = uint8
const ( MagnetometerRate2Hz MagnetometerRate = 0 MagnetometerRate6Hz MagnetometerRate = 1 MagnetometerRate8Hz MagnetometerRate = 2 MagnetometerRate10Hz MagnetometerRate = 3 MagnetometerRate15Hz MagnetometerRate = 4 MagnetometerRate20Hz MagnetometerRate = 5 MagnetometerRate25Hz MagnetometerRate = 6 MagnetometerRate30Hz MagnetometerRate = 7 )
type SensorFusion ¶
type SensorFusion = uint8
const ( SensorFusionOff SensorFusion = 0 SensorFusionOn SensorFusion = 1 SensorFusionOnWithoutMagnetometer SensorFusion = 2 SensorFusionOnWithoutFastMagnetometerCalibration SensorFusion = 3 )
type StatusLEDConfig ¶
type StatusLEDConfig = uint8
const ( StatusLEDConfigOff StatusLEDConfig = 0 StatusLEDConfigOn StatusLEDConfig = 1 StatusLEDConfigShowHeartbeat StatusLEDConfig = 2 StatusLEDConfigShowStatus StatusLEDConfig = 3 )