mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-03-15 07:29:15 +01:00
HitL - some fixes to prevent EventSystem Overload
Hitl IL2 - prevent NaN numbers from getting produced git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@2085 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
parent
489e22f0ba
commit
800eb5320e
@ -220,6 +220,9 @@ void IL2Simulator::processUpdate(const QByteArray& inp)
|
||||
current.Y = old.Y + (current.dY*current.dT);
|
||||
|
||||
// accelerations (filtered)
|
||||
if (isnan(old.ddX) || isinf(old.ddX)) old.ddX=0;
|
||||
if (isnan(old.ddY) || isinf(old.ddY)) old.ddY=0;
|
||||
if (isnan(old.ddZ) || isinf(old.ddZ)) old.ddZ=0;
|
||||
#define SPEED_FILTER 10
|
||||
current.ddX = ((current.dX-old.dX)/current.dT + SPEED_FILTER * (old.ddX)) / (SPEED_FILTER+1);
|
||||
current.ddY = ((current.dY-old.dY)/current.dT + SPEED_FILTER * (old.ddY)) / (SPEED_FILTER+1);
|
||||
@ -227,6 +230,9 @@ void IL2Simulator::processUpdate(const QByteArray& inp)
|
||||
|
||||
#define TURN_FILTER 10
|
||||
// turn speeds (filtered)
|
||||
if (isnan(old.dAzimuth) || isinf(old.dAzimuth)) old.dAzimuth=0;
|
||||
if (isnan(old.dPitch) || isinf(old.dPitch)) old.dPitch=0;
|
||||
if (isnan(old.dRoll) || isinf(old.dRoll)) old.dRoll=0;
|
||||
current.dAzimuth = (angleDifference(current.azimuth,old.azimuth)/current.dT + TURN_FILTER * (old.dAzimuth)) / (TURN_FILTER+1);
|
||||
current.dPitch = (angleDifference(current.pitch,old.pitch)/current.dT + TURN_FILTER * (old.dPitch)) / (TURN_FILTER+1);
|
||||
current.dRoll = (angleDifference(current.roll,old.roll)/current.dT + TURN_FILTER * (old.dRoll)) / (TURN_FILTER+1);
|
||||
|
@ -204,14 +204,14 @@ void Simulator::receiveUpdate()
|
||||
|
||||
void Simulator::setupObjects()
|
||||
{
|
||||
setupInputObject(actDesired, 50);
|
||||
setupInputObject(actDesired, 100);
|
||||
setupOutputObject(altActual, 250);
|
||||
setupOutputObject(attActual, 50);
|
||||
setupOutputObject(attActual, 100);
|
||||
setupOutputObject(gpsPos, 250);
|
||||
setupOutputObject(posActual, 250);
|
||||
setupOutputObject(velActual, 250);
|
||||
setupOutputObject(posHome, 1000);
|
||||
setupOutputObject(attRaw, 50);
|
||||
setupOutputObject(attRaw, 100);
|
||||
}
|
||||
|
||||
void Simulator::setupInputObject(UAVObject* obj, int updatePeriod)
|
||||
|
Loading…
x
Reference in New Issue
Block a user