Skip to content
Snippets Groups Projects
Commit c83e8061 authored by dawehr's avatar dawehr
Browse files

Increased max pitch/roll angle and maximum output from rate controllers....

Increased max pitch/roll angle and maximum output from rate controllers. removed comment from log file being dumped.
parent 9a04c556
No related branches found
No related tags found
No related merge requests found
...@@ -10,7 +10,8 @@ ...@@ -10,7 +10,8 @@
#include "control_algorithm.h" #include "control_algorithm.h"
#include "communication.h" #include "communication.h"
#define ROLL_PITCH_MAX_ANGLE 0.3490 // 20 degrees #define ROLL_PITCH_MAX_ANGLE 1.5708 // 90 degrees
#define PWM_DIFF_BOUNDS 30000
int control_algorithm_init(parameter_t * parameter_struct) int control_algorithm_init(parameter_t * parameter_struct)
{ {
...@@ -232,8 +233,10 @@ ...@@ -232,8 +233,10 @@
memcpy(raw_actuator_struct->controller_corrected_motor_commands, user_input_struct->rc_commands, sizeof(int) * 6); memcpy(raw_actuator_struct->controller_corrected_motor_commands, user_input_struct->rc_commands, sizeof(int) * 6);
// don't use the PID corrections if the throttle is less than about 10% of its range // don't use the PID corrections if the throttle is less than about 10% of its range
// NOTE!!!!!!!!!!!!!!!!!!!!!!
// re-enable the check for AUTO_FLIGHT_MODE when autonomous is fully enabled
if((user_input_struct->rc_commands[THROTTLE] > if((user_input_struct->rc_commands[THROTTLE] >
118000) || (user_defined_struct->flight_mode == AUTO_FLIGHT_MODE)) 118000))// || (user_defined_struct->flight_mode == AUTO_FLIGHT_MODE))
{ {
if(user_defined_struct->flight_mode == AUTO_FLIGHT_MODE) if(user_defined_struct->flight_mode == AUTO_FLIGHT_MODE)
...@@ -284,23 +287,23 @@ ...@@ -284,23 +287,23 @@
raw_actuator_struct->controller_corrected_motor_commands[THROTTLE] = 0; raw_actuator_struct->controller_corrected_motor_commands[THROTTLE] = 0;
//BOUNDS CHECKING //BOUNDS CHECKING
if(raw_actuator_struct->controller_corrected_motor_commands[ROLL] > 20000) if(raw_actuator_struct->controller_corrected_motor_commands[ROLL] > PWM_DIFF_BOUNDS)
raw_actuator_struct->controller_corrected_motor_commands[ROLL] = 20000; raw_actuator_struct->controller_corrected_motor_commands[ROLL] = PWM_DIFF_BOUNDS;
if(raw_actuator_struct->controller_corrected_motor_commands[ROLL] < -20000) if(raw_actuator_struct->controller_corrected_motor_commands[ROLL] < -PWM_DIFF_BOUNDS)
raw_actuator_struct->controller_corrected_motor_commands[ROLL] = -20000; raw_actuator_struct->controller_corrected_motor_commands[ROLL] = -PWM_DIFF_BOUNDS;
if(raw_actuator_struct->controller_corrected_motor_commands[PITCH] > 20000) if(raw_actuator_struct->controller_corrected_motor_commands[PITCH] > PWM_DIFF_BOUNDS)
raw_actuator_struct->controller_corrected_motor_commands[PITCH] = 20000; raw_actuator_struct->controller_corrected_motor_commands[PITCH] = PWM_DIFF_BOUNDS;
if(raw_actuator_struct->controller_corrected_motor_commands[PITCH] < -20000) if(raw_actuator_struct->controller_corrected_motor_commands[PITCH] < -PWM_DIFF_BOUNDS)
raw_actuator_struct->controller_corrected_motor_commands[PITCH] = -20000; raw_actuator_struct->controller_corrected_motor_commands[PITCH] = -PWM_DIFF_BOUNDS;
if(raw_actuator_struct->controller_corrected_motor_commands[YAW] > 20000) if(raw_actuator_struct->controller_corrected_motor_commands[YAW] > PWM_DIFF_BOUNDS)
raw_actuator_struct->controller_corrected_motor_commands[YAW] = 20000; raw_actuator_struct->controller_corrected_motor_commands[YAW] = PWM_DIFF_BOUNDS;
if(raw_actuator_struct->controller_corrected_motor_commands[YAW] < -20000) if(raw_actuator_struct->controller_corrected_motor_commands[YAW] < -PWM_DIFF_BOUNDS)
raw_actuator_struct->controller_corrected_motor_commands[YAW] = -20000; raw_actuator_struct->controller_corrected_motor_commands[YAW] = -PWM_DIFF_BOUNDS;
} }
else else
......
...@@ -65,7 +65,7 @@ int startMPU9150(){ ...@@ -65,7 +65,7 @@ int startMPU9150(){
// Set clock reference to Z Gyro // Set clock reference to Z Gyro
iic0Write(0x6B, 0x03); iic0Write(0x6B, 0x03);
// Configure Digital Low/High Pass filter // Configure Digital Low/High Pass filter
iic0Write(0x1A,0x06); // Level 4 low pass on gyroscope iic0Write(0x1A,0x06); // Level 6 low pass on gyroscope
// Configure Gyro to 2000dps, Accel. to +/-8G // Configure Gyro to 2000dps, Accel. to +/-8G
iic0Write(0x1B, 0x18); iic0Write(0x1B, 0x18);
......
...@@ -143,7 +143,7 @@ void printLogging(){ ...@@ -143,7 +143,7 @@ void printLogging(){
); );
strcat(buf,comments); //strcat(buf,comments);
strcat(buf,header); strcat(buf,header);
strcat(buf,units); strcat(buf,units);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment