From 48fa3fbca35255daa7c6b33820c6210090c36675 Mon Sep 17 00:00:00 2001
From: Dennis Mannhart <dennis@yuneecresearch.com>
Date: Thu, 15 Mar 2018 10:23:59 +0100
Subject: [PATCH] PositionControl: thrust setpoint check with fabsf

---
 src/modules/mc_pos_control/PositionControl.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/modules/mc_pos_control/PositionControl.cpp b/src/modules/mc_pos_control/PositionControl.cpp
index ee492f8c3a..3dec5711d4 100644
--- a/src/modules/mc_pos_control/PositionControl.cpp
+++ b/src/modules/mc_pos_control/PositionControl.cpp
@@ -243,10 +243,10 @@ void PositionControl::_velocityController(const float &dt)
 
 	}
 
-	/* Satureate thrust setpoint in D-direction */
+	/* Saturate thrust setpoint in D-direction */
 	_thr_sp(2) = math::constrain(thrust_desired_D, uMin, uMax);
 
-	if (_thr_sp(0) + _thr_sp(1)  > FLT_EPSILON) {
+	if (fabsf(_thr_sp(0)) + fabsf(_thr_sp(1))  > FLT_EPSILON) {
 
 		/* Thrust setpoints in NE-direction is already provided. Only
 		 * scaling is required.
-- 
GitLab