iNavFlight / inav

INAV: Navigation-enabled flight control software
https://inavflight.github.io
GNU General Public License v3.0
3.09k stars 1.46k forks source link

roll rate in angle mode #4627

Closed MartinHugh closed 5 years ago

MartinHugh commented 5 years ago

I have recently set up a 1m fixed wing with an F411-Wing and iNav 2.1

I have trimmed it out and completed servo AutoTrim and Autotune procedures. However when I bank hard (I am intentionally limited to 60 degrees) the aircraft is very sluggish to start rolling.

Can you please advise where I start in order to rectify this. Can I simply override a default rate setting, or do I need to tune PIDs ?

shellixyz commented 5 years ago

Bank rate is limited by the set roll_rate and is calculated like this: roll_rate = angle_error * fw_p_level. So if your roll rate is set correctly and you still have too slow bank rate increase fw_p_level. The default should be enough though, it is already too high for fixed wing aircrafts IMO.

MartinHugh commented 5 years ago

Thank you @shellixyz, I will look into that.

MartinHugh commented 5 years ago

I see that fw_p_level is the default of 20 on my setup.

Is there any way I can change this via the OSD menu rather than have to drop into a CLI at the flying field ?

Also I think the roll rate feels fine in manual, I note there is a difference between these two values, can anything be inferred from this 👍

get roll_rate

roll_rate = 28 Allowed range: 6 - 180

manual_roll_rate = 100 Allowed range: 0 - 100

shellixyz commented 5 years ago

~Yes you can change it from the OSD menu.~ EDIT: present in the code but not enabled

roll_rate is for all the modes but manual. 28 = 280°/s should be fine manual_roll_rate = roll max servo travel % in manual mode

MartinHugh commented 5 years ago

I cannot see anything in the OSD menu which correlates with fw_p_level (20 (200 degrees/s)) Which setting is it ? Thanks.

Jetrell commented 5 years ago

Bank rate is limited by the set roll_rate and is calculated like this: roll_rate = angle_error * fw_p_level. So if your roll rate is set correctly and you still have too slow bank rate increase fw_p_level. The default should be enough though, it is already too high for fixed wing aircrafts IMO.

@shellixyz Can you give Martin and myself, your impression of how reactive to stick input, ANGLE mode should be, with e.g roll rate 35deg and pitch rateset to 60deg and thefw_p_level set to 25 ?

The reason I ask... Is because I too have had issues with the F411-wing in conventional air frames. i.e. Standard or V-tails. When it comes to getting the ANGLE mode to react to stick movement in a smooth or even some what linear manor.

I have gone through the settings you have stated, from the Wiki, many times. And can not get ANGLE mode to feel even half confidence inspiring, to fly with. It requires almost full stick to get either pitch or roll to start to react; and even then its very sluggish. So I just gave up on it with the F411-Wing in those type of air frames and have stuck with HORIZON mode. Which has stacks of authority.

As a side note. 3CRS also lacks the same authority as ANGLE mode does. Yet the RTH auto navigation control has heaps of authority(from observation). Can I assume it uses the same setting as ANGLE and 3CRS?

Here are my relevant F411-Wing setting on a Nano Talon

set fw_p_level = 24
set fw_i_level = 4
set fw_d_level = 62
set max_angle_inclination_rll = 480
set max_angle_inclination_pit = 380
set fw_iterm_limit_stick_position =  0.300
set yaw_p_limit = 275
set nav_fw_pos_z_p = 41
set nav_fw_pos_z_i = 6
set nav_fw_pos_xy_p = 77
set nav_fw_pos_xy_i = 4
set nav_fw_pos_xy_d = 7
set tpa_rate = 40
set tpa_breakpoint = 1600
set fw_tpa_time_constant = 1000
set roll_rate = 34
set pitch_rate = 16
set yaw_rate = 8
set manual_rc_expo = 36
set manual_rc_yaw_expo = 0
set manual_roll_rate = 95
set manual_pitch_rate = 90
set manual_yaw_rate = 80
MartinHugh commented 5 years ago

@Jetrell thanks for your comments on this.

@shellixyz, sorry if my question about the OSD is confusing. the roll_rate setting is not the "roll_rate", because that is a live calculation based or error and fw_p_level. I think the roll_rate setting is in fact the MAXIMUM roll_rate permitted. I do not wish to change that at the field particularly, I need to change the underlying fw_p_level. Is that possible from the menu/OSD ?. Thanks.

