New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CH Robotics UM6 IMU/AHRS driver #347
Conversation
…eneric AHRS for all external AHRS systems (such as GX3 etc) added.
endif | ||
|
||
IMU_UM6_CFLAGS += -DUSE_IMU | ||
IMU_UM6_CFLAGS += -DUSE_UM6 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
USE_UM6 is not used anywhere so it can be removed...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed, it was for debugging and I forgot to remove it.
If you really really want to release that under Creative Commons, specify exactly which one (with the link to it). |
#define IMU_GYRO_Q_SIGN 1 | ||
#define IMU_GYRO_R_SIGN 1 | ||
#endif | ||
#if !defined IMU_GYRO_P_NEUTRAL & !defined IMU_GYRO_Q_NEUTRAL & !defined IMU_GYRO_R_NEUTRAL |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Neutrals are already default to zero in imu.h, so you don't have to repeat that here...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It actually sends the scaled values of the sensors, so I just replaced the scaling functions with dummy ones to keep the code consistent.
Please add at least a doxygen block to each source file after the license header: |
UM6Running | ||
}; | ||
|
||
static inline bool_t UM6_verify_chk(uint8_t packet_buffer[], uint8_t packet_length) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Functions that only used "internally" should not go into the header but only the c file as everything in the header will be indirectly included by everything using imu.h
Same goes for defines and variables...
Eventually we will have to settle on a common method on how to use external IMU/AHRS/INS sensors like this. |
This is indeed worth a discussion. e.g. in master it is not possible to run the ALT_KALMAN on raw XSens GPS -Christophe On Wed, Jan 16, 2013 at 11:26 AM, Felix Ruess notifications@github.comwrote:
|
Removed unused USE_UM6 variable (previously defined for debugging purposes). Cleanup of header and source files.
Doxygen added - is it sufficient like that? The idea behind was that it seems to make more sense to have a "generic" AHRS subsystem which only updates the airframe states with measured attitude from IMU, rather than having a separate IMU/AHRS subsystem for each IMU where lots of code would be duplicated. I chose to use quaternion representation, as it seems to be the most stable solution (no singularities etc). So the IMU subsystem should either output quaternions directly or convert the attitude estimation from IMU into quaternion representation. What do you think? |
About the doxygen comments, please specify the path relative to sw/airborne (same path that is used to include the files), so e.g. |
Ok, first some comments on the general situation with IMU/AHRS, etc... With the new state interface that we have now in master most of the ahrs interface is actually gone now (except the function declarations). In general it seems like for sensors like these which are essentially already an AHRS and not only an IMU, the imu interface would not be needed and it would make more sense to implement them as an AHRS directly. (Disregarding that we still require calls to imu directly from the main.c for the moment). We definitely have to discuss how to structure this now (e.g. the imu subsystem should only be mandatory if you want to run your own ahrs algorithm on the IMU measurements). The only places we use the imu values directly, are the when the actual acceleration measurements in imu/body frame are needed: nav_catapult, energy_ctrl and INS. About the ahrs_extern, why is it called ahrs_extern_euler? Since you use quaternions anyway which is good :-) It might make sense to use the new generic orientation representation in the ahrs_extern.
Regarding your implementation. You get the values as integers, convert to float, scale and convert back to int? With the above the values could be set in float directly instead of converting to int first by hand... (or scale and set in int to save some computing power...). Then you get them any desired format when needed (e.g. in your case ahrs_propagate to rotate to body frame and push to the state interface. In any case, if you want we can also merge this now as-is and continue the discussion on how to better handle different IMU/AHRS use-cases. (hoping you will still be around to implement and test changes where it affects your implementation). |
I moved the discussion to the mailing list. Some comments about the current code though:
I would rather merge the code as is now, and then update it later - depending on the output of the discussion, as I ll be around for a bit. |
…chrobotics.com). Generic AHRS for all external AHRS systems (such as GX3 etc) added. closes paparazzi#347
ok, let's continue on the mailing list... |
…chrobotics.com). Generic AHRS for all external AHRS systems (such as GX3 etc) added. closes paparazzi#347
Drivers for CH Robotic UM6 IMU/AHRS added (see www.chrobotics.com). Generic AHRS for all external AHRS systems (such as GX3 etc) added too.
The IMU driver is responsible for initializing and communicating with the IMU (e.g. getting new measurements) and updating AHRS with imu rate and estimated attitude quaternions.
AHRS subsystems in this case only updates the vehicle attitude according to given IMU rate and quaternions.
Use as
AHRS can be renamed from "Extern_euler", I just couldnt figure out a better name.