From f9d3d0a5a10672154010691e510d2a095e27783f Mon Sep 17 00:00:00 2001 From: Achille Martin Date: Thu, 17 Dec 2020 13:29:59 +0000 Subject: [PATCH] Updated the liftdrag two lines model for the drag component to make it more realistic --- .../uuv_gazebo_plugins/src/LiftDragModel.cc | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/uuv_gazebo_plugins/uuv_gazebo_plugins/src/LiftDragModel.cc b/uuv_gazebo_plugins/uuv_gazebo_plugins/src/LiftDragModel.cc index 19196880f..41a447a3b 100644 --- a/uuv_gazebo_plugins/uuv_gazebo_plugins/src/LiftDragModel.cc +++ b/uuv_gazebo_plugins/uuv_gazebo_plugins/src/LiftDragModel.cc @@ -247,14 +247,24 @@ ignition::math::Vector3d LiftDragTwoLines::compute(const ignition::math::Vector3 double sumAlpha = alpha + this->alphaStall; cl = -this->cla * this->alphaStall + this->cdaStall * sumAlpha; - cd = -this->cda * this->alphaStall + - this->cdaStall * sumAlpha; + cd = this->cda * this->alphaStall + + -this->cdaStall * sumAlpha; } else { // no stall - cd = this->cda * alpha; - cl = this->cla * alpha; + // angle of attack > -a0 + if (alpha > 0) + { + cd = this->cda * alpha; + cl = this->cla * alpha; + } + // angle of attack <= -a0 + else + { + cd = -this->cda * alpha; + cl = this->cla * alpha; + } } double lift = cl*q*this->area;