{"action":"created","issue":{"url":"https://api.github.com/repos/cleanflight/cleanflight/issues/1019","labels_url":"https://api.github.com/repos/cleanflight/cleanflight/issues/1019/labels{/name}","comments_url":"https://api.github.com/repos/cleanflight/cleanflight/issues/1019/comments","events_url":"https://api.github.com/repos/cleanflight/cleanflight/issues/1019/events","html_url":"https://github.com/cleanflight/cleanflight/issues/1019","id":88803904,"number":1019,"title":"small YAW movement erratic when compass on","user":{"login":"arachnida","id":8112052,"avatar_url":"https://avatars.githubusercontent.com/u/8112052?v=3","gravatar_id":"","url":"https://api.github.com/users/arachnida","html_url":"https://github.com/arachnida","followers_url":"https://api.github.com/users/arachnida/followers","following_url":"https://api.github.com/users/arachnida/following{/other_user}","gists_url":"https://api.github.com/users/arachnida/gists{/gist_id}","starred_url":"https://api.github.com/users/arachnida/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/arachnida/subscriptions","organizations_url":"https://api.github.com/users/arachnida/orgs","repos_url":"https://api.github.com/users/arachnida/repos","events_url":"https://api.github.com/users/arachnida/events{/privacy}","received_events_url":"https://api.github.com/users/arachnida/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-06-16T18:30:59Z","updated_at":"2015-06-16T18:35:06Z","closed_at":null,"body":"When using Harakiri PID and MAG is on small movements of YAW are not held, like there is some deadband active. If the YAW stick is pushed a bit further the YAW movement jumps and this new heading is stored in magHold. YAW_Deadband=0 in my test. When the jump occurs I can see in the logs that rcCommand(YAW) jumps from a low value like 30 to exact 70. (see pics) This value was found by Boris in line 437 of mw.c acting as some kind of filter.\r\n\r\n436     if (ABS(rcCommand[YAW]) < 70 && FLIGHT_MODE(MAG_MODE)) { \r\n437         int16_t dif = heading - magHold; \r\n438         if (dif <= -180) \r\n439             dif += 360; \r\n440         if (dif >= +180) \r\n441             dif -= 360; \r\n442         dif *= -masterConfig.yaw_control_direction; \r\n443         if (STATE(SMALL_ANGLE)) \r\n444             rcCommand[YAW] -= dif * currentProfile->pidProfile.P8[PIDMAG] / 30;    // 18 deg \r\n445     } else \r\n446         magHold = heading; \r\n\r\nThis erratic behaviour can best be seen when you have a high YAW rate. When wanting to do a small YAW movement the original heading is returned when I release the YAW stick.\r\n\r\n![ls 8057](https://cloud.githubusercontent.com/assets/8112052/8190969/1e7934dc-1466-11e5-8097-35fa68a0d185.jpg)\r\n![ls 8058](https://cloud.githubusercontent.com/assets/8112052/8190973/23e5b184-1466-11e5-9872-82053d8f0e77.jpg)\r\nAlso see https://www.youtube.com/watch?v=hn6pF2bxMMg at 0:04 and 0:24, at 0:17 I didn't push my stick so far and the copter turns it's nose back to the original heading when I center my stick. "},"comment":{"url":"https://api.github.com/repos/cleanflight/cleanflight/issues/comments/112523222","html_url":"https://github.com/cleanflight/cleanflight/issues/1019#issuecomment-112523222","issue_url":"https://api.github.com/repos/cleanflight/cleanflight/issues/1019","id":112523222,"user":{"login":"arachnida","id":8112052,"avatar_url":"https://avatars.githubusercontent.com/u/8112052?v=3","gravatar_id":"","url":"https://api.github.com/users/arachnida","html_url":"https://github.com/arachnida","followers_url":"https://api.github.com/users/arachnida/followers","following_url":"https://api.github.com/users/arachnida/following{/other_user}","gists_url":"https://api.github.com/users/arachnida/gists{/gist_id}","starred_url":"https://api.github.com/users/arachnida/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/arachnida/subscriptions","organizations_url":"https://api.github.com/users/arachnida/orgs","repos_url":"https://api.github.com/users/arachnida/repos","events_url":"https://api.github.com/users/arachnida/events{/privacy}","received_events_url":"https://api.github.com/users/arachnida/received_events","type":"User","site_admin":false},"created_at":"2015-06-16T18:35:06Z","updated_at":"2015-06-16T18:35:06Z","body":"Boris compiled me version where he substituted the value 70 in line 436 by 15, this seems to be a good solution as the erratic jumping is gone. But why is this line in the code as we also have YAW_deadband?"}}