Odd roll behavior with MatrixNav?

Hi all, I'm new here. I'm trying to get an IMU based UAV up and running to do some research into higher level mission planning. I decided to go with William Premerlani's UAV DevBoard, but I'm having some problems with the MatrixNav firmware. I'm using a Parkzone Radian powered sailplane (3 ch, no ailerons).Right now I'm running without a GPS (it died in the last crash I think), but I mainly want to verify that pitch stabilization works with our airplane. So, the only modifications I've made were to turn on pitch stabilization in all modes (auto and RTL) and skip the GPS initialization.The problem I'm noticing has to do with pitch compensation during roll. My understanding is that a small amount of up elevator is required during turns in order to maintain altitude. When testing on the ground (just holding the airplane in my hand) I can pitch the plane up and down and the elevator moves correctly to compensate. When I roll the airplane to the left (to simulate a left turn) the elevator also compensates correctly by pitching up slightly to maintain altitude. However when I roll to the right, the elevator tries to pitch down, the exact opposite of what it should be doing. This actually caused two pretty bad crashes before I realized what the problem was, oh well.Has anyone else noticed or dealt with this behavior before? any ideas or suggestions would of course be very much appreciated. Thanks!
E-mail me when people leave their comments –

You need to be a member of diydrones to add comments!

Join diydrones

