-
Notifications
You must be signed in to change notification settings - Fork 13.4k
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
fmu-v4/v4pro: switch to new InvenSense icm20602/icm20608g drivers #14184
Conversation
@PX4/testflights could you thoroughly test this on any platform with a pixracer or pixhawk 3 pro? |
I've taken this as an opportunity to change the rotation convention/interpretation for InvenSense sensors. In PX4 sensors we want data published with X forward, Y right, Z down (right handed coordinate system). On a pixracer this sensor is on the bottom of the board with the sensor's X axis pointed in the direction of flight (to the right below). Bottom of pixracer, (direction of flight arrow points right)Currently in PX4 master we start this sensor with a rotation of 2 (ROTATION_YAW_90), which I find a bit unintuitive, especially when things get more complicated (try to make sense of the isolated mpu9250 orientation on a cube...). New Drivers (icm20602, icm20608g, etc)In the newer IMU drivers I've started from scratch I've interpreted this differently, starting with the sensor's X axis as an anchor and the fact that the sensor is upside down (on a pixracer), so it's rotation relative to the board is now ROTATION_ROLL_180 (-R 8). Once the drivers assemble the int16 raw data they immediately negate z (beause sensor's +Z is up and we want +Z down) and y (+y is right). As boards are updated and drivers switched we'll have to update the sensor rotation, but we already have to go through board by board to configure DMA before transitioning. I also considered keeping the sensor's native frame and exposing more metadata, but that seemed like a waste. Does anyone have an objection with moving forward like this? Is there a more obvious interpretation we should go with? @bkueng @davids5 @julianoes @RomanBapst @dakejahl @mcsauder @dinomani |
think its fine for me, is it consistent with the other imu sensors? like
the bosch ? bmi088
[image: image.png]
greetz DINO
…On Wed, Feb 19, 2020 at 4:08 PM Daniel Agar ***@***.***> wrote:
I've taken this as an opportunity to change the rotation
convention/interpretation for InvenSense sensors.
In PX4 sensors we want data published with X forward, Y right, Z down
(right handed coordinate system).
The InvenSense sensors provide data like this.
[image: Screenshot from 2020-02-19 09-29-00]
<https://user-images.githubusercontent.com/84712/74843704-4b7ce780-52fa-11ea-8bcc-6816c5c142fb.png>
On a pixracer this sensor is on the bottom of the board with the sensor's
X axis pointed in the direction of flight (to the right below).
Bottom of pixracer, (direction of flight arrow points right)
[image: Screenshot from 2020-02-19 09-30-16]
<https://user-images.githubusercontent.com/84712/74843826-7b2bef80-52fa-11ea-9e6e-8a31ad59d184.png>
---->
Currently in PX4 master we start this sensor with a rotation of 2
(ROTATION_YAW_90), which I find a bit unintuitive, especially when things
get more complicated (try to make sense of the isolated mpu9250 orientation
on a cube...).
The existing mpu6000 driver (with icm20602 support) leaves the z axis as
is (sensor z is up, but sensor is mounted upside down on the pixracer),
then negate x and swap x <=> y.
New Drivers (icm20602, icm20608g, etc)
In the newer IMU drivers I've started from scratch I've interpreted this
differently, starting with the sensor's X axis as an anchor and the fact
that the sensor is upside down (on a pixracer), so it's rotation relative
to the board is now ROTATION_ROLL_180 (-R 8). Once the drivers assemble the
int16 raw data they immediately negate z (beause sensor's +Z is up and we
want +Z down) and y (+y is right).
As boards are updated and drivers switched we'll have to update the sensor
rotation, but we already have to go through board by board to configure DMA
before transitioning. I also considered keeping the sensor's native frame
and exposing more metadata, but that seemed like a waste.
Does anyone have an objection with moving forward like this? Is there a
more obvious interpretation we should go with? @bkueng
<https://github.com/bkueng> @davids5 <https://github.com/davids5>
@julianoes <https://github.com/julianoes> @RomanBapst
<https://github.com/RomanBapst> @dakejahl <https://github.com/dakejahl>
@mcsauder <https://github.com/mcsauder> @dinomani
<https://github.com/dinomani>
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#14184>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AMHRHANNNPCYWUPUZDNX4OLRDVDP7ANCNFSM4KXRJONA>
.
|
@dinomani No, but the goal would be to do this consistently everywhere. In the Bosch BMI088 case it looks like we're currently doing nothing. Which means if the sensor was mounted on top of your board already orientated in the direction of flight you'd have to at least rotate it roll or pitch 180. This is the kind of confusing mess I want to eliminate. For the InvenSense case I think the question boils down to if we keep the sensor's X axis as a starting point anchor or if looking at the device the -Y axis (the top) would be considered forward and therefore mapped to +X. So that would be...
Yes this annoying, but I'm hoping we can get it settled for good this time. |
Tested on PixRacer V4Indoor Flight Test Procedure Notes Log https://review.px4.io/plot_app?log=5378bcbc-602f-45cb-80af-4f4427568084 https://review.px4.io/plot_app?log=35c18620-51ce-4d96-a354-3ee61e681f6e https://review.px4.io/plot_app?log=1711530e-df7d-48ab-bf96-a61e075df041 Tested on Pixhawk V4 proIndoor Flight Test Procedure Notes Log https://review.px4.io/plot_app?log=5daab84c-03df-45c0-b567-0603c430aef3 https://review.px4.io/plot_app?log=7de8166b-67c5-4f20-93c0-f0905cbd744f https://review.px4.io/plot_app?log=e823e50b-fc1e-4324-aafc-13dfcc8342db |
@dagar , I'm all for this! Nice work! |
No, just a minor point, as mentioned, requiring to change rotation when switching drivers is an additional source of error. |
Yes, it wasn't my first choice, but I'm committed to making it consistent across the entire code base with a sane convention. |
If those control latency changes worried anyone here's a bit more info to show it's not as bad everywhere. End-to-end control latency of new drivers compared to master.
Due to the clock configuration on the pixracer (px4_fmu-v4) the ICM20602 (10 MHz SPI) is actually only operating at 5.5 MHz. The MPU9250 (max 20 MHz SPI) isn't nearly as bad, but still only operating at 10.5 MHz. This is something we might be able to optimize per board. |
Tested on PixRacer V4:Modes Tested Position Mode: Good. - Procedure Notes: Log: https://review.px4.io/plot_app?log=ee055db8-6654-490a-a034-c28426586269 Log Master comparison Tested on Pixhawk V4 pro:Modes Tested Position Mode: Good. - Procedure Notes: Log: https://review.px4.io/plot_app?log=131ece49-886e-4f3b-b8d2-f1db63b204d7 Log Master comparison |
I gave this a quick spin as well, on a Pixracer with MPU9250 + ICM20608 + DShot. CPU load is definitely too high, it was 7% left on idle (vs 12% on master). So I disabled the MPU9250 for flying:
|
I'd be happy with the sample latency going up if it means we can do smarter filtering and get the delay down there instead. |
Here's the short term fix to enable these drivers on stm32f7 (fmu-v5 fmu-v5x, etc). PX4/NuttX#85 |
Thanks @bkueng, it looks like the ICM20608g was a little worse than the ICM20602 because it was separately sampling temperature every iteration. I have some updates that minimize the temperature update (1 Hz) and also skip the FIFO count check. Overall this is the difference I'm seeing compared to master (px4_fmu-v4).
There's also an mpu9250 version of the new driver in a usable state, but I haven't implemented the mag yet. |
Branch updated with various improvements from #14208.
Skipping or throttling the additional small (non-DMA) SPI transactions (FIFO count and temperature) can save a few percent cpu per sensor instance (relative to master) while still transferring all raw data. @PX4/testflights could you please do another round of testing on any px4_fmu-v4 and px4_fmu-v4pro vehicles? |
Tested on Pixhawk 3 v4ProModes Tested
Procedure Notes Log |
Tested on PixRacer V4: Position Mode: Good. - Procedure Notes: Log: Log |
Latest test logs look good. I also did a sanity check on the test rack to compare that all the sensor output is roughly equivalent before/after (device ids, temperature, scaling, etc). Thanks everyone! |
Based on recent testing results (#14175) I think it's time to start gradually switching to the new InvenSense IMU drivers.
IMU_GYRO_RATEMAX
from 250 Hz - 2000 kHz.Comparison with Master (pixracer multicopter 4001)
sensor_accel_fifo
andsensor_gyro_fifo
for logging/analysis and will be used directly later.TODO: