Doubts about MindsensorsAbsoluteIMU

This is where you talk about the EV3 software itself, installation issues, and programming talk.

Moderators: roger, gloomyandy, skoehler

User avatar
esmetaman
Advanced Member
Posts: 358
Joined: Wed Sep 13, 2006 12:16 am
Location: UK, Milton Keynes
Contact:

Doubts about MindsensorsAbsoluteIMU

Postby esmetaman » Sun Sep 03, 2017 11:42 am

Hi,

I am reviewing the implementation of the Sensor: MindsensorsAbsoluteIMU and I detected that the mode: "Compass" & "Angle" are the same.
Why?

https://sourceforge.net/p/lejos/ev3/cod ... teIMU.java

Code: Select all

protected void init() {
    // The accelerometer reports readings in mG we convert this to m/s/s
    // TODO: we switch X axis direction to match dexter device. Do we need to do
    // anything with the gyro etc?
    accelMode = new ShortSensorMode("Acceleration", ACCEL_DATA, 3,
        accelerationToSI, 1.0f);
    // the magnetometer reports in Gauss
    magMode = new ShortSensorMode("Magnetic", MAG_DATA, 3, magneticToSI, 1.0f);
    // the gyro reports in units of 8.75 milli-degree/s we convert to degree/s
    gyroMode = new ShortSensorMode("Rate", GYRO_DATA, 3, 0.00875f, 1.0f);
    // the compass reports the angle in degrees.
    compassMode = new ShortSensorMode("Compass", COMPASS_DATA, 1, 1.0f, 1.0f);
    angleMode = new ShortSensorMode("Angle", COMPASS_DATA, 1, 1.0f, -1.0f);
    this.setModes(new SensorMode[] { magMode, compassMode, angleMode,
        accelMode, gyroMode });
    setRange(LOW);
    setGyroFilter(4);
  }


In the other hand, why change the name of the mode from gyro to rate?

Reviewing the technical documentation from EV3Dev, the sensor provide another mode: "TILT",
http://docs.ev3dev.org/projects/lego-li ... solute-imu

Maybe, it is necessary to upgrade the sensor.

What is your opinion?

Juan Antonio
Juan Antonio Breña Moral
http://www.juanantonio.info/lejos-ebook/
http://ev3dev-lang-java.github.io/#/
https://github.com/jabrena/livingrobots

User avatar
gloomyandy
leJOS Team Member
Posts: 5871
Joined: Fri Sep 28, 2007 2:06 pm
Location: UK

Re: Doubts about MindsensorsAbsoluteIMU

Postby gloomyandy » Sun Sep 03, 2017 1:08 pm

Compass and Angle are not identical. One reports degrees with the rotation in the conventional compass mode (clockwise increasing), the other reports rotation using the leJOS right hand rule (anti-clockwise increasing). I'm pretty sure that tilt is just another way of reporting the acceleration data. No other leJOS classes report tilt values.
leJOS news https://lejosnews.wordpress.com/

User avatar
esmetaman
Advanced Member
Posts: 358
Joined: Wed Sep 13, 2006 12:16 am
Location: UK, Milton Keynes
Contact:

Re: Doubts about MindsensorsAbsoluteIMU

Postby esmetaman » Sun Sep 03, 2017 2:06 pm

Hi Andy,

Now, I understand. Although both modes are quite similar the difference is the last parameter:

The methods are defined in this way:

Code: Select all

compassMode = new ShortSensorMode("Compass", COMPASS_DATA, 1, 1.0f, 1.0f);
angleMode = new ShortSensorMode("Angle", COMPASS_DATA, 1, 1.0f, -1.0f);


The class ShortSensorMode has a constructor to change the scale:

Code: Select all

  protected class ShortSensorMode implements SensorMode {
    protected final String  name;
    protected final int     sampleSize;
    protected final float[] convert;
    protected final int     baseReg;
    protected float[]       scale;
    protected byte[]        buffer;

    /**
     * Internal class to provide the sensor data. Handles obtaining the base
     * data and converting it to suitable SI units.
     *
     * @param name
     *          mode name
     * @param reg
     *          base register for the available samples
     * @param sampleSize
     *          number of samples
     * @param convert
     *          conversion factor to SI units
     * @param scale
     *          scale factor needed for range adjustment
     */
    protected ShortSensorMode(String name, int reg, int sampleSize,
        float[] convert, float scale) {
      this.name = name;
      this.sampleSize = sampleSize;
      this.convert = convert;
      this.baseReg = reg;
      this.scale = new float[sampleSize];
      setScale(scale);
      buffer = new byte[sampleSize * 2];
    }

    protected ShortSensorMode(String name, int reg, int sampleSize,
        float convert, float scale) {
      this.convert = new float[sampleSize];
      for (int i = 0; i < sampleSize; i++)
        this.convert[i] = convert;
      this.name = name;
      this.sampleSize = sampleSize;
      this.baseReg = reg;
      this.scale = new float[sampleSize];
      setScale(scale);
      buffer = new byte[sampleSize * 2];
    }

    /**
     * Set the scale factor used when converting data to returned units.
     *
     * @param scale
     *          new scale factor
     */
    protected void setScale(float scale) {
      for (int i = 0; i < convert.length; i++)
        this.scale[i] = convert[i] * scale;
    }

    @Override
    public int sampleSize() {
      return sampleSize;
    }

    @Override
    public void fetchSample(float[] sample, int offset) {
      // fetch the raw data
      getData(baseReg, buffer, 0, buffer.length);
      for (int i = 0; i < sampleSize; i++) {
        int rawVal = (buffer[i * 2] & 0xff) | ((buffer[i * 2 + 1]) << 8);
        sample[i + offset] = rawVal * scale[i];
      }
    }

    @Override
    public String getName() {
      return name;
    }

  }