Comments

  • T3
    Jordi,

    Your wish is my command....;-) Just tell me what you want, I'll work on the next version of my board this winter when the cold winds are blowing and the snow is falling, and deliver it to you in the spring.........

    Back to your question....

    There are several other ways of estimating velocity for the centrifugal acceleration calculation, with different degrees of accuracy. Depending on whether you are trying to accomplish aerobatics, or simply doing gentle turns for navigation, some of the other approaches would do just fine.

    If you do not have GPS, there are several other approaches to compensate for centrifugal acceleration. One of them, as you mention, is adding a magnetometer.

    Another approach is that, for some applications, the centrifugal acceleration is not that great so you just ignore it. For example, you could probably get away without doing the compensation for a blimp or for a VTOL during vertical takeoff.

    You could use airspeed from a dynamic pressure sensor to estimate speed over ground for the compensation. It is not as accurate as GPS, but it is good enough if its not too windy.

    Finally, you could simply use a nominal, fixed value of speed over ground as a configuration setup parameter. It would be an approximation, but it would be good enough for some applications.

    Best regards,
    Bill
  • Developer
    And uBlox Bill and uBlox. =)

    Great explanation (second time for me) thanks! I was wondering how the other IMU's with no GPS compensate the centrifugal acceleration, integrating the magnetometer?
  • T3
    Dave,

    For some calculations you need air speed, for others you need ground speed.

    It would have been nice if I had included a dynamic pressure sensor in the UAV dev board, but I figured out how to work around it by using the IMU to achieve tight pitch control. My firwmware works well enough without a dynamic pressure sensor, but if I had to do it over again, I might include one. Certainly, if I ever come out with another version of my board, I will include one.

    Bill
    domain.strategi.st
    creating new opportunities, from great ideas to digital assets
  • T3
    Dave, Kevin, and Jordi,

    It is not possible to add a dynamic pressure sensor to the UAV dev board.

    Any IMU calculation method that uses accelerometers in the calculation of attitude should compensate for centrifugal acceleration, otherwise you could get rather large errors during continuous banked turns. You might be able to get away with omitting the centrifugal acceleration cancellation if you made only brief turns, or if you made only gentle turns, but I have never tried that, so I do not know.

    However, if the turns were tight enough and/or long enough, without centrifugal compensation, the accelerometer error would gradually degrade the accuracy of the attitude estimate, and cause large pitch estimate errors during a turn. So, the best way to go is to use gyro information and GPS speed over ground to cancel acceleration effects.

    Interestingly enough, the centrifugal acceleration cancellation is best done in an inertial reference frame. You can do a nearly perfect cancellation with gyro information and GPS speed over ground. If you used air speed instead of ground speed, you would get the wrong answer. To see that is true, think about the case in which the plane is flying into the wind at an airspeed that matches the wind speed, so that the speed over ground is zero. In that case, there is zero centrifugal acceleration, which is the answer that you will get if you use GPS speed over ground. But you would get the wrong answer if you used air speed to do the calculation.

    The centrifugal acceleration cancellation is not a once-and-for-all calculation, so it cannot be done while the plane is on the ground. The centrifugal acceleration changes all over the place during flight. It is zero when the plane is flying in a straight line, and can get very large during tight turns.

    It is possible to do an approximate calculation of the centrifugal acceleration without GPS by using an assumed value of the ground speed, but I do not recommend it. It is better to use the actual value of speed over ground. Once the GPS is locked, and the plane is in the air, the GPS stays locked, and provides a continuous stream of speed over ground reports. In the unlikely event that GPS stops working in flight, you can use the last reported value of speed over ground, it will give you an approximately correct value of centrifugal acceleration.

    Best regards,
    Bill
    ...:::landscapes:::...
  • I have a question,

    Would it be possible to add a dynamic pressure sensor to the UAV dev board ?

    Does the firware calculates an estimation of the I.A.S to do the gain adjustement ?

    Best regards,

    Dave
  • Thanks for the quick response guys! very helpful.

    Bill, your explanation for the crashes makes a lot of sense, I agree that's likely what happened. Thanks for not making too much fun of my newbie piloting skills too, haha. If anyone else wants to see the videos they are here, but be nice ;) https://www.youtube.com/user/keegreil

    I should be able to run the roll-pitch-yaw demo on Monday and hopefully be up and flying the next calm day we get, assuming the GPS is actually working and I was just being impatient with it.

    Oh and thanks for explaining your algorithm, I didn't realize that the stabilization was dependent on the GPS too and not just the navigation. I guess that explains why the airplane is confused now. Out of curiosity, is this a necessary part of the DCM algorithm? If we didn't have a GPS, couldn't we assume that during initialization the ground speed is zero? While over time I can understand if the gyros would drift too much, but for a brief flight of a couple minutes is this possible?
    Best,

    Kevin
  • Developer
    You are welcome! Puff not even close with the diagnosis. So if i want to make an IMU with no GPS using your code, I'm dead?
  • T3
    Kevin,

    I just remembered, stabilization will not work right without the GPS. That is one of the reasons that I make GPS lock a necessary step during the initialization. (The other reason is that I record the GPS coordinates of the launch point.)

    The accelerometer signals are corrected for centrifugal acceleration. To do that, you need to know the rotation rate (from the gyros) and the ground speed, which comes from GPS.

    So, without a GPS, stabilization would not operate properly, there would be attitude estimation errors because centrifugal acceleration compensation would be wrong, although this would not explain the odd roll behaviour. I will come back to that. However, it may explain your subsequent crashes.

    Interestingly enough, I think that it is ok for the GPS to fail once the plane is flying, because then the calculations will use the last recorded speed over ground, which will be accurate enough.

    However, if you do not have GPS at any time during the flight, the speed over ground will be completely wrong. (It will be either zero, or a random number, I don't remember which.)

    I think this is what happened:

    1. During your first flight, RTL and stabilization were working fine, but a combination of winds, low altitude, and RTLKICK were the primary causes of your crash. Plus, you probably didn't have a chance to fine-tune the control gains for your plane yet.

    2. Your subsequent crashes may have been caused by not having a GPS. It is needed for stabilization to work.

    3. The odd roll behavior that you saw after your last flight was probably caused either by your changes to the initialization routines, or by not waiting for 10 seconds for the IMU to self-zero.

    So, what I suggest you do next is to test the board with the roll-pitch-yaw demo.

    After that, we will have to get your GPS working. I will think about that and get back to you. Most likely there is simply a problem with the cable, so it may be that all you need to get going again is a new GPS cable.

    Once you get going again, set RTLKICK to zero, and wait for calmer weather to fine tune your gains. Its great to use stabilized mode for your take-off and climbout, but wait until you get everything working smoothly before you try out the return-to-launch function.

    Best regards,
    Bill
    Index of /
  • T3
    Kevin,
    There is something you can do to help me diagnose the problem. Can you send me the file(s) that you changed to skip the GPS initialization?
    Bill
  • T3
    Kevin,

    I feel horrible about your crash. Sorry. I will help you figure out what happened. At this point, you should not try to fly it again, until we figure it out.

    By the way, depending on what changes you made to the firmware to skip GPS initialization, you might have defeated the gyro/accelerometer zeroing, which would create exactly the symptoms that you saw with the elevator.

    Bill



    There is something
This reply was deleted.