diff options
author | Lorenz Meier <lm@inf.ethz.ch> | 2012-10-30 17:38:26 +0100 |
---|---|---|
committer | Lorenz Meier <lm@inf.ethz.ch> | 2012-10-30 17:38:26 +0100 |
commit | 12e1cf3710fa5e9b9b5dd7e0d55e952af9a473fb (patch) | |
tree | 733483bf7ce265aa893b89f89872dba3d1d58a7b /apps/multirotor_att_control/multirotor_att_control_main.c | |
parent | ab63a77edf78a198117757a1d5e2dbe34cde1263 (diff) | |
download | px4-firmware-12e1cf3710fa5e9b9b5dd7e0d55e952af9a473fb.tar.gz px4-firmware-12e1cf3710fa5e9b9b5dd7e0d55e952af9a473fb.tar.bz2 px4-firmware-12e1cf3710fa5e9b9b5dd7e0d55e952af9a473fb.zip |
Fixed error term calculation for yaw position
Diffstat (limited to 'apps/multirotor_att_control/multirotor_att_control_main.c')
-rw-r--r-- | apps/multirotor_att_control/multirotor_att_control_main.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/apps/multirotor_att_control/multirotor_att_control_main.c b/apps/multirotor_att_control/multirotor_att_control_main.c index 3466f9842..f2ef13e90 100644 --- a/apps/multirotor_att_control/multirotor_att_control_main.c +++ b/apps/multirotor_att_control/multirotor_att_control_main.c @@ -140,6 +140,7 @@ mc_thread_main(int argc, char *argv[]) bool flag_control_manual_enabled = false; bool flag_control_attitude_enabled = false; bool flag_system_armed = false; + bool man_yaw_zero_once = false; while (!thread_should_exit) { @@ -212,14 +213,20 @@ mc_thread_main(int argc, char *argv[]) state.flag_control_manual_enabled != flag_control_manual_enabled || state.flag_system_armed != flag_system_armed) { att_sp.yaw_body = att.yaw; + man_yaw_zero_once = false; } att_sp.roll_body = manual.roll; att_sp.pitch_body = manual.pitch; + + if ((manual.yaw > -0.1f || 0.1f > manual.yaw)) { + man_yaw_zero_once = true; + } + /* only move setpoint if manual input is != 0 */ // XXX turn into param - if (manual.yaw < -0.01f || 0.01f < manual.yaw) { - att_sp.yaw_body = att_sp.yaw_body + manual.yaw * 0.01f; + if ((manual.yaw < -0.01f || 0.01f < manual.yaw) && man_yaw_zero_once) { + att_sp.yaw_body = att_sp.yaw_body + manual.yaw * 0.0025f; } att_sp.thrust = manual.throttle; att_sp.timestamp = hrt_absolute_time(); |