From ae85a4897806d897652ee54e7b8ff826d04e0aad Mon Sep 17 00:00:00 2001 From: Arjo Chakravarty Date: Tue, 26 Dec 2023 10:32:23 +0800 Subject: [PATCH 1/2] Default CMA in LiftDrag pluginto zero The changes in #2189 have caused a regression for our upstream users. This fix disables moment calculations by defaulting Cma to zero. It should help mitigate some of the regression. There is also an [ongoing discussion](https://github.com/gazebosim/gz-sim/pull/2189#issuecomment-1866589946) as to whether the cos term should be cos^2 or cos. Signed-off-by: Arjo Chakravarty --- src/systems/lift_drag/LiftDrag.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/systems/lift_drag/LiftDrag.cc b/src/systems/lift_drag/LiftDrag.cc index cd58c9f22c..062ae48b28 100644 --- a/src/systems/lift_drag/LiftDrag.cc +++ b/src/systems/lift_drag/LiftDrag.cc @@ -74,7 +74,7 @@ class gz::sim::systems::LiftDragPrivate /// \brief Coefficient of Moment / alpha slope. /// Moment = C_M * q * S /// where q (dynamic pressure) = 0.5 * rho * v^2 - public: double cma = 0.01; + public: double cma = 0.0; /// \brief angle of attach when airfoil stalls public: double alphaStall = GZ_PI_2; @@ -328,7 +328,7 @@ void LiftDragPrivate::Update(EntityComponentManager &_ecm) spanwiseI.Dot(velI), minRatio, maxRatio); // get cos from trig identity - double cosSweepAngle = sqrt(1.0 - sinSweepAngle * sinSweepAngle); + double cosSweepAngle = 1.0 - sinSweepAngle * sinSweepAngle; double sweep = std::asin(sinSweepAngle); // truncate sweep to within +/-90 deg From 67850c46376e8ab1b5a6c8d12e540c0f5df2a9f4 Mon Sep 17 00:00:00 2001 From: Arjo Chakravarty Date: Tue, 26 Dec 2023 10:43:34 +0800 Subject: [PATCH 2/2] remove cos change to address one problem at a time Signed-off-by: Arjo Chakravarty --- src/systems/lift_drag/LiftDrag.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/systems/lift_drag/LiftDrag.cc b/src/systems/lift_drag/LiftDrag.cc index 062ae48b28..b16766e6a0 100644 --- a/src/systems/lift_drag/LiftDrag.cc +++ b/src/systems/lift_drag/LiftDrag.cc @@ -328,7 +328,7 @@ void LiftDragPrivate::Update(EntityComponentManager &_ecm) spanwiseI.Dot(velI), minRatio, maxRatio); // get cos from trig identity - double cosSweepAngle = 1.0 - sinSweepAngle * sinSweepAngle; + double cosSweepAngle = sqrt(1.0 - sinSweepAngle * sinSweepAngle); double sweep = std::asin(sinSweepAngle); // truncate sweep to within +/-90 deg