{"action":"created","issue":{"url":"https://api.github.com/repos/TauLabs/TauLabs/issues/1765","labels_url":"https://api.github.com/repos/TauLabs/TauLabs/issues/1765/labels{/name}","comments_url":"https://api.github.com/repos/TauLabs/TauLabs/issues/1765/comments","events_url":"https://api.github.com/repos/TauLabs/TauLabs/issues/1765/events","html_url":"https://github.com/TauLabs/TauLabs/pull/1765","id":98616396,"number":1765,"title":"[WIP] flight/stabilization: enhancement of the gyro LPF functionality","user":{"login":"Trex4Git","id":9142182,"avatar_url":"https://avatars.githubusercontent.com/u/9142182?v=3","gravatar_id":"","url":"https://api.github.com/users/Trex4Git","html_url":"https://github.com/Trex4Git","followers_url":"https://api.github.com/users/Trex4Git/followers","following_url":"https://api.github.com/users/Trex4Git/following{/other_user}","gists_url":"https://api.github.com/users/Trex4Git/gists{/gist_id}","starred_url":"https://api.github.com/users/Trex4Git/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Trex4Git/subscriptions","organizations_url":"https://api.github.com/users/Trex4Git/orgs","repos_url":"https://api.github.com/users/Trex4Git/repos","events_url":"https://api.github.com/users/Trex4Git/events{/privacy}","received_events_url":"https://api.github.com/users/Trex4Git/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":22,"created_at":"2015-08-02T15:15:46Z","updated_at":"2015-08-13T17:42:12Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/TauLabs/TauLabs/pulls/1765","html_url":"https://github.com/TauLabs/TauLabs/pull/1765","diff_url":"https://github.com/TauLabs/TauLabs/pull/1765.diff","patch_url":"https://github.com/TauLabs/TauLabs/pull/1765.patch"},"body":"I noticed that the current gyro LPF in stabilization.c uses a constant fake delta Time (https://github.com/TauLabs/TauLabs/blob/next/flight/Modules/Stabilization/stabilization.c#L941-L950). From the comments it seems this was done because of jitter in the real dT, and different control rates at that time were 300Hz & 475Hz. \r\nCurrently on many targets 500Hz is default rate, Quanton has 666Hz, and 1kHz and above is also possible on some targets.\r\nAnd there is also work on higher rates.\r\n\r\nHere are some results of the LPF magnitude response with 2kHz, 1kHz and 500Hz rate:\r\n![taulabs_gyro_filter](https://cloud.githubusercontent.com/assets/9142182/8889618/fe47d4da-32e1-11e5-8610-d5896567b784.png) \r\n\r\nBut i think that the principal behavior (cut off frequency) of the LPF should not change with the control loop rate. It should be adjusted depending of the noise in the UAV.\r\n\r\nSo i started with some initial work as a base for further discussion.\r\n\r\nThats what i have done so far:\r\n- changed the calculation of the LPF coefficients, so that 1/settings.GyroTau is now equal to the cut off frequency of the filter\r\n - I think it would be easier to understand the functionality if we rename the Parameter in the UAVObject from GyroTau to GyroFcut. But for the first steps i didn't want to change to much, that might be not used later.\r\n- using the real dT for the gyro LPF, otherwise the behavior (cut off frequency) is changed when rate of the control loop (e.g. MPU rate) is changed\r\n - in the comments at the source code it was said that using a constant fakeDt was because of jitter. I don't know how big this problem is. For first implementation i used the real(dynamic) dT. Is this really problematic?\r\n - when we really need a dT without any jitter, than it would be good to provide the information of the desired gyro sampling rate from the gyro driver (e.g. MPU6000/9250) to the stabilization module\r\n- changed the default value of GyroTau in a way, that the LPF behaves for all rates now like the old default settings with 500Hz MPU rate (51Hz cut off)\r\n"},"comment":{"url":"https://api.github.com/repos/TauLabs/TauLabs/issues/comments/130775913","html_url":"https://github.com/TauLabs/TauLabs/pull/1765#issuecomment-130775913","issue_url":"https://api.github.com/repos/TauLabs/TauLabs/issues/1765","id":130775913,"user":{"login":"Trex4Git","id":9142182,"avatar_url":"https://avatars.githubusercontent.com/u/9142182?v=3","gravatar_id":"","url":"https://api.github.com/users/Trex4Git","html_url":"https://github.com/Trex4Git","followers_url":"https://api.github.com/users/Trex4Git/followers","following_url":"https://api.github.com/users/Trex4Git/following{/other_user}","gists_url":"https://api.github.com/users/Trex4Git/gists{/gist_id}","starred_url":"https://api.github.com/users/Trex4Git/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Trex4Git/subscriptions","organizations_url":"https://api.github.com/users/Trex4Git/orgs","repos_url":"https://api.github.com/users/Trex4Git/repos","events_url":"https://api.github.com/users/Trex4Git/events{/privacy}","received_events_url":"https://api.github.com/users/Trex4Git/received_events","type":"User","site_admin":false},"created_at":"2015-08-13T17:42:12Z","updated_at":"2015-08-13T17:42:12Z","body":"@mlyle regarding the min value for the gyro cutoff frequency.\r\nI also think there is no need for really low cutoff frequencies as written already above.\r\n\r\nBut maybe there are some use cases that i don't think about at the moment.\r\nSo with the current implementation you can disable it with setting to 0, otherwise the user can choose what he wants.\r\nOtherwise i think maybe 1.0Hz should be the lower limit, so that value of 0.xxx would disable it."}}