Welcome to PhantomPilots.com

Sign up for a weekly email of the latest drone news & information

What happens if there is conflict with compass & GPS.

Discussion in 'Phantom 1 Discussion' started by Miika, Jun 8, 2015.

  1. Miika

    Joined:
    Aug 31, 2013
    Messages:
    221
    Likes Received:
    1
    Location:
    Helsinki, Finland
    What happens when compass is off by lets say 180 degrees. So north is south and south is north. If you engage RTH and flight controller tries to fly north... is there somesort of logic in the flight controller that solves this kind of situations. Obviously the flight controller knows that the drone isnt flying to north as it's locations is moving to south?

    What happens if your compass is giving a false reading? Does the flight controller still keep using that data and fly further away even when its GPS knows that it's not going to right direction. Is this one of the reasons why drones keep flying away? Could this be solved with some flight controller logic that would make the flight controller to stop following compass readings if the drone doesnt fly into the right direction based on its readings.

    A smart flight controller could fix it's heading based on gps data as it knows in which direction the drone is heading even without compass at all. So in a scenario where compass has gone mad, it would be possible to have logic in flight controller that could fly home voiding the compass reading.
     
  2. IflyinWY

    Joined:
    Sep 12, 2014
    Messages:
    3,470
    Likes Received:
    940
    Location:
    Where the deer and the antelope play
    Yikes, that's a bunch of questions and what if's. Great ones, if you're on the right track. :)

    If you haven't noticed, most of the birds that fly away are not in the P1 or FC40 forums. It's the P2s with all their high tech electronics which have brought genuine "fly away" into the picture. I realize there probably have been some P1 & FC40 fly aways, but I can see where most, if not all were pilot induced.

    In response to paragraph 1:
    If I am not mistaken, RTH will use GPS to get home. I do not know if there will be any Compass involvement in the process. I don't see why there would be, because the Phantom doesn't care which direction it is pointed when it executes RTH. At least that has been my experience.

    In response to paragraph 2:
    If the compass is giving a false reading, the Phantom won't know which direction it is heading.
    As previously stated, I don't think it matters what the heading is. I think the Flight Controller already has the logic to cope with a bad compass. If it doesn't, it certainly should, so you have a great idea.

    Paragraph 3 assumes you are correct about GPS being able to tell the Phantom it's heading. I believe this is, or could be true, but only if the Phantom covers some distance to establish it's heading.
    Here is how I am thinking of it. GPS offers LOCATION information. If the Phantom is stationary, how would it know which direction it is facing?

    Now if there were a "Smart Controller" as I think you envision, there would need to be a change in location in order for the Phantom to "orient" itself in relation to heading.

    I think you should mount your compass on the outside of the proper leg, that will swap North with South. Give it a fly and see what happens. I would not suggest doing this in a populated area or near a lake or ocean. You might want to tie a string to it, and/or put a tracking device onboard prior to the test.

    Am I on the same page as you, or totally lost on the subject?

    Oh yea, you've got some really cool videos. Thanks for sharing :D
     
    #2 IflyinWY, Jun 11, 2015
    Last edited: Jun 11, 2015
  3. Some-E

    Joined:
    Sep 27, 2016
    Messages:
    5
    Likes Received:
    0
    Location:
    Mikkeli, Finland
    Correctly functioning compass is essential for the GPS mode to work. Those two go hand in hand, always. Also, the compass plays no role in ATTI mode.

    Without compass direction the FC would not know how to reach the desired coordinates. Even slight errors are problematic, especially seen in the case of toilet bowl effect: FC wants to hover in place, keep the coordinates stable, but does the corrective maneuver in slightly wrong direction, hence the difference between wanted and actual coordinates gets bigger, and FC now wants a faster correction, but again does it to wrong direction and so on. Eventually the misalignment has been gone through all 360 (if not getting out of control), but there is no logic to stop misguiding the bird.

    So, wild compass = switch to ATTI (if it doesn't identify bad compass reading itself and exit GPS mode).

    For the RTH, I don't know. I have thought the compass orientation does not matter, it should be relative. But just this week I found out about magnetic declination effect and that's why I'm now here. Apparently the absolute compass bearing is used in flight. I get steady hovering, but not straight flight without left/right stick. I'm looking for comprehensive experiences on rotating the compass module. Seems that just have to try it myself.
     
  4. syotr

    Joined:
    Jul 30, 2013
    Messages:
    941
    Likes Received:
    153
    The flight controller gets position data from the GPS and heading from the compass. Without good data from the compass, it does not know which motors to speed up/slow down in order to tilt towards home. The problems comes when the data from the compass does not agree with the positional changes reported by the GPS. (Which one is correct?) With the earlier Phantoms, when there was conflict, they just flew away, ignoring all input from the pilot.Later models, automatically switched to Atti mode.
    It would be possible to program a flight controller to return with only GPS. Just as the GPS in your car, it would know your heading after moving a short distance. Wind makes this more complicated for the drone, but it would still be possible as long as the winds were not too strong or variable. Wind speed and direction can easily be gauged by letting the Phantom drift for a few seconds.
    Those pilots who have flown aircraft in the years before GPS, learned some simple techniques to bring an aircraft home without knowing its orientation or exact location. As long as you could see it as a tiny spec in the distance, you could yaw the aircraft while flying forward and tell when it was moving to the right or left. For example, if you yaw CW while going forwards until you see the aircraft moving to the right, then you know it is headed approximately 90 degrees to the path home. Continue to yaw CW and fly forward until the rightward movement stops and you are pointed home. From there you can easily bring it back.
    One misconception, is that the compass is needed to stop the Phantom from yawing on it own when hovering. If you have flown in Atti mode without a compass, you would see that the gyros hold the heading very well.
     
  5. Pilot_FML

    Joined:
    Sep 20, 2013
    Messages:
    225
    Likes Received:
    28
    Location:
    Mentor. Ohio, USA
    So to summarize .... you need "BOTH" the magnetic compass and the GPS working together for a Phantom RTH function to to work properly .... (if you're talking today's technology.;))

    The GPS determines your quads position and then the magnetic compass provides a bearing from that fixed point to the home point (previously recorded by the GPS and paced into the flight controllers memory). The flight controller then continuously provides inputs to the quad motors to then put and keep the quad on the flight path home.

    I guess in some future design you could eliminate the compass but it would mean that a huge number of very rapid and accurate GPS position fixes on the way back home would have to be fed to the flight controller to keep the quad on the correct heading towards the home point. That in turn would probably also mean faster flight controllers to handle the increased number of inputs being sent to it.
     
  6. syotr

    Joined:
    Jul 30, 2013
    Messages:
    941
    Likes Received:
    153
    With the current programming in the Phantom, yes, you need both. The programming to return without a compass would be trivial and easily within the processing speed and power of the existing flight controller. The GPS in cars have been doing it for many years.
     
  7. Pilot_FML

    Joined:
    Sep 20, 2013
    Messages:
    225
    Likes Received:
    28
    Location:
    Mentor. Ohio, USA
    Unless you're a DJI engineer I'm not sure one could say whether or not it would be a trivial programming change. DJI has never disclosed even the simplest of their designs so its pretty hard to say one way or another what's involved or more importantly how much changes would cost. We're not talking quad quantities comparable to the car or cell phone markets, so its unlikely they've got any incentive to change.
     
  8. syotr

    Joined:
    Jul 30, 2013
    Messages:
    941
    Likes Received:
    153
    I guess you are not a programmer ;)
     
  9. Some-E

    Joined:
    Sep 27, 2016
    Messages:
    5
    Likes Received:
    0
    Location:
    Mikkeli, Finland
    This is very good talk for understanding the basic dilemma, at least for myself, hopefully for some others too. So this is mostly written for myself rather than replying directly to anyone. Thank you for your patience.

    Cars do not compare well with drones. The same goes for aeroplanes and boats. They all have a distict "turn left / right" capability in their design. Symmetric drones don't have that advantage, and that's why they use the compass to make up the left/right etc. (In fact, the drones do have "left" and "right" by the accelerometer/gyro, but... how should I fit that into the big picture?)

    Using GPS alone (no compass) boils down to the orientation of the drone. The drone really does not know where its nose is pointing, thus it cannot start following coordinates by math alone. This is where we are now.

    But, as mentioned, successive coordinates can be used to calculate the heading travelled (like "I went from coordinate A to B, thus my heading angle would be x degrees"). The GPS receivers usually do that themselves, so it cuts the trouble a bit. When moving, we get the heading from GPS. By combining the heading with the actual, applied drive (a control vector, see note #1 below) to the motors with the heading angle, the drone could find out its absolute nose direction.


    Note #1: A control vector - haven't yet heard of this term, but I said that because:
    A) a single 3D vector is enough of describing what's going on with the ESCs = the current physical maneuver = how much "drive" into which direction

    Addendum: A control vector is a result of doing arithmetics by vectors 1 and 2:
    1) a 3D vector describing the current attitude
    2) a 3D vector describing the current movement - it needs the actual elevation (barometer), actual coordinates (GPS) and actual nose direction (compass, if not obtaining this from the GPS).


    Post everything:
    I just realized, that all the bright ideas I got while writing this - and I will not bother mentioning them - seem to be loose ends after all. I want to fix one thing: the magnetic deviation problem. Back to the workshop. I'll demag that compass and see how it changes things. And I do have an AC powered demagnetizer, so I will NOT try a permanent magnet.
     
Loading...