Class MindsensorsAbsoluteIMU

  • All Implemented Interfaces:
    java.io.Closeable, java.lang.AutoCloseable, SensorConstants, SensorMode, SensorModes, Calibrate, SampleProvider

    public class MindsensorsAbsoluteIMU
    extends I2CSensor
    implements SensorModes, Calibrate
    Mindsensors AbsoluteIMU
    Sensor interface for the Mindsensors AbsoluteIMU family of sensors. The AbsoluteIMU sensors combine gyro, accelerometer and compass sensors in various combinations in a single housing. This interface works with all AbsoluteIMU models, but not all modes will work with any particular model.

    Supported modes
    Mode name Description unit(s) Getter
    Magnetic Measures the strength of the magnetic field over three axes getMagneticMode()
    Compass Measures the orientation of the sensor Degrees, corresponding to the compass rose getCompassMode()
    Angle Measures the orientation of the sensor Degrees, corresponding to the right hand coordinate system getAngleMode()
    Acceleration The Acceleration mode measures the linear acceleration of the sensor over three axes Metres/second^2 getAccelerationMode()
    Rate The Rate mode measures the angular speed of the sensor over three axes Degrees/second getRateMode()

    Sensor configuration
    The gyro sensor of the AbsoluteIMU uses a filter to remove noise from the samples. The filter can be configured using the setGyroFilter(int) method.
    The compass sensor of the AbsoluteIMU can be calibrated to compensate for magnetical disturbances on the robot (soft iron calibration) using the startCalibration() and stopCalibration() methods.

    To calibrate Compass, mount it on your robot where it will be used and issue startCalibration method and then rotate AbsoluteIMU slowly along all three axes. (The Compass in AbsoluteIMU is a 3 axis compass, and hence needs to be turned along all three axes, and if it's mounted on your robot, the whole robot needs to rotate). Rotate one axis at a time, turn once in clock-wise direction completing at-least 360 degrees, and then turn it in anti-clock-wise direction, then go to next axis. Upon finishing turning along all axes, issue stopCalibration method.

    See Mindsensors IMU user guide"> Sensor Product page See The leJOS sensor framework See leJOS conventions for SampleProviders

    Author:
    Andy
    • Constructor Detail

      • MindsensorsAbsoluteIMU

        public MindsensorsAbsoluteIMU​(I2CPort port,
                                      int address)
      • MindsensorsAbsoluteIMU

        public MindsensorsAbsoluteIMU​(I2CPort port)
      • MindsensorsAbsoluteIMU

        public MindsensorsAbsoluteIMU​(Port port,
                                      int address)
      • MindsensorsAbsoluteIMU

        public MindsensorsAbsoluteIMU​(Port port)
    • Method Detail

      • init

        protected void init()
      • getCompassMode

        public SensorMode getCompassMode()
        Return a SensorMode object that will provide tilt compensated compass data . The sample contains one element containing the bearing of the sensor relative to north expressed in degrees. East being at 90 degrees.
        Returns:
        a SensorMode object
      • getAngleMode

        public SensorMode getAngleMode()
        Return a SensorMode object that will provide angle data. The sample contains one element containing the bearing of the sensor relative to north expressed in degrees using a right hand coordinate system in the range of (-180 to 180). West being at 90 degrees, east being at -90 degrees.
        Returns:
        a SensorMode object
      • getAccelerationMode

        public SensorMode getAccelerationMode()
        Return a SensorMode object that will acceleration data for the X, Y and Z axis. The data is returned in units of m/s/s.
        Returns:
        a SensorMode object
      • getMagneticMode

        public SensorMode getMagneticMode()
        Return a SensorMode object that will return Magnetic data for the X, Y and Z axis The data is returned in Guass
        Returns:
        a SensorMode object
      • getRateMode

        public SensorMode getRateMode()
        Return a SensorMode object that will angular velocity data for the X, Y and Z axis. The data is returned in units of degrees/s.
        Returns:
        a SensorMode object
      • setRange

        public void setRange​(int range)
        Set the sensitivity used by the sensor. This setting impacts the maximum range of the returned value and the resolution of the reading.
        LOW Acceleration 2G Gyro 250 degrees/second
        MEDIUM Acceleration 4G Gyro 500 degrees/second
        HIGH Acceleration 8G Gyro 2000 degrees/second
        VERY_HIGH Acceleration 16G Gyro 2000 degrees/second
        The default setting is LOW.
        Parameters:
        range - the selected range (LOW/MEDIUM/HIGH/VERY_HIGH)
      • setGyroFilter

        public void setGyroFilter​(int value)
        Set the smoothing filter for the gyro.
        The Gyro readings are filtered with n???th order finite impulse response filter, (where n ranges from 0 to 7) value 0 will apply no filter, resulting in faster reading, but noisier values.value 7 will apply stronger filter resulting in slower read (about 10 milli-seconds slower) but less noise.
        The default value for the filter is 4.
        Parameters:
        value - (range 0-7)
      • startCalibration

        public void startCalibration()
        To calibrate Compass, mount it on your robot where it will be used and issue startCalibration method and then rotate AbsoluteIMU slowly along all three axes. (The Compass in AbsoluteIMU is a 3 axis compass, and hence needs to be turned along all three axes, and if it's mounted on your robot, the whole robot needs to rotate). Rotate one axis at a time, turn once in clock-wise direction completing at-least 360 degrees, and then turn it in anti-clock-wise direction, then go to next axis. Upon finishing turning along all axes, issue stopCalibration method.
        Specified by:
        startCalibration in interface Calibrate
      • stopCalibration

        public void stopCalibration()
        Ends calibration sequence.
        Specified by:
        stopCalibration in interface Calibrate