From 195c811c90f0e658d16f1c6be1cda59adf60d6bb Mon Sep 17 00:00:00 2001 From: edouard Date: Tue, 21 Dec 2010 20:21:00 +0000 Subject: [PATCH] HITL/SITL: Flightgear now works in SITL mode with the current stabilization algorithm which includes gyro rates. Upped the rate for attitudeactual and attituderaw to a value which makes the stabilization algo work properly, will cause trouble on slow machines. git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@2267 ebee16cc-31ac-478f-84a7-5cbb03baadba --- ground/src/plugins/hitlnew/fgsimulator.cpp | 9 +++++---- ground/src/plugins/hitlnew/simulator.cpp | 9 +++++++-- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/ground/src/plugins/hitlnew/fgsimulator.cpp b/ground/src/plugins/hitlnew/fgsimulator.cpp index e2928dfa9..1efd686cc 100644 --- a/ground/src/plugins/hitlnew/fgsimulator.cpp +++ b/ground/src/plugins/hitlnew/fgsimulator.cpp @@ -172,8 +172,9 @@ void FGSimulator::transmitUpdate() // Read joystick input if(manCtrlData.Armed == ManualControlCommand::ARMED_TRUE) { + // Note: Pitch sign is reversed in FG ? ailerons = manCtrlData.Roll; - elevator = manCtrlData.Pitch; + elevator = -manCtrlData.Pitch; rudder = manCtrlData.Yaw; throttle = manCtrlData.Throttle; } @@ -184,7 +185,7 @@ void FGSimulator::transmitUpdate() actData = actDesired->getData(); ailerons = actData.Roll; - elevator = actData.Pitch; + elevator = -actData.Pitch; rudder = actData.Yaw; throttle = actData.Throttle; } @@ -226,7 +227,7 @@ void FGSimulator::transmitUpdate() if(!settings.manual) { actData.Roll = ailerons; - actData.Pitch = elevator; + actData.Pitch = -elevator; actData.Yaw = rudder; actData.Throttle = throttle; //actData.NumLongUpdates = (float)udpCounterFGrecv; @@ -392,7 +393,7 @@ void FGSimulator::processUpdate(const QByteArray& inp) rawData.gyros_filtered[0] = rollRate; //rawData.gyros_filtered[1] = cos(DEG2RAD * roll) * pitchRate + sin(DEG2RAD * roll) * yawRate; //rawData.gyros_filtered[2] = cos(DEG2RAD * roll) * yawRate - sin(DEG2RAD * roll) * pitchRate; - rawData.gyros_filtered[1] = -pitchRate; + rawData.gyros_filtered[1] = pitchRate; rawData.gyros_filtered[2] = yawRate; attRaw->setData(rawData); attRaw->updated(); diff --git a/ground/src/plugins/hitlnew/simulator.cpp b/ground/src/plugins/hitlnew/simulator.cpp index bdcda50e4..6bb12b015 100644 --- a/ground/src/plugins/hitlnew/simulator.cpp +++ b/ground/src/plugins/hitlnew/simulator.cpp @@ -210,12 +210,17 @@ void Simulator::setupObjects() { setupInputObject(actDesired, 100); setupOutputObject(altActual, 250); - setupOutputObject(attActual, 100); + setupOutputObject(attActual, 10); + //setupOutputObject(attActual, 100); setupOutputObject(gpsPos, 250); setupOutputObject(posActual, 250); setupOutputObject(velActual, 250); setupOutputObject(posHome, 1000); - setupOutputObject(attRaw, 100); + setupOutputObject(attRaw, 10); + //setupOutputObject(attRaw, 100); + + + } void Simulator::setupInputObject(UAVObject* obj, int updatePeriod)