shellixyz commented 5 years ago

@MartinHugh @Jetrell

I cannot see anything in the OSD menu which correlates with fw_p_level (20 (200 degrees/s)) Which setting is it ? Thanks.

~It should be in the PID TUNING submenu. In OTHER PP, the ANGLE STR setting (angle strength)~

EDIT: present in the code but not enabled

Can you give Martin and myself, your impression of how reactive to stick input, ANGLE mode should be, with e.g roll rate 35deg and pitch rate set to 60deg and the fw_p_level set to 25 ?

It should be very reactive. Even too reactive with fw_p_level set at 25, meaning that it would most likely induce oscillations. At least if your pitch/roll PIDs are set correctly.

As a side note. 3CRS also lacks the same authority as ANGLE mode does

That's very strange at least for roll because for roll 3CRS IS angle mode as soon as you move the roll stick.

@Jetrell

set fw_i_level = 4

You lowered that from the default 5. It is not what you want if you want to increase reactivity of angle. fw_i_level is angle mode's low-pass filter cut-off. The lower this is the slower it will be to react.

Are your planes flying like you want in acro/rate mode ?

MartinHugh commented 5 years ago

Thanks for your response @shellixyz

I currently only have angle mode (and manual) setup, so cannot confirm anything about other flight modes. There is definitely something not right the roll rate in angle mode, but I will try increasing the fw_p_level next time I am at the field.

MartinHugh commented 5 years ago

@shellixyz, sorry if I am being thick and missing something obvious here, but in the PID TUNING menu, there is no "OTHER PP" submenu. The closest is a "FILTER PP" submenu.

What am I missing ?

Jetrell commented 5 years ago

@shellixyz These are the PI and FF gains on that same Nano Talon. It is the one that has the least stick authority in ANGLE mode.

set fw_p_pitch = 42
set fw_i_pitch = 32
set fw_ff_pitch = 12
set fw_p_roll = 23
set fw_i_roll = 26
set fw_ff_roll = 3
set fw_p_yaw = 0
set fw_i_yaw = 0
set fw_ff_yaw = 0

These Feed Forward settings may seem strange to you. But increasing the P gain and lower the FF was the only thing that would stop control oscillations on the PITCH and ROLL axis's, in the wind or at any speed. This little plane was a nightmare to set up and get right. It now fly's very well with these setting, with NO YAW stabilization at all. Just YAW manual control. I literally spent days tuning this air craft. And nearly crashed it heaps of time throughout the tuning process. It now handles speeds of up to 135kph and 20+Kph winds with no handling issues. (flat wing mod). Now its only issue, is its lack of stick authority to ANGLE bases flight modes. Yet as I said earlier... It reacts very fast (from DVR observation) when under RTH of Pos_holdauto navigation control.

@shellixyz _You lowered that from the default 5. It is not what you want if you want to increase reactivity of angle. fw_i_level is angle mode's low-pass filter cut-off. The lower this is the slower it will be to react.

Are your planes flying like you want in acro/rate mode ?

I lowered the fw_i_level because it seemed to be fighting a little in POS_HOLD mode. Yes. In acro/air modes it performs very well. As they do in Horizon mode.

Here is a full settings dump of the Nano Talon - Nano Talon F411-Wing (2.1 Full version)Diff all.zip

Maybe something stands out to you Michel.

I get the impression that the issue Martin and I are having. Is something to do with F411_Wing. But I can see how! I have not had these problems with other FC's. But I also don't have another FC in a Nano Talon either. I would like to know the percentage of people that are using the Matek F411_Wing in flying wings, compared to conventional tail or V-tail aircraft.

@MartinHugh What air frame are you using?

shellixyz commented 5 years ago

@MartinHugh Yeah sorry I only checked the code. The submenu is there but has never been enabled for a reason unknown to me. Something we could enable in the next release. You have to use the RC adjustments or the configurator for now to change fw_p_level.

shellixyz commented 5 years ago

@Jetrell Indeed these settings for FF seem very low. Usually FF should be higher or close to P. The idea is that FF is like the "manual term". In acro you input a command that's mapped to a rate between 0 and the max rate you set and that's directly translated to an elevon/aileron/elevator deflection according to the FF setting. If FF is set correctly and your plane is trimmed it should fly well in calm conditions with P and I set to 0. P and I are mainly there to stabilize the plane against external influence (wind) and to correct for small errors in the other tuning parameters (FF, TPA, ...).

