Skip to content
Snippets Groups Projects
Commit bd05ea84 authored by Randy Mackay's avatar Randy Mackay
Browse files

Copter: constrain loiter so that it never commands more than 45 degrees of...

Copter: constrain loiter so that it never commands more than 45 degrees of lean in lat or lon directions
parent 0830eaf3
No related branches found
No related tags found
No related merge requests found
......@@ -406,7 +406,7 @@ static void calc_loiter(int16_t x_error, int16_t y_error)
}
output = p + i + d;
nav_lon = constrain(output, -32000, 32000); // constraint to remove chance of overflow when adding int32_t to int16_t
nav_lon = constrain(output, -4500, 4500); // constrain max angle to 45 degrees
#if LOGGING_ENABLED == ENABLED
// log output if PID logging is on and we are tuning the yaw
......@@ -439,7 +439,7 @@ static void calc_loiter(int16_t x_error, int16_t y_error)
}
output = p + i + d;
nav_lat = constrain(output, -32000, 32000); // constraint to remove chance of overflow when adding int32_t to int16_t
nav_lat = constrain(output, -4500, 4500); // constrain max angle to 45 degrees
#if LOGGING_ENABLED == ENABLED
// log output if PID logging is on and we are tuning the yaw
......@@ -485,7 +485,7 @@ static void calc_loiter(int16_t x_error, int16_t y_error)
}
output = p + i + d;
nav_lon = constrain(output, -32000, 32000); // constraint to remove chance of overflow when adding int32_t to int16_t
nav_lon = constrain(output, -4500, 4500); // constrain max angle to 45 degrees
#if LOGGING_ENABLED == ENABLED
// log output if PID logging is on and we are tuning the yaw
......@@ -518,7 +518,7 @@ static void calc_loiter(int16_t x_error, int16_t y_error)
}
output = p + i + d;
nav_lat = constrain(output, -32000, 32000); // constraint to remove chance of overflow when adding int32_t to int16_t
nav_lat = constrain(output, -4500, 4500); // constrain max angle to 45 degrees
#if LOGGING_ENABLED == ENABLED
// log output if PID logging is on and we are tuning the yaw
......
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