From 1119c77ccabcf0c368a40245d7391d5457fea74c Mon Sep 17 00:00:00 2001 From: Oleg Kalachev Date: Fri, 24 May 2024 14:47:26 +0300 Subject: [PATCH] Remove unneeded abs for motors thrust in simulation --- gazebo/simulator.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/gazebo/simulator.cpp b/gazebo/simulator.cpp index 44a4481..f7da906 100644 --- a/gazebo/simulator.cpp +++ b/gazebo/simulator.cpp @@ -92,10 +92,10 @@ public: const double maxThrust = 0.03 * ONE_G; // ~30 g, https://youtu.be/VtKI4Pjx8Sk?&t=78 const float scale0 = 1.0, scale1 = 1.1, scale2 = 0.9, scale3 = 1.05; // imitating motors asymmetry - float mfl = scale0 * maxThrust * abs(motors[MOTOR_FRONT_LEFT]); - float mfr = scale1 * maxThrust * abs(motors[MOTOR_FRONT_RIGHT]); - float mrl = scale2 * maxThrust * abs(motors[MOTOR_REAR_LEFT]); - float mrr = scale3 * maxThrust * abs(motors[MOTOR_REAR_RIGHT]); + float mfl = scale0 * maxThrust * motors[MOTOR_FRONT_LEFT]; + float mfr = scale1 * maxThrust * motors[MOTOR_FRONT_RIGHT]; + float mrl = scale2 * maxThrust * motors[MOTOR_REAR_LEFT]; + float mrr = scale3 * maxThrust * motors[MOTOR_REAR_RIGHT]; body->AddLinkForce(Vector3d(0.0, 0.0, mfl), Vector3d(dist, dist, 0.0)); body->AddLinkForce(Vector3d(0.0, 0.0, mfr), Vector3d(dist, -dist, 0.0));