I lowered the fw_i_level because it seemed to be fighting a little in POS_HOLD mode.

fw_i_level is not the right parameter to tune for PH.

You should only change settings directly related to the mode you're tuning.

The flight modes are built on top of each other so you should tune the foundations first. The pyramid is build like this: manual < acro < angle < alt hold < nav modes (controlling position). So first you need to make sure your plane is set up like you want and is flying as expected in manual mode (mainly setting the throw and trimming the control surfaces). Then you can start tuning acro with fw_{p,i,d}_{pitch,roll,yaw} and {roll,pitch,yaw}_rate. Once it feels good in acro you can start tuning angle with fw_{p,i}_level. But never go back and tune the acro settings to solve issues in angle. Same thing for the other modes. Horizon mode is a mix between angle and acro so if you tuned both acro and angle like you want it should fly good in horizon. Once you tuned angle you can start tuning alt hold with nav_fw_pos_z_{p,i,d}. But never change angle/acro settings for tuning alt hold. Then you can tune the position controller used for PH, RTH, CRUISE with nav_fw_pos_xy_{p,i,d} but I never found that to be needed.

Did you follow the INAV PIFF controller tuning guide on the wiki ?

Personally I'm using between 14 and 16 for fw_p_level and all my planes are very reactive in angle mode.

I don't see anything special in you diff besides the mentioned low FF factors for pitch and roll. Also the asymmetrical settings for the servo throws but that's not the cause of your issues.

I get the impression that the issue Martin and I are having. Is something to do with F411_Wing

The F411-Wing is most likely not the issue unless you have a defective gyro/acc but that would be surprising. Most likely a setup issue.

I'm using a F411-Wing FC in my Mini AR wing. Nothing to complain about it is working like any other FC for me.

Here is the profile diff or my Mini AR so that you have something to compare to. Notice the much lower P compared to FF and also the reduced fw_p_level.

set fw_p_pitch = 26
set fw_i_pitch = 24
set fw_ff_pitch = 92
set fw_p_roll = 28
set fw_i_roll = 20
set fw_ff_roll = 46
set fw_p_level = 14
set max_angle_inclination_rll = 600
set max_angle_inclination_pit = 600
set tpa_rate = 33
set fw_tpa_time_constant = 600
set rc_expo = 30
set roll_rate = 30
set pitch_rate = 15
set manual_rc_expo = 30
Jetrell commented 5 years ago

Thank you for the in depth reply Michel. Its always good to get extra info.

The answer to your above question -

I have followed the Wiki tuning guide and have tuned many planes before as well. But the Nano Talon/ F411-Wing combo, is a BIG exception.

Like you stated on the servo setup throws. Especially on the V-tail. The Nano Talon causes some strange effects with its mechanical couplings and the V-tail mix itself. These odd looking figures, are what it took to get the Rudder and Elevator throws perfectly centered and giving equal up and down travel. (mechanical linkages are centered) It was also why I had to get rid of YAW stabilization. This plane would never fly straight. Even in 3D Cruise. It was a strange YAW / ROLL coupling effect that was taking place. After all.. V-tail Yaw does cause some Roll as well. The gyro would sense that the ROLL axis needed correction after a YAW axis correction. This would cause slow IMU drift, and make the plane fly around in large circles and never fly straight, in any stabilization mode. I was at the end of my tolerance with this plane, before I turned off YAW stabilization. And that made all the difference.

It would take too long to explain the way this plane reacted to normal P and FF on the Roll and Pitch axis. I have never encountered anything like it; even on my XUAV mini Talon. But I'm not sure if the F411_Wing is also causing some issues...Or any offset of the IMU chip, to the plane central axis points, may have some effect.. Auto tune was all but useless and it just got confused. It lowered the roll P gain to 2. This just prevented it from stabilizing the Roll axis at all. But my current PIFF settings do work well....which I know seems odd! Because they are more like a PID tune. But that is what was needed to allow P to provide stabilization, and to stop FF over doing it. I think it stems from the Nano talons extremely small tail moment and very reactive rudder,

I will load up some of your diff settings and see if it makes any difference. Although. I haven't had any problem with Flying Wings. ANGLE mode seems responsive with them. Thanks again for your time @shellixyz

@MartinHugh Martin. I didn't mean to hi-jack your post. I hope you have been able to pick up some things from this, that will help you.

MartinHugh commented 5 years ago

@Jetrell the airframe I am using is a Flying Wings Falcon Evo. It is about 1m span, flying wing.

