Hi, we did port embedded motion app platform code for MPU6050 to JN5148 with a good success. Device is working pretty good (still under heavy test right now). We connected an HMC5883L compass device to the MPU and we rewrite ak8975.c interface to adapt to HMC5883L.
We did all is stated in documentation in order to use compass device, but how can I be sure compass device data are used?
To read data out of compass device, is the API function "ext_slave_descr.read" (which is a function pointer to our hmc5883l specific implementation) used? So I can put a log therein?
Thanks for any response.
Paolo.
- Log in to post comments
phpbb Topic ID
13488
Re: Re: How do I know if data from compass are used?
It would be easier if you call inv_send_external_sensor_data() during setup, and call inv_get_external_sensor_data() during execution to read the values.
Re: Re: How do I know if data from compass are used?
First of all thanks for you replay.
I did what you suggested.
I changed method umplStartMPU (in file umpl-states.c) adding the call to inv_send_external_sensor_data as follow:
inv_send_external_sensor_data(INV_ELEMENT_1, INV_16_BIT);
this method invocation has been placed after inv_dmp_open and before inv_dmp_start.
Then I put a trace inside function inv_get_compass_data (in file compass.c) in order to trace magnetometer data used within this function.
From the log the magnetometer data looks to be correct.
In my main loop I keep invoking following methods:
umplOnTimer();
result = inv_get_quaternion_float(fQuatEst);
looking to the log generated while running, I'm able to read the magnetometer data logged within inv_get_compass_data function.
This means that MPU is somehow reading magnetometer data while estimating orientation.
I'm using a 3D cuboid to check quaternion orientation. I apply quaternion to this cube. When I put a metallic screwdriver nearby my magnetic sensor the cube orientation is not changing, meanwhile logged magnetometer data are!
So: or (1) you have an excellent algorithm to correct magnetic distortion or (2) magnetic data are not used to estimate quaternion?
May you answer this question? Which of the two is correct?
Thanks forward for your response.
Paolo.
Re: Re: How do I know if data from compass are used?
The first one is correct. Within our sensor fusion algorithms we account for magnetic anomalies while utilizing the magnetometer data.
Re: Re: How do I know if data from compass are used?
@paolomosna wrote:
Hi paolomosna, where you can find ak8975.c file?