Getting a little confused on gains

Hello All,

I've been tweaking my gains a bit, and I'm not understanding something correctly.

The Attitude gains will stabilize the aircraft.

The NAV gains will control how quick it turns to hit a waypoint, right?

Are the two related?  ie: if I turn one down, do I turn the other up?

I've turned down my attitude roll gains to get the plane to fly steady, but now I'm getting a pattern like this.


I assume I need to turn the nav gains up more?  The plane is flying fairly steady.


Here's my header file:


AP_2_6_header.h


Thanks!


JC

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

Join diydrones

Email me when people reply –

Replies

  • Developer


    Hi John,
    I had a look at the data. I see your plane is favoring the right. Is that caused by wind?
    On average it's about 8° off. Is your IR sensor fixed in place? You could set your ROLL_TRIM to -800 to counteract the sensor.

    The next thing I would do is increase your HEAD_MAX value to 55 and see what happens.

    Jason
  • Developer
    To calibrate the thermopiles (No Z sensor), aim the IR sensors of the plane to the ground and sky for at least 1 second each. And keep your hands/body away from them or you'll foul the reading. If so reset the AP.

    Sometimes i'll forget after I've launched. If so I do a few loops and It grabs the maximum temp difference between the sky and ground.
  • Developer
    I've been all through the code and I can't find any issues. The code output looks very symmetrical, so I can't explain why one direction is less authoritative except for a mis-mounted sensor.

    For people that don't use a Z sensor, the lack of general authority is easy to pinpoint. Basically it's an ir_max value that's too high. The only thing that could set the value really high is putting your hand over one side of the XY while the other looks at the sky. That will pump up the max value which is set for the duration of the flight.

    This is only the case when you don't use a Z sensor. The Z calibrate continuously during the flight.
  • Moderator
    I had a 2 long flights with my FPV SlowStick again this afternoon, no shield, no GPS, FMA x-y.

    The SS's dihedral angle is supposedly around 12 deg - mine is maybe 14 deg and in FBW mode and holding full left stick deflection the left wing was more or less horizontal with the ground which would make the bank angle 6-7 deg, same with banking right.

    This is absolutely fine with this plane as it keeps every turn nice & gentle, but with my other plane which flies much faster the radius of the turn circle is a little large, however as I probably won't be spending much time with that one in FBW mode it's not really a big issue but it would be nice if that angle was independently adjustable.
  • Moderator
    Hi John

    Have been following this thread with interest as although I'm using v2.6 on two planes now I'm still finding FBW authority usable, but a bit marginal.

    With HEAD_MAX at 4500 I get about a 5°-10° roll angle at full stick deflection, PITCH_MIN/MAX is 1500/-1500 and if I get a 2° pitch up or down then it's a lot.

    In STABILIZE the plane will roll 360° if required.
    lot.in
    Hier entsteht lot.in
  • Developer
    Hi John,

    I have been watching the various flights you have posted and (please take no offense) I think you have a long way to go with tuning your gains.

    My advice - go back to the beginning.

    1 - Is STABILIZE working? If you release the stick do you come back to straight and level? If not you need to get this minimum level of tuning done before anything else.

    2 - Work on the servo gains in FLY BY WIRE A mode. Know what you have set for HEAD_MAX, PITCH_MAX and PITCH_MIN. If you move the stick to the extreme right the plane should go into a bank of angle HEAD_MAX (and stay there). Does it do this? If it gets there slowly increase the roll servo P gain. If it oscillates in roll decrease the servo gain. Work on pitch in a similar manner. The goal is for the plane to respond in pitch and roll in a crisp manner to your stick inputs. Work on this without worrying about the other gains until when you flick the stick and hold it to the side the plane will respond crisply and as quickly as in manual flight. You will likely only need the P gain, but some airframes will need I gain to hold the desired bank angle well without steady state error.

    3 - Work on the pitch compensation so that if you hold a sustained HEAD_MAX bank turn you neither gain or loose altitude.

    4 - Only after you have the above well tuned, then go on to the the navigation gains. Your waypoints appear to be set with 8 to 12 houses distance between them. For that size of a task you should see the plane reach a waypoint, make a definitive turn towards the next waypoint and then proceed in a somewhat straight line. If I knew that your servo gains were good then I would tell you that your nav gains are too low, but like I said start at the beginning and proceed systematically.

    To answer your specific question - we are using a cascaded PID controller. The navigation control loop determines a desired bank angle based on where we are headed and where we want to go. The navigation gains affect this desired bank angle. For example if we are 10 degrees off course then one roll navigation P gain might produce a desired bank angle of 5 degrees, while doubling that gain would produce a desired bank angle of 10 degrees. The second control loop controls the servo to reduce the error between the desired bank angle and the actual bank angle. When I recommend tuning the servo gains in FLY BY WIRE mode it is because in that mode you are basically inputting the desired bank angle with the stick position and isolating this lower level control loop.

    Due to the cascaded nature of the control loops there is a mathematical relationship between the gains and the ultimate effect. However the whole point of using the cascaded controller is to make it intuitive and understandable for the user. Just get the servo gains right first so that the system gives you the desired roll and pitch angles, and then work on the navigation gains for optimal navigation performance. It is much simpler and effective to do it in that order.

    The parameter that you do need to pay attention to is speed. If you tune for one cruising speed and then change cruising speed significantly you may need to re-tune your gains.
  • 3D Robotics
    You might want to check out our tuning tips, which attempt to help with this.
This reply was deleted.

Activity

Neville Rodrigues liked Neville Rodrigues's profile
Jun 30
Santiago Perez liked Santiago Perez's profile
Jun 21
More…