From 69da7e9f86a1e0ae3a1a7c50dd91a3f866cb484b Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Fri, 22 Jul 2016 16:42:23 +1000 Subject: [PATCH] SITL: added elevrev option for plane sim used by autotest --- libraries/SITL/SIM_Plane.cpp | 7 +++++++ libraries/SITL/SIM_Plane.h | 1 + 2 files changed, 8 insertions(+) diff --git a/libraries/SITL/SIM_Plane.cpp b/libraries/SITL/SIM_Plane.cpp index 7e6a817239..f55bd0f087 100644 --- a/libraries/SITL/SIM_Plane.cpp +++ b/libraries/SITL/SIM_Plane.cpp @@ -47,6 +47,9 @@ Plane::Plane(const char *home_str, const char *frame_str) : } else if (strstr(frame_str, "-vtail")) { vtail = true; } + if (strstr(frame_str, "-elevrev")) { + reverse_elevator_rudder = true; + } ground_behavior = GROUND_BEHAVIOR_FWD_ONLY; } @@ -205,6 +208,10 @@ void Plane::calculate_forces(const struct sitl_input &input, Vector3f &rot_accel float elevator = (input.servos[1]-1500)/500.0f; float rudder = (input.servos[3]-1500)/500.0f; float throttle; + if (reverse_elevator_rudder) { + elevator = -elevator; + rudder = -rudder; + } if (elevons) { // fake an elevon plane float ch1 = aileron; diff --git a/libraries/SITL/SIM_Plane.h b/libraries/SITL/SIM_Plane.h index 2b6d0577af..2304c308b0 100644 --- a/libraries/SITL/SIM_Plane.h +++ b/libraries/SITL/SIM_Plane.h @@ -94,6 +94,7 @@ protected: bool reverse_thrust; bool elevons; bool vtail; + bool reverse_elevator_rudder; float liftCoeff(float alpha) const; float dragCoeff(float alpha) const;