Not sure where to go next apart from increasing fw_p_level. I will set it from 20 to 23 and try that, although @shellixyz is suggestion this is likely to be approaching oscillation - so will try it and see. If anyone can spot anything, I will paste in my diff. Would appreciate it if there are any "sore thumbs" sticking out in this

diff

# version
# INAV/MATEKF411 2.1.0 Feb 25 2019 / 17:02:49 (65b0ec142)
# GCC-7.3.1 20180622 (release) [ARM/embedded-7-branch revision 261907]

# resources

# mixer
mmix 0  1.000  0.000  0.000  0.000

# servo mix
smix 0 3 0 50 0
smix 1 3 1 50 0
smix 2 4 0 -50 0
smix 3 4 1 50 0

# servo
servo 3 1000 2000 1518 -100
servo 4 1000 2000 1536 100

# feature
feature MOTOR_STOP
feature GPS
feature LED_STRIP
feature PWM_OUTPUT_ENABLE

# beeper

# map
map TAER

# serial
serial 20 1 115200 115200 0 115200
serial 1 2 115200 115200 0 115200

# led
led 0 2,15::AT:1
led 1 3,15::G:1
led 2 4,15::G:1
led 3 5,15::AT:1
led 4 10,15::CT:10
led 5 11,15::CT:10
led 6 12,15::CT:10
led 7 13,15::CT:10
led 8 6,6::CT:10
led 9 7,6::CT:10
led 10 8,6::CT:10
led 11 9,6::CT:10

# color

# mode_color
mode_color 6 0 0
mode_color 6 1 2

# aux
aux 0 0 0 1300 2100
aux 1 1 1 900 1275
aux 2 1 2 900 1300
aux 3 3 1 1300 1700
aux 4 3 2 900 1300
aux 5 9 1 1300 1700
aux 6 9 2 900 1300
aux 7 8 2 1725 2100
aux 8 10 2 1300 1700
aux 9 27 4 900 1225
aux 10 28 4 1800 2100
aux 11 11 3 1300 2100

# adjrange

# rxrange

# temp_sensor

# osd_layout
osd_layout 0 0 13 1 V
osd_layout 0 1 23 1 V
osd_layout 0 2 0 0 V
osd_layout 0 7 13 0 V
osd_layout 0 9 1 2 H
osd_layout 0 11 23 0 V
osd_layout 0 12 17 1 V
osd_layout 0 13 1 7 V
osd_layout 0 14 8 1 V
osd_layout 0 15 24 7 V
osd_layout 0 20 20 13 V
osd_layout 0 21 1 13 V
osd_layout 0 22 14 11 V
osd_layout 0 23 15 14 V
osd_layout 0 28 7 14 V
osd_layout 0 30 1 3 V
osd_layout 0 31 2 1 V
osd_layout 0 33 2 0 V
osd_layout 0 34 11 12 V
osd_layout 0 38 26 3 H
osd_layout 0 40 21 14 V
osd_layout 0 41 24 10 H
osd_layout 0 42 24 9 H
osd_layout 0 45 0 0 V
osd_layout 0 86 10 14 H
osd_layout 0 87 0 11 H

# master
set gyro_hardware_lpf = 256HZ
set gyro_lpf_hz = 40
set acc_hardware = MPU6000
set acczero_x = 103
set acczero_y = -43
set acczero_z = -276
set accgain_x = 4099
set accgain_y = 4097
set accgain_z = 4028
set mag_hardware = NONE
set baro_hardware = BMP280
set pitot_hardware = NONE
set rssi_channel = 10
set min_throttle = 1149
set max_throttle = 1900
set failsafe_delay = 0
set failsafe_off_delay = 0
set failsafe_procedure = RTH
set align_board_roll = -3
set align_board_pitch = 64
set platform_type = AIRPLANE
set model_preview_type = 8
set 3d_deadband_low = 1425
set 3d_neutral = 1475
set small_angle = 180
set gps_provider = UBLOX7
set gps_sbas_mode = EGNOS
set nav_rth_allow_landing = NEVER
set nav_rth_alt_mode = FIXED
set nav_rth_altitude = 7620
set nav_fw_max_thr = 1750
set nav_fw_bank_angle = 50
set nav_fw_loiter_radius = 10000
set ledstrip_visual_beeper = ON
set osd_units = UK
set osd_crosshairs_style = AIRCRAFT
set mode_range_logic_operator = AND

# profile
profile 1

