diff options
author | Lorenz Meier <lm@inf.ethz.ch> | 2012-10-17 18:26:56 +0200 |
---|---|---|
committer | Lorenz Meier <lm@inf.ethz.ch> | 2012-10-17 18:26:56 +0200 |
commit | 2d631fb0059cecdc429c5847e8dbede82348d129 (patch) | |
tree | ab1bb88f6d35af5cd943ea6ea740674418068712 /apps/multirotor_att_control/multirotor_attitude_control.c | |
parent | e4645c0a411b62ebe58c14639f5259e6a444178d (diff) | |
download | px4-firmware-2d631fb0059cecdc429c5847e8dbede82348d129.tar.gz px4-firmware-2d631fb0059cecdc429c5847e8dbede82348d129.tar.bz2 px4-firmware-2d631fb0059cecdc429c5847e8dbede82348d129.zip |
Various fixes to attitude control, flyable, needs parameter tuning
Diffstat (limited to 'apps/multirotor_att_control/multirotor_attitude_control.c')
-rw-r--r-- | apps/multirotor_att_control/multirotor_attitude_control.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/apps/multirotor_att_control/multirotor_attitude_control.c b/apps/multirotor_att_control/multirotor_attitude_control.c index 33cab5cc9..c3da85c5c 100644 --- a/apps/multirotor_att_control/multirotor_attitude_control.c +++ b/apps/multirotor_att_control/multirotor_attitude_control.c @@ -235,20 +235,21 @@ void multirotor_control_attitude(const struct vehicle_attitude_setpoint_s *att_s // pid_set_parameters(&yaw_speed_controller, p.yawrate_p, p.yawrate_i, p.yawrate_d, p.yawrate_awu); pid_set_parameters(&pitch_controller, p.att_p, p.att_i, p.att_d, p.att_awu); pid_set_parameters(&roll_controller, p.att_p, p.att_i, p.att_d, p.att_awu); - printf("delays: %d us sens->ctrl, rate: %d Hz, input: %d Hz\n", sensor_delay, (int)(1.0f/deltaT), (int)(1.0f/dT_input)); + printf("att ctrl: delays: %d us sens->ctrl, rate: %d Hz, input: %d Hz\n", sensor_delay, (int)(1.0f/deltaT), (int)(1.0f/dT_input)); } /* calculate current control outputs */ /* control pitch (forward) output */ rates_sp->pitch = pid_calculate(&pitch_controller, att_sp->pitch_body + p.att_xoff, - att->pitch, att->pitchspeed, deltaT)*1/10.0f; + att->pitch, att->pitchspeed, deltaT); + /* control roll (left/right) output */ rates_sp->roll = pid_calculate(&roll_controller, att_sp->roll_body + p.att_yoff, - att->roll, att->rollspeed, deltaT)*1/10.0f; + att->roll, att->rollspeed, deltaT); + /* control yaw rate */ - //float yaw_rate_control = pid_calculate(&yaw_speed_controller, att_sp->yaw_body, att->yawspeed, 0.0f, deltaT)*1/10.0f; - rates_sp->yaw= deltaT * p.yaw_p * atan2f(sinf(att->yaw - att_sp->yaw_body),cos(att->yaw - att_sp->yaw_body)); + rates_sp->yaw= deltaT * p.yaw_p * atan2f(sinf(att->yaw - att_sp->yaw_body), cosf(att->yaw - att_sp->yaw_body)); |