Skip to content

Commit

Permalink
Remove unneeded abs for motors thrust in simulation
Browse files Browse the repository at this point in the history
  • Loading branch information
okalachev committed May 24, 2024
1 parent fbe33ea commit 1119c77
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions gazebo/simulator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,10 @@ class ModelFlix : public ModelPlugin {
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));
Expand Down

0 comments on commit 1119c77

Please sign in to comment.