diff --git a/quad/sw/modular_quad_pid/src/control_algorithm.c b/quad/sw/modular_quad_pid/src/control_algorithm.c index 63ba756137739578a39f2609048a3728027266c7..ee77a7623965aab68635540caea1587768a7e655 100644 --- a/quad/sw/modular_quad_pid/src/control_algorithm.c +++ b/quad/sw/modular_quad_pid/src/control_algorithm.c @@ -184,13 +184,13 @@ parameter_struct->pid_controllers[PITCH_ID].current_point = sensor_struct->pitch_angle_filtered; parameter_struct->pid_controllers[PITCH_ID].setpoint = - /*(user_defined_struct->flight_mode == AUTO_FLIGHT_MODE)? - (parameter_struct->pid_controllers[LOCAL_X_ID].pid_correction) + pitch_trim :*/ user_input_struct->pitch_angle_manual_setpoint; + (user_defined_struct->flight_mode == AUTO_FLIGHT_MODE)? + (parameter_struct->pid_controllers[LOCAL_X_ID].pid_correction) + pitch_trim : user_input_struct->pitch_angle_manual_setpoint; parameter_struct->pid_controllers[ROLL_ID].current_point = sensor_struct->roll_angle_filtered; parameter_struct->pid_controllers[ROLL_ID].setpoint = - /*(user_defined_struct->flight_mode == AUTO_FLIGHT_MODE)? - (parameter_struct->pid_controllers[LOCAL_Y_ID].pid_correction) + roll_trim :*/ user_input_struct->roll_angle_manual_setpoint; + (user_defined_struct->flight_mode == AUTO_FLIGHT_MODE)? + (parameter_struct->pid_controllers[LOCAL_Y_ID].pid_correction) + roll_trim : user_input_struct->roll_angle_manual_setpoint; //logging and PID computation @@ -239,8 +239,8 @@ if(user_defined_struct->flight_mode == AUTO_FLIGHT_MODE) { //THROTTLE - raw_actuator_struct->controller_corrected_motor_commands[THROTTLE] = - ((int)(parameter_struct->pid_controllers[ALT_ID].pid_correction)) + sensor_struct->trims.throttle; + //raw_actuator_struct->controller_corrected_motor_commands[THROTTLE] = + // ((int)(parameter_struct->pid_controllers[ALT_ID].pid_correction)) + sensor_struct->trims.throttle; //ROLL raw_actuator_struct->controller_corrected_motor_commands[ROLL] = diff --git a/quad/sw/modular_quad_pid/src/initialize_components.c b/quad/sw/modular_quad_pid/src/initialize_components.c index c548d26d2151f6923fc91421211a2f938f3e9a4b..0b693dea64b6260f54e6ec88df771156fd45634d 100644 --- a/quad/sw/modular_quad_pid/src/initialize_components.c +++ b/quad/sw/modular_quad_pid/src/initialize_components.c @@ -24,13 +24,10 @@ int protection_loops(modular_structs_t *structs) // wait until throttle is low and the gear switch is engaged (so you don't immediately break out of the main loop below) // also wait for the flight mode to be set to manual - while(rc_commands[THROTTLE] > 125000 || read_kill(rc_commands[GEAR]) || !read_flap(rc_commands[FLAP])) - read_rec_all(rc_commands); - - // wait until the ground station has connected to the quad and acknowledged that its ready to start - while (!structs->user_input_struct.receivedBeginUpdate) { + while(rc_commands[THROTTLE] > 125000 || read_kill(rc_commands[GEAR]) || !read_flap(rc_commands[FLAP]) || + !structs->user_input_struct.receivedBeginUpdate) { process_received(structs); - usleep(10000); + read_rec_all(rc_commands); } // let the pilot/observers know that the quad is now active