1
0
Fork 0
Commit graph

15533 commits

Author SHA1 Message Date
Bertrand Coconnier
d4f31c3507 Filters out negative powers when the propeller is not rotating. 2021-05-22 12:41:50 +02:00
James Turner
d3956a4af7 Add bi-directional support to the generic protocol
Ticket-Id: https://sourceforge.net/p/flightgear/codetickets/1191/
2021-05-19 15:11:55 +01:00
James Turner
d5789b5f74 Fix an error with new OSG compilation
Ensure we include <QOpenGLContext> before any OSG headers
2021-05-19 15:10:17 +01:00
jano
804f689da8 made the --multiplay option only set sim/multiplay/tx-rate-hz for the
out command, in option curently overwrite the rate given by the out option
eg: --multiplay=out,20,localhost,5000 --multiplay=in,,,5003 end with a tx
rate of "0" and this end with the default value 10 later
2021-05-17 09:27:18 +01:00
Bertrand Coconnier
773a44c072 Tentative fix for the issue #2581 (propeller spinning indefinitely after aborting crank). 2021-05-08 18:50:34 +02:00
James Turner
2614945b8f Ground-net loading: collect which nets have problems
Log problem airports so we can fix them case-by-case.
2021-05-04 12:03:27 +01:00
James Turner
cf75ba1fe9 Fix crash in tower selection logic in empty areas.
When starting a long way from any carrier, don’t crash because no
carrier was found. Thanks to Fahim Dalvi for finding thing.
2021-05-02 16:48:55 +01:00
James Turner
4e432b3f8e Error reporter: tweak enable, is-critical logic
Disable error-reports in ‘developer-mode’, and only consider aircraft
errors critical if they happen before postinit(). 

Add logic to show the correct report when a popup is clicked.
2021-04-30 13:46:10 +01:00
James Turner
e04c179767 Environment manager: reduce log message levels 2021-04-30 13:46:10 +01:00
Bertrand Coconnier
01dd0a987d Sync'ed with JSBSim v1.1.5
- Lower the allowable minimum propeller inertia from 1e-3 to 1e-6
- Account for the vehicle angular rates in the computation of propellers local velocities.
- Apply the engine torque to the vehicle (The aerodynamic torque was applied until now but it is the engine generated torque that the aircraft is actually submitted to)
- Prevent FGPiston from sending negative powers to thrusters
- Fixed FGMagnetometer : no need to update the magnetic field every time step.
- FGMassBalance: remove a direct reference to FGGroundReactions
2021-04-30 12:15:59 +02:00
Fernando García Liñán
558a498850 Fix hotspots being shown for a single frame after startup
FGRenderer::update() happens after the CameraGroup is updated, which causes the
Compositor to use the previous frame cull mask. Setting the cull masks
explicitly during FGRenderer::update() fixes the issue.
2021-04-29 12:18:50 +02:00
James Turner
94c202375c Fix a warning spotted by Fahim Dalvi. 2021-04-28 12:09:32 +01:00
James Turner
1b4ae1e46b Launcher: detect command line scenery/acft paths 2021-04-28 11:25:49 +01:00
Stuart Buchanan
6529234abe Fix compiler warnings 2021-04-26 21:01:49 +01:00
James Turner
8085d1fa2c Clear ATC on the user aircraft as well
Avoids an assert/crash on exit, in some ATC configurations.
2021-04-26 11:14:06 +01:00
James Turner
a458d46349 FGCom: don’t crash if properties change before postinit
Check the _initialized flag inside the listener, to avoid a crash
if Nasal sets fgcom properties during its startup, which happens
before FGCom runs its own postinit()

Ticket: https://sourceforge.net/p/flightgear/codetickets/2574/
2021-04-26 10:18:47 +01:00
James Turner
8a33f86e46 Error-reporting: improve UI/display behaviour
Assess how critical the error is, and based on this, show a popup
instead of the dialog in some cases. Add commands to allow delayed
display of the main dialog, and stepping through multiple error
reports in the dialog.

