Reading the pitch rate of the 16470 IMU

The wpilib for the Analog Devices 16470 IMU doesn’t permit more than than the yaw rate to be read— access to the raw values would fix our need for pitch rate. We have a vertically mounted robo rio so we can use the ‘yawrate’ to balance our robot, but now we can’t get the heading rate. How can the raw axis rates be accessed with java?

Worcester Polytechnic Institute, please help!
I think I know how to fix the bug with your 16470 java library that makes it not as helpful as it could be to all of the teams that got one these in FIRST Choice. The old 16448 library had methods for reading each axis angle - not so for the 16470.
I imagine the reason you don’t accumulate each of the X, Y, and Z angles is computational efficiency, but we NEED those angles for properly handing non-level robots and oddly mounted IMUs.
My students could fix this with their own code, but only if they had the methods for obtaining the raw values.
Can you please update the 16470 library, or advise on how I can do it so that methods like the one below can be part of the class definition?
/**

  • @return X-axis gyroscope rate
    */
    public synchronized double getGyroRateX() {
    if (m_simGyroRateX != null) {
    return m_simGyroRateX.get();
    }
    return m_gyro_rate_x;
    }

Have you seen this thread/post?

We imported the vendor library implementation provided in previous years into WPILib to make sure it was still available for teams (since AD no longer maintains a vendor library), but I don’t know if any of us have a 16470 to make/test changes.

Thank you for considering my post. I could give you our 16470 on loan to test. We may have to go back to using the 16448 if we can’t resolve the issue.

You could just copy the source into your project and modify the parts you need. Its just a single file.

I want to do exactly this.
I hope you can help me with this simple thing that I do not know how to do.
I have tried saving the source as ADIS16470_IMU.class , I have saved it as ADIS16470.java-both in the same directory as robot.java and main.java. I have tried renaming the package it belongs to to frc.robot. I have tried several ways to get the ‘include’ statement in my robot.java file to find my copied version. Nothing I have tried works, but that is because of my ignorance-- I have never have written a new class in java. I have only ever modified existent wpilib code. Can you please help?

A more completed copy of 340’s altered java version is HERE. This is posted later in the thread Peter_Johnson linked. You can download that one java file, drop it in your robot code(in the subsystem package per se) and call it instead of the class in WPILib.

The original imported vendor library for the ADIS16740 only read one gyro axis accumulation at a time. It seems it was written by the same person who wrote the ADIS16488. I am not clear why the person changed the functionality. Right now the current code for the ADIS16470 only reads the accumulated gyro movement in one axis, but it does read the current rotational velocity on all axes. Not clear why the non-yaw rotational velocities had to be scoped out of reach.
As in my post that Peter_Johnson linked to there is a step by step guide to changing the original. This could help you if you are using C++ or LabVIEW. I did mention this to a C++ team, though not sure if they did anything.

I am all for merging it into WPILib, but we didn’t try to conform to WPILib spec at this time. This might be something that takes a little while to get into WPILib, and then released back to teams. So your best bet might be to use the alternate library posted for now.

1 Like

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.