minor code cleanup, not changing functionality

This commit is contained in:
Lorenz Meier 2012-11-28 23:00:43 +01:00
parent 9fa628c668
commit 00b79764d7
2 changed files with 5 additions and 12 deletions

View File

@ -597,7 +597,7 @@ uint8_t update_state_machine_mode_request(int status_pub, struct vehicle_status_
publish_armed_status(current_status);
printf("[commander] Enabling HIL, locking down all actuators for safety.\n\t(Arming the system will not activate them while in HIL mode)\n");
} else if (current_status->state_machine != SYSTEM_STATE_STANDBY) {
mavlink_log_critical(mavlink_fd, "[commander] REJECTING switch to HIL, not in standby.")
mavlink_log_critical(mavlink_fd, "[commander] REJECTING HIL, not in standby.")
}
/* NEVER actually switch off HIL without reboot */

View File

@ -297,19 +297,12 @@ int fixedwing_pos_control_thread_main(int argc, char *argv[])
if (global_sp_updated) {
orb_copy(ORB_ID(vehicle_global_position_setpoint), global_setpoint_sub, &global_setpoint);
// printf("xtrack_err.distance %.4f ", (double)xtrack_err.distance);
float delta_psi_c = pid_calculate(&offtrack_controller, 0, xtrack_err.distance, 0.0f, 0.0f); //p.xtrack_p * xtrack_err.distance
// printf("delta_psi_c %.4f ", (double)delta_psi_c);
start_pos = global_pos; //for now using the current position as the startpoint (= approx. last waypoint because the setpoint switch occurs at the waypoint)
global_sp_updated_set_once = true;
psi_track = get_bearing_to_next_waypoint((double)global_pos.lat / (double)1e7d, (double)global_pos.lon / (double)1e7d,
(double)global_setpoint.lat / (double)1e7d, (double)global_setpoint.lon / (double)1e7d);
if (verbose)
printf("psi_track: %0.4f\n", (double)psi_track);
printf("next wp direction: %0.4f\n", (double)psi_track);
}
/* Simple Horizontal Control */
@ -332,6 +325,9 @@ int fixedwing_pos_control_thread_main(int argc, char *argv[])
float psi_c = psi_track + delta_psi_c;
float psi_e = psi_c - att.yaw;
/* wrap difference back onto -pi..pi range */
psi_e = _wrap_pi(psi_e);
if (verbose) {
printf("xtrack_err.distance %.4f ", (double)xtrack_err.distance);
printf("delta_psi_c %.4f ", (double)delta_psi_c);
@ -340,9 +336,6 @@ int fixedwing_pos_control_thread_main(int argc, char *argv[])
printf("psi_e %.4f ", (double)psi_e);
}
/* shift error to prevent wrapping issues */
psi_e = _wrap_pi(psi_e);
/* calculate roll setpoint, do this artificially around zero */
float delta_psi_rate_c = pid_calculate(&heading_controller, psi_e, 0.0f, 0.0f, 0.0f);
float psi_rate_track = 0; //=V_gr/r_track , this will be needed for implementation of arc following