Also add a new error category for shader errors, since these are
always emitted from the render thread and we can’t easily attribute
them to an aircraft, scenery or core feature.
2021-04-25 19:18:56 +01:00
James Turner
e8952b6c0f Update tests for revised Subsystem API 2021-04-25 19:18:56 +01:00
James Turner
e6307b1494 Fix dumb inverted logic commit 2021-04-25 19:18:56 +01:00
James Turner
6e42b9ae02 Attempting to fix AIAircraft/controller crash
Add an assertion that controller has been cleared before the AIAircraft
destructor is run. If it’s not, then we are too late, don’t try to
sign off since the controller is probably gone.

Sentry-Id: FLIGHTGEAR-15
2021-04-25 19:18:56 +01:00
James Turner
14d01ccffe Panel/cockpit loading: report errors 2021-04-25 19:18:56 +01:00
Richard Harrison
ba783ccce9 AI Carriers: tidy and resolve ctor order
Tidying up:

* change to use direct initializtion
* put all of member variables in alpha order
* adjust init spacing to make init values clear.
* change all member variables to start with an underscore. The reason for this isn't clear but some had an underscore and some didn't; so although I don't know what the convention was intended for this seems to be the appropriate changes.
2021-04-25 17:30:21 +02:00
James Turner
a47d126ba5 Autosave loading: suppress XML errors 2021-04-21 21:57:55 +01:00
James Turner
e1a9d27ca6 Generic protocols: suppress XML errors 2021-04-21 21:57:10 +01:00
James Turner
a1b5f452e3 Input-device configuration: report config errors 2021-04-21 21:56:52 +01:00
James Turner
fba1e9fa61 YASim: fix warnings from bind()
Add a version of fgUntie which is quiet, if the property does not
currently exist.
2021-04-21 21:56:33 +01:00
James Turner
8aec2710b6 Nasal / Emesary: explicitly init the recipient
Sync with the updated SimGear APi for this, explicitly init the
recipient before the main loop starts.
2021-04-21 12:50:16 +01:00
Richard Harrison
3ab197a000 Active Tower improvements.
Previous commit removed the logic that sets the tower position and altitude; this commit fixes this.

Also added limits and default for tower altitude because there are a lot of towers that are at the same altitude as the airport; this is clearly a lack of data. Also there are some towers that are ludicrously high (e.g. KLSV). This commit defines a reasonable minimum and maximum values for tower altitude; together with a default altitude which will be added to the airport elevation when the tower altitude is outside of these ranges (above airpot altitude).

---------------
I used the following queries can against the navdata cache to figure out what sensible values were:

to locate overly tall towers

  select a.type, a.ident, a.name, (p.elev_m - a.elev_m) from positioned as p
    inner join positioned as a on a.octree_node = p.octree_node
    where p.type=22 and a.type=1 and abs(p.elev_m - a.elev_m) > 100

to locate towers at ground level:

  select a.type, a.ident, a.name, (p.elev_m - a.elev_m) from positioned as p
    inner join positioned as a on a.octree_node = p.octree_node
    where p.type=22 and a.type=1 and abs(p.elev_m - a.elev_m) < 0.1

to calculate the average tower height

  select avg(p.elev_m - a.elev_m) from positioned as p
    inner join positioned as a on a.octree_node = p.octree_node
    where p.type=22 and a.type=1 and abs(p.elev_m - a.elev_m)
2021-04-19 18:04:47 +02:00
Julian Smith
68e6527574 src/AIModel/AIMultiplayer.*: split out some code from FGAIMultiplayer::update(double dt).
Moved motion test code into separate function and removed some now-unnecessary
logging.

Moved extrapolation code into separate method.

Converted some stray tabs into spaces.
2021-04-18 17:17:00 +01:00
Julian Smith
7753ce229d Fixed uneven replay of user vs multiplayer aircraft.
FGReplay was using time t, AIMultiplayer was using t+dt. The fix is to make
FGReplay also use t+dt.

scripts/python/recordreplay.py
    Make --test-motion-mp test for this problem - we check that user and mp
    aircraft are a constant distance apart when replaying.

