diff options
author | Lorenz Meier <lm@inf.ethz.ch> | 2013-09-22 00:57:50 -0700 |
---|---|---|
committer | Lorenz Meier <lm@inf.ethz.ch> | 2013-09-22 00:57:50 -0700 |
commit | 669d4c6dd26cec44196f755b223da588439816c6 (patch) | |
tree | 35fa82a5b59b2fe25eb3d12b9beb69e2d25ee255 /src | |
parent | 7033aa173bf85b01f6fcfacf6e643095c3f16848 (diff) | |
parent | 96d8ee3483012e2c48a3ca3d4bd9872b866e3bad (diff) | |
download | px4-firmware-669d4c6dd26cec44196f755b223da588439816c6.tar.gz px4-firmware-669d4c6dd26cec44196f755b223da588439816c6.tar.bz2 px4-firmware-669d4c6dd26cec44196f755b223da588439816c6.zip |
Merge pull request #409 from PX4/mpc_yaw_fix
multirotor_pos_control: yaw setpoint bug fixed
Diffstat (limited to 'src')
-rw-r--r-- | src/modules/multirotor_pos_control/multirotor_pos_control.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/modules/multirotor_pos_control/multirotor_pos_control.c b/src/modules/multirotor_pos_control/multirotor_pos_control.c index 1b3ddfdcd..36dd370fb 100644 --- a/src/modules/multirotor_pos_control/multirotor_pos_control.c +++ b/src/modules/multirotor_pos_control/multirotor_pos_control.c @@ -193,7 +193,7 @@ static int multirotor_pos_control_thread_main(int argc, char *argv[]) struct vehicle_local_position_setpoint_s local_pos_sp; memset(&local_pos_sp, 0, sizeof(local_pos_sp)); struct vehicle_global_position_setpoint_s global_pos_sp; - memset(&global_pos_sp, 0, sizeof(local_pos_sp)); + memset(&global_pos_sp, 0, sizeof(global_pos_sp)); struct vehicle_global_velocity_setpoint_s global_vel_sp; memset(&global_vel_sp, 0, sizeof(global_vel_sp)); @@ -408,6 +408,7 @@ static int multirotor_pos_control_thread_main(int argc, char *argv[]) } } + /* copy yaw setpoint to vehicle_local_position_setpoint topic */ local_pos_sp.yaw = att_sp.yaw_body; /* local position setpoint is valid and can be used for auto loiter after position controlled mode */ @@ -430,7 +431,6 @@ static int multirotor_pos_control_thread_main(int argc, char *argv[]) local_pos_sp.x = local_pos.x; local_pos_sp.y = local_pos.y; local_pos_sp.z = - params.takeoff_alt - params.takeoff_gap; - local_pos_sp.yaw = att.yaw; att_sp.yaw_body = att.yaw; mavlink_log_info(mavlink_fd, "[mpc] takeoff sp: %.2f %.2f %.2f", (double)local_pos_sp.x, (double)local_pos_sp.y, (double) - local_pos_sp.z); } @@ -471,8 +471,6 @@ static int multirotor_pos_control_thread_main(int argc, char *argv[]) } else { local_pos_sp.z = local_pos.ref_alt - global_pos_sp.altitude; } - - local_pos_sp.yaw = global_pos_sp.yaw; att_sp.yaw_body = global_pos_sp.yaw; mavlink_log_info(mavlink_fd, "[mpc] new sp: %.7f, %.7f (%.2f, %.2f)", (double)sp_lat, sp_lon, (double)local_pos_sp.x, (double)local_pos_sp.y); @@ -485,7 +483,6 @@ static int multirotor_pos_control_thread_main(int argc, char *argv[]) local_pos_sp.x = local_pos.x; local_pos_sp.y = local_pos.y; local_pos_sp.yaw = att.yaw; - att_sp.yaw_body = global_pos_sp.yaw; } if (reset_auto_sp_z) { @@ -509,6 +506,9 @@ static int multirotor_pos_control_thread_main(int argc, char *argv[]) reset_mission_sp = true; } + /* copy yaw setpoint to vehicle_local_position_setpoint topic */ + local_pos_sp.yaw = att_sp.yaw_body; + /* reset setpoints after AUTO mode */ reset_man_sp_xy = true; reset_man_sp_z = true; |