I’d like to use a rangefinder & optical flow(MTF-01P) when within range of the optical flow for loiter mode & later switch to GPS being the source once the quad climbs beyond the range of the MTF 01P
I’m switching between the GPS and Optical flow using the EKF source switch as mentioned in the docs.
Each sensor works well, by itself. When I switch source from optical flow back to gps, the quad starts toilet bowling with it’s circle starting to increase..
One thing I’ve been seeing with my compass was, whenever the quad moves and then stops, the compass value keeps moving for a while, after which it stabilizes.
Also, the compass direction that the quad reads is way off, compared to the true direction (I’ve used my phone as a reference which I assume is relatively accurate)
So I’ve learnt something new. I have mounted my compass (the combi on the HGLRC m100 pro) 180 degrees around on the yaw axis (unfortunately I couldn’t find a doc stating the mounting direction at the time but some datasheet reading now makes me certain),
Also my custom mount has a pitch of 30 degree which I didn’t account for.
Reading the docs, it seemed like this should be accounted for by the calibration already, but the orientation set is incorrect (it auto set to yaw of 280), maybe the pitch throws it off.
If the compass is leaning 30deg from flat (as compared to the autopilot) that will definitely cause problems unless the custom rotation is used. Using the custom rotation is very unusal though. I’ve never done it myself.
Using the custom rotation + completing calibration, the compass seems to be fairly ok.
However, whenever in position hold using GPS, I’m still seeing toilet bowling (sorry, I’ll post logs soon)
Would you know any checks I could do to ensure the GPS & compass readings are correct w.r.t the FC?
@rmackay9 Thanks a ton!!
I did a compass MOT, to rule out any interference, but the max interference at 60% throttle was 13, which seems to be very good.
The EKF view is very interesting, when I yaw the drone 180 degrees, the compass field goes red & into the bad regions.
I need to see why..
Ok sounds mostly good. The compass going read means that the heading from the compass is not lining up with the rotations detected by the IMU. So the likely causes are:
interference on the compass from motors, escs, etc
Compass calibration with manual settings of orientation
I was previously sharing the compass voltage line with the optical flow + lidar, assuming that the lidar current draw might cause peaks, tried with using different voltage pads (coming from seperate BECs) and calibrated the compass.
Monitored the elf & can see errors still.
With all the above, I still see toilet bowling
I think the HGLRC m100 pro might not be a very good module, I think the compass isn’t reliable (or at least the unit I have)
Once, it worked fine, I took off in alt hold, moved to loiter in GPS and switched between optical flow & GPS, no issues seen.
So clearly setup looks okay. I’m going to buy a new compass.
ok, I hope the new compass module works. I have to say though that I’ve almost never seen the compass sensor itself be the problem. It’s nearly always the placement of the sensor that is the issue. If it’s very close to the frame (e.g. not up on a stalk) then it can be very unreliable. If its elevated then it normally works.
Sorry I had taken a log but hadn’t added it yesterday, with your reply, I am now working on moving the GPS away to a different location, printing a mast & trying that out & finally shielding the connecting wires to the GPS as well (all 3 separate checks)
@rmackay9 thanks a lot of supporting me & for all the advice given!
It was interference all this while!
Adding some info here, in case it helps anyone in the future:
I did a test with the GPS +compass module moved to another location & had no luck.
Then I 3d printed a temporary mast & mounted the GPS on it.
Note: calibration done after every new mounting location.
Things noticed after moving onto the mast:
GPS lock was way quicker, AHRS home position locked soon too & the drone went to 13 GPS satellites within a few minutes! This looked positive
GPS compass calibration on “default” went through the first time for every attempt!
Ekf for the compass stayed green, everytime I moved the quad & shows no jitter once stationary. Previously, ekf would go red everytime & jitter seen after being stationary
With the GPS being on a mast, I now have very good performance on loiter & switching between optical to GPS has no trouble.
Here’s some pictures to give a visual understanding, in case it helps someone: