From 180a7905e58c54c5044626e858d513dde31c4d56 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Fri, 22 Apr 2016 10:45:55 +1000 Subject: [PATCH] SITL: make Z down in motors --- libraries/SITL/SIM_Frame.cpp | 2 +- libraries/SITL/SIM_Motor.cpp | 2 +- libraries/SITL/SIM_Motor.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/libraries/SITL/SIM_Frame.cpp b/libraries/SITL/SIM_Frame.cpp index 17f2ff717d..36ddf64f9f 100644 --- a/libraries/SITL/SIM_Frame.cpp +++ b/libraries/SITL/SIM_Frame.cpp @@ -174,7 +174,7 @@ void Frame::calculate_forces(const Aircraft &aircraft, thrust += mthrust; } - body_accel = -thrust/mass; + body_accel = thrust/mass; if (terminal_rotation_rate > 0) { // rotational air resistance diff --git a/libraries/SITL/SIM_Motor.cpp b/libraries/SITL/SIM_Motor.cpp index eae3c0f967..85a3c4221e 100644 --- a/libraries/SITL/SIM_Motor.cpp +++ b/libraries/SITL/SIM_Motor.cpp @@ -33,7 +33,7 @@ void Motor::calculate_forces(const Aircraft::sitl_input &input, rot_accel.x = -radians(5000.0) * sinf(radians(angle)) * motor_speed; rot_accel.y = radians(5000.0) * cosf(radians(angle)) * motor_speed; rot_accel.z = yaw_factor * motor_speed * radians(400.0); - thrust(0, 0, motor_speed * thrust_scale); // newtons + thrust(0, 0, -motor_speed * thrust_scale); // newtons NED if (roll_servo >= 0) { float roll; uint16_t servoval = input.servos[roll_servo+motor_offset]; diff --git a/libraries/SITL/SIM_Motor.h b/libraries/SITL/SIM_Motor.h index fd289d0c93..8171d47bd4 100644 --- a/libraries/SITL/SIM_Motor.h +++ b/libraries/SITL/SIM_Motor.h @@ -68,5 +68,5 @@ public: float thrust_scale, uint8_t motor_offset, Vector3f &rot_accel, // rad/sec - Vector3f &body_thrust) const; // newtons + Vector3f &body_thrust) const; // Z is down };