In relation to the Tilt Sensor, I agree that the Tilt is another kind of Accelerometer data: (Tilt Sensor resolution: 1 degree)
http://www.mindsensors.com/ev3-and-nxt/ ... nxt-or-ev3

In your tests, do you use the Gyro Filter included with the sensor? or do you prefer to use some sensor filter included with LeJOS?
Juan Antonio Breña Moral
http://www.juanantonio.info/lejos-ebook/
http://ev3dev-lang-java.github.io/#/
https://github.com/jabrena/livingrobots

User avatar
gloomyandy
leJOS Team Member
Posts: 5871
Joined: Fri Sep 28, 2007 2:06 pm
Location: UK

Re: Doubts about MindsensorsAbsoluteIMU

Postby gloomyandy » Sun Sep 03, 2017 3:23 pm

I've never used this device for anything very serious. I've always used the BNO055 which seems to have rather more on board processing than that provided by the Mindsensors device. In particular it provides tilt compensated gyro readings and automatic drift compensation.
leJOS news https://lejosnews.wordpress.com/

User avatar
esmetaman
Advanced Member
Posts: 358
Joined: Wed Sep 13, 2006 12:16 am
Location: UK, Milton Keynes
Contact:

Re: Doubts about MindsensorsAbsoluteIMU

Postby esmetaman » Sun Sep 03, 2017 4:41 pm

Yes, I agree with you that it is fantastic the Bosch Sensor but the question is about the AbsoluteIMU.

In your tests, how to visualize the raw Output from complex sensors like IMUs?
Juan Antonio Breña Moral
http://www.juanantonio.info/lejos-ebook/
http://ev3dev-lang-java.github.io/#/
https://github.com/jabrena/livingrobots

User avatar
gloomyandy
leJOS Team Member
Posts: 5871
Joined: Fri Sep 28, 2007 2:06 pm
Location: UK

Re: Doubts about MindsensorsAbsoluteIMU

Postby gloomyandy » Sun Sep 03, 2017 4:54 pm

As I said above I've never used the Mindseneors device for anything serious, why would I spend any time visualizing the output from it? When I've briefly tested it I just check that you get 1G acceleration reading from each axis (when aligned up/down), with zero from the others, and that the gyro produces reasonable looking results in comparison to another gyro, that's pretty much it. The data sheets from the manufacturers (the actual chip manufacturers not mindsensors) usually contain more than enough information about how the various sensor elements operate.
leJOS news https://lejosnews.wordpress.com/

User avatar
esmetaman
Advanced Member
Posts: 358
Joined: Wed Sep 13, 2006 12:16 am
Location: UK, Milton Keynes
Contact:

Re: Doubts about MindsensorsAbsoluteIMU

Postby esmetaman » Sun Sep 03, 2017 5:22 pm

No, Andy,

I said in general not in a particular IMU sensor.

For example, Aswin used Excel in his articles:
https://nxttime.wordpress.com/2013/04/1 ... ro-sensor/

Image

Do you use some kind of plot tool to show the sensor output in Real time?
Juan Antonio Breña Moral
http://www.juanantonio.info/lejos-ebook/
http://ev3dev-lang-java.github.io/#/
https://github.com/jabrena/livingrobots

User avatar
gloomyandy
leJOS Team Member
Posts: 5871
Joined: Fri Sep 28, 2007 2:06 pm
Location: UK

Re: Doubts about MindsensorsAbsoluteIMU

Postby gloomyandy » Sun Sep 03, 2017 7:42 pm

As I said above the datasheet for the sensor typically provides far more information than simple tests produce. After that you need to look at real world tests that replicate how you will actually use the sensor. For instance the techniques that Aswin describes for tracking the offset of a gyro really do not work well for a robot that is constantly moving (particularly one making lots of small turns or, gradual turns) if you are using the gyro to track the turns it is making. So a test that evaluates a gyro in this sort of context will tell you far more than simple movements. See the following for a way to really evaluate a gyro in the real world...
https://lejosnews.wordpress.com/2016/02 ... ile-robot/
The beauty of this test is that the it is easy to see the track that the robot actually follows and compare this with that reported by other means. Much easier to interpret than a graph.

Even with a good gyro, drift over time will almost certainly be a problem as is clearly seen in the very long runs when building maps. Again a real world test provides a better illustration of the problems:
https://lejosnews.wordpress.com/2017/07/15/slam/
The video the accompanies this shows an evaluation of an imu against both odometry and pretty accurate SLAM based localization and demonstrates the issues involved.
leJOS news https://lejosnews.wordpress.com/

User avatar
esmetaman
Advanced Member
Posts: 358
Joined: Wed Sep 13, 2006 12:16 am
Location: UK, Milton Keynes
Contact:

Re: Doubts about MindsensorsAbsoluteIMU

Postby esmetaman » Sun Sep 03, 2017 8:41 pm

I will test this week if using Java Mission Control, is possible to show IMU raw data.
http://www.oracle.com/technetwork/java/ ... 98576.html

But in parallel, i will read the links that you say.

What do you think if this season, we write some documentation about robotics theory with Java?

Cheers

Juan Antonio
Juan Antonio Breña Moral
http://www.juanantonio.info/lejos-ebook/
http://ev3dev-lang-java.github.io/#/
https://github.com/jabrena/livingrobots


Return to “EV3 Software”

Who is online

Users browsing this forum: No registered users and 3 guests