I’m rebuilding Phantom 2 with Pixhawk and PX4, and trying to reuse as many DJI original parts as possible. I’ve solved a bunch of issues, but stumble upon the unexpected one.
I can not set the right orientation for the external compass.
Using handy CLI command sensors status, I was able to find the base orientation of the external compass, in which both internal and external magnetometers reading seem to match. I’ve checked with the datasheet on HMC5883, and as far as I can tell, that orientation is correct.
Now, I want to mount the sensor back where it was and set a correct rotation in PX4 parameters. But can’t find a correct option for it.
To get compass into position, I need to turn it around two axes. One of the possible definitions: first, it should be turned 90 degrees clockwise around the yaw axis, then, 90 degrees counterclockwise around the pitch axis. I hope that explanation makes sense.
In despair, I’ve tried all two-axis 90 degree-divisible options, including:
10 Roll 180°, Yaw 90°
14 Roll 180°, Yaw 270°
18 Roll 90°, Yaw 90°
22 Roll 270°, Yaw 90° <-- this seems to be correct, but doesn’t work
There are only four of them, which is very strange.
I’m stuck, any help appreciated.