IMUEx

open class IMUEx : IMU, Runnable

Drop-in replacement for an Inertial Measurement Unit that provides WPIUnit data and the capabilities of automatic updates similar to (but not implementing) a subsystem multi-thread.

This class supports different readings of IMU measurement, such as an unrestricted domain on heading reads, while also being able to provide IMU units in terms of WPIUnits.

This class is also down-castable to the Universal IMU Interface. Note that all data in this class is retrieved via the run method, which opens the possibility for threading the IMU via startThread, similar to a BunyipsSubsystem.

Since this class is down-castable, it also can be used as a HardwareDevice and serves as a drop-in replacement for the IMU interface.

Field-exposed angles from this class are intrinsic. Read more in the YawPitchRollAngles and Orientation classes.

Author

Lucas Bubner, 2024

Since

4.0.0

Constructors

Link copied to clipboard
constructor(@NonNull imu: IMU)
Wrap an IMU to use in IMUEx.

Types

Link copied to clipboard
The various modes that the yaw field can represent the current robot yaw as.

Properties

Link copied to clipboard
Last acquisition of data from the IMU by IMUOp.
Link copied to clipboard
Last read pitch of the IMU.
Link copied to clipboard
Last read pitch velocity of the IMU.
Link copied to clipboard
open var quaternion: Quaternion
Last known robot-centric quaternion reported from the IMU and yaw offset.
Link copied to clipboard
Last read roll of the IMU.
Link copied to clipboard
Last read roll velocity of the IMU.
Link copied to clipboard
Last read yaw (heading) of the IMU with the yaw offset.
Link copied to clipboard
Link copied to clipboard
Last read yaw velocity of the IMU.

Functions

Link copied to clipboard
open fun close()
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open fun getManufacturer(): HardwareDevice.Manufacturer
Link copied to clipboard
open fun getRobotAngularVelocity(@NonNull angleUnit: AngleUnit): AngularVelocity
Link copied to clipboard
open fun getRobotOrientation(@NonNull reference: AxesReference, @NonNull order: AxesOrder, @NonNull angleUnit: AngleUnit): Orientation
Note: This Orientation will not respect the currently set YawDomain to ensure consistency across usages of the Universal IMU Interface.
Link copied to clipboard
Note: This Orientation will not respect the currently set YawDomain to ensure consistency across usages of the Universal IMU Interface.
Link copied to clipboard
open fun getRobotYawPitchRollAngles(): YawPitchRollAngles
Note: This method will not respect the currently set YawDomain, as it may not respect the angle requirement as listed by the YawPitchRollAngles that is provided by this method.
Link copied to clipboard
open fun getVersion(): Int
Link copied to clipboard
Gets the current yaw domain, which is the domain this IMU is reporting yaw at.
Link copied to clipboard
open fun initialize(@NonNull parameters: IMU.Parameters): Boolean
Link copied to clipboard
open fun resetYaw()
Link copied to clipboard
open fun run()
Update the class fields and method return values with newest information from the IMU.
Link copied to clipboard
open fun setYawDomain(@NonNull newDomain: IMUEx.YawDomain)
Sets the domain range of what the yaw field will return.
Link copied to clipboard
open fun setYawMultiplier(mul: Double)
Set a multiplicative scale that will be applied to every delta update of the IMU heading.
Link copied to clipboard
open fun startThread()
open fun startThread(@NonNull loopSleepDuration: Measure<Time>)
Call to delegate the manual data updating of the IMU to a thread managed by Threads.
Link copied to clipboard
open fun stopThread()
Call to stop the thread started by startThread.