set fw_p_pitch = 6
set fw_i_pitch = 10
set fw_ff_pitch = 52
set fw_p_roll = 6
set fw_i_roll = 8
set fw_ff_roll = 49
set max_angle_inclination_rll = 600
set max_angle_inclination_pit = 600
set tpa_rate = 20
set tpa_breakpoint = 1600
set roll_rate = 28
set pitch_rate = 14

# battery_profile
battery_profile 1

set vbat_min_cell_voltage = 320
set vbat_warning_cell_voltage = 330
set battery_capacity = 4000
set battery_capacity_warning = 1400
set battery_capacity_critical = 1000

# 
DzikuVx commented 5 years ago

Since I do not see anything that we should change in the firmware over here, I'm closing this one and you can continue discussion in a closed ticket if you really want. Thanks

MartinHugh commented 5 years ago

@DzikuVx I was not asking for a firmware change. I was not reporting a bug. I am asking for help setting up iNav. I have followed all the documented procedures.

The advice I have so far from this thread is to change fw_p_level, but with the rider that that is probably not going to help since it is way to high for fixed wings at its default anyway.

I dont see how closing the ticket resolves anything apart from hiding things you dont want to read.

The thread was hijacked by another iNav user with a similar fault, and you closed the thread before anyone had even had a chance to respond to my diff.

If there is a preferred way of obtaining "support" which has nothing to do with feature requests or bug fixes, could you please advise what it is.

Jetrell commented 5 years ago

@MartinHugh I'm sorry about that. It was not my intent to get in your way. I thought that the issue we are both having may have been related and adding more information may have gotten to the bottom of the problem. May be @DzikuVx read your question wrong and closed it for that reason. I had a look through your diff settings. And it looks fine to me. Just like mine seems fine as well.

The advice @shellixyz gave us, works for most cases. While in our cases. There appears to be something else affecting it as well.

MartinHugh commented 5 years ago

@Jetrell no problem, there was a point after your first post when I thought it was helping to focus the problem, but I think after the second, long post it had actually diluted my problem :). Apart from yourself, I was unable to get an opinion on my diff before the thread was shut down. Perhaps I should have posted the diff first.

Anyway no problem from my end - except that is for over zealous admins closing things off before they have concluded.

I have changed my fw_p_level from 20 to 23 and will see how that changes things.

I hope you get yours sorted too, and would be interested to hear how you get on. Good luck with it and thanks for your input anyway.

Jetrell commented 5 years ago

@MartinHugh Write back here after you test fw_p_level at 23. I'll be interested to hear your results.

shellixyz commented 5 years ago

The thread isn't really shut down. GH issues are meant to track bugs and feature requests. If we end up finding a bug or decide something needs to be improved we can reopen it. The thing is that angle mode is very very simple and up to now all the issues that have been brought up on the subject have all been setup issues. Again angle is very simple it just looks for the error between the target angle given by the roll/pitch channels of the receiver and the actual attitude of the wing. Then the error is multiplied by fw_p_level to get the requested angular rate to correct. So unless there is a bug which is unlikely the issue can only be two things: bad attitude estimation or badly setup rate controllers.

@MartinHugh I did take a look at your diff but there isn't much to gain from me looking at it. PIFF settings will be widely different between aircrafts. Only you are able to know if the settings are correct or not. Angle mode only relies on the rate controller setup and fw_p_level. To me if your rate controllers are setup correctly the aircraft should be very reactive in angle with the default fw_p_level of 20. As I said for me and the very varied types of wing/planes I tested iNav on it has always even been too much. Causing very sharp movements and some bounce back if not moving the sticks smoothly.

MartinHugh commented 5 years ago

@shellixyz thank you for replying.

I hope to fly tomorrow and have set fw_p_level to 23 to see how it changes things. I will report back any relevant info.

MartinHugh commented 5 years ago

I can report that flying with fw_p_level to 23 rather than 20, did give some improvement, but it is still not where I would like this. It is much better if I feed in full deflection on the stick (i.e. it flies a bit like there is a huge chunk of expo applied to the channel)

Note that there is no sign of any perceptible "proportional" based oscillation, so I think I am safe to crank it up another 3 or 4 points.

shellixyz commented 5 years ago

Crank it as high as you need to. You can switch back to acro or manual if you start to get oscillations anyway. A good way to test/adjust fw_p_level is through RC adjustments

MartinHugh commented 5 years ago

@shellixyz, thank you, and noted, will carry on tweaking this setting and see where I get to.