src/AIModel/AIMultiplayer.cxx
    Create properties showing distance moved since start by user and mp
    aircraft, which can then be tested by recordreplay.py.

src/Aircraft/replay.cxx
    Increment current_time by dt before calling replay(current_time), to
    ensure that replay() sees the time as is later used by AIMultiplayer (via
    /sim/replay/time).
2021-04-18 12:12:50 +01:00
Julian Smith
99bcc3ba24 scripts/python/FlightGear.py: ls() now returns typed values. 2021-04-18 12:12:50 +01:00
Julian Smith
3e57ba3332 src/Aircraft/replay.cxx: fixed potential segv when moving packest between medium/long term store. 2021-04-18 12:12:50 +01:00
Julian Smith
967cff2b6f src/Model/acmodel.cxx: Fixed broken aircraft sound after change to ordering of subsystems.
Moved creation of FGFX() from FGAircraftModel constructor into
FGAircraftModel::init().

Thanks to Colin Geniet for bug report and suggested fix.
2021-04-17 19:24:05 +01:00
Richard Harrison
d92da2cb17 Restore shared pointer in checkCarrierSceneryLoaded
I'd removed this as part of testing and this restores it back to how it should be.
2021-04-17 09:32:30 +02:00
James Turner
4096f354df Fix compile error when sentry is enabled 2021-04-16 23:14:14 +01:00
Richard Harrison
522d7e8450 Finish 2021-carriers-and-ai-part-1-towers
Carrier improvements

- Calculate lineup deviation (degrees left/right)
- Position for touchdown added (for more accurate lineup and glideslope deviation checks)
- LSO position and Tower position added (for views)
- Better logic for controlling the FLOLS
- Added ability to start on a specific course (works better
  with the launcher if the carrier starts on a recovery course
  when positioning in air for recovery (approach)
- Support for normal, tower, LSO views (via controls/view-index)
- Aircraft can define offset for FLOLS in sim/model/reference-offset-{xyz}

Added the ability to find the nearest carrier to use as a tower

Rework of the tower position so that it updates frequently to support moving towers.

TODO: Need to review how to better implement/integrate 'sub-views' i.e. ai/models/carrier[]/controls/view-index which is actually a sub index for the tower view.
2021-04-16 22:02:11 +02:00
Erik Hofman
303e518e87 Aparently MSVC doesn't like it this way. 2021-04-16 14:44:03 +02:00
Erik Hofman
deab07d527 Do not include dds_props.hxx if CycloneDDS was not found 2021-04-16 13:22:06 +02:00
Erik Hofman
5118009d44 Add a new network protocol: dds-props which for now only operates in the output mode: request a propery value using de FG_DDS_prop scheme and provide either it's path or property index id. UsageL fgfs --dds-props=dds,out,<hz>. Testing is possible with src/Network/DDS/fg_dds_prop to request a propery path/id or src/Network/DDS/fg_dds_log to log all propery samples passed over the DDS layer. 2021-04-16 11:26:21 +02:00
Julian Smith
1aeef58ded src/Time/TimeManager.cxx: include <algorithm> for std::max.
Hopefully will fix windows build failure.
2021-04-15 22:24:15 +01:00
Julian Smith
edc6d88993 src/AIModel/AIMultiplayer.*: Improve behaviour if simple-time enabled.
Moved interpolation code into new method
FGAIMultiplayer::FGAIMultiplayerInterpolate().

FGAIMultiplayer::update():
    If simple-time is enabled, always use getMPProtocolClockSec() (or
    /sim/replay/time if replaying) as current time, so that multiple instances
    of Flightgear all using simple-time will all show user and MP aircraft
    in the same relative positions.

    When interpolating, don't special-case single iterator, instead pass the
    single iterator as both args to FGAIMultiplayerInterpolate().

    Fixed removal of outdated frames using mMotionInfo.erase() - previously
    this was not done if we had done extrapolation, and with interpolation we
    left one too many frames in place.

FGAIMultiplayer::addMotionInfo():
    If simple-time is enabled, apply compensation to MP aircraft's .time fields
    if incoming packets' .time field differs significantly from our local UTC
    time.

    This allows simple-time to work with non-simple-time MP aircraft, or with
    simple-time MP aircraft whose UTC clocks differ from local UTC clock. But
    without the guarantee of consistent rendering across Flightgear instances.

    We don't calculate lag when compensating in this way.

With these changes, scripts/python/recordreplay.py --test-motion-mp passes (the
test sets /sim/replay/simple-time").
2021-04-15 17:23:58 +01:00
Julian Smith
10be9a1b60 src/AIModel/AIMultiplayer.cxx: FGAIMultiplayer::update(): re-indented.
Old indentation was messed up, making it very difficult to work on the code.
2021-04-15 17:23:58 +01:00
Julian Smith
34955d820b scripts/python/recordreplay.py: use simple-time system.
test_motion() now sets /sim/time/simple-time/enabled=true.

Also show any description items - these are generate by related changes to
src/AIModel/AIMultiplayer.cxx.
2021-04-15 17:23:58 +01:00
Julian Smith
70647ffd35 src/Aircraft/replay.*: use getMPProtocolClockSec if /sim/time/simple-time/enabled is set.
Also, when moving MP packets around, medium_term buffer can become empty. Have
added checks for empty short, medium and long term buffers when moving packets.
2021-04-15 17:23:58 +01:00
Julian Smith
745273ab26 src/Aircraft/flightrecorder.cxx: Improved logging of raw speed values. 2021-04-15 17:23:58 +01:00
Julian Smith
cb00971dcb src/Time/TimeManager.*: added simple-time mode.
Simple-time mode is enabled by /sim/time/simple-time/enabled.

Simple-time is implemented by new TimeManager::computeTimeDeltasSimple()
method. This uses a plain UTC clock (e.g. with CLOCK_REALTIME /
gettimeofday()) for basic timing, and sets _mpProtocolClock (as returned by
getMPProtocolClockSec()) to the calculated FDM time.

We use our own fns to get UTC time and for sleeping, because
TimeManager doesn't work for us, e.g. SGTimeStamp::SGTimeStamp() uses
_POSIX_MONOTONIC_CLOCK if available so doesn't return UTC.

So getMPProtocolClockSec() now serves as a consistent time for both the
user aircraft and MP aircraft, avoiding problems where different Flightgear
instances could show aircraft in different relative positions.

For example it can be put into outgoing MP packets (which are about
the time/position of the user aircraft), and used as the target
time when calculating the position of multiplayer aircraft using
interpolation/extrapolation of incoming MP packets.

And getMPProtocolClockSec() can also be written into recordings, ensuring
that multiplayer replay will also show all aircraft with the correct relative
positions, regardless of varying frame rates at record or replay time. This is
tested by 'scripts/python/recordreplay.py --test-motion-mp'.
2021-04-15 17:23:58 +01:00
Julian Smith
ebe4f43abc src/Main/fg_init.cxx: put FGReplay after FGMultiplayMgr and before FGAIManager.
This will improve record and replay of MP packets - we will always see the most
recently-avialbale packets.
2021-04-15 17:23:58 +01:00
Julian Smith
ae9d8ce088 src/Main/fg_init.cxx: fgCreateSubsystems(): group registrations by GroupType.
This is just for code clarity.

It changes the order of construction/registration of subsystems to match the
order in which subsystem groups are called when Flightgear is running.
2021-04-15 17:23:58 +01:00
Julian Smith
d7d87479a9 In subsystem initialisation, don't default to SGSubsystemMgr::GENERAL.
Updated subsystem registrations to specify SGSubsystemMgr::GENERAL explicitly,
which makes things a little clearer.
2021-04-15 17:23:58 +01:00
Julian Smith
1789002417 src/Main/fg_init.cxx: fgCreateSubsystems(): removed unnecessary comments.
The comments in this function were redundant and took up a lot of vertical
space which affected readability.
2021-04-15 17:23:58 +01:00