Transponder-checking code is now done in new static function
checkTransponderLocal() which also sets altitude via an out-param. This
avoids duplicate string comparisons in the previous checkTransponder() and
getAltitude() functions.
Also check for controls/invisible for all aircraft, which could allow ignoring
of AI and Swift aircraft in future.
TCAS::ThreatDetector::checkTransponder() now simply calls
checkTransponderLocal() with a dummy altitude out-param; it doesn't appear to
be used so could probably be removed.
Change the assumption that velocity < 40kt implies the transponder is off, to
only apply to AI aircraft, because exact information is available for other
(i.e. multiplayer and swift) aircraft.
Add new check for multiplayer/swift aircraft where if the altitude is -9999, we
treat the transponder as off.
With swift and multiplayer aircraft, use the transponder altitude information,
not the sim's internal altitude data for the aircraft.
Set up the default camera as a mirror of the VR view when needed, using
a new CameraInfo flag named VR_MIRROR based on a camera property
"vr-mirror" which is set on the default camera group. When set this flag
causes the compositor to be constructed (and reloaded) using
buildVRMirrorCompositor() and osgXR's mirror camera setup code, rather
than the usual Compositor::create().
Implement VR mirror properties and associated getUseMirror() accessor:
- /sim/vr/mirror-mode: This will allow the user to control the VR
mirror via a GUI.
- /sim/vr/mirror-enabled: This isn't written, but is used by
getUseMirror() in combination with isRunning() to determine whether
the mirror should be used.
Use the newly added simgear::Compositor::resetOrderOffset() to reset the
order offset counter with each compositor reload. This prevents the
counter increasing indefinitely, which soon results in render orders
beyond those set statically for the GUI and upcoming VR mirror.
Patch by Michael Danilov: allow an aircraft set XML to define the requied
directory name, and if one is provided, validate the actual name against
this. This catches common issues where a manually downloaded aircraft
has the wrong name and some assets will therefore not load.
SF-Ticket-ID: https://sourceforge.net/p/flightgear/codetickets/2647/
Implement support for virtual reality headsets via version 0.3 of the
osgXR[1] library I've been working on which uses OpenXR.
Add a new VRManager class based on osgXR::Manager to implement its
callbacks. When osgXR needs a new view created, we build a new camera in
the default camera group, and notify osgXR of each new "scene" typed
render pass. It also hooks into the CameraInfo's new compositor reload
callback to ensure osgXR is updated when the compositors are reloaded.
VR settings are controlled by properties, and new --enable-vr /
--disable-vr options are implemented to enable/disable VR at start.
This is enough to get basic VR for looking around the cockpit, but more
work will be required to support a desktop mirror of VR view, VR splash
screen, VR GUI, controller interaction, and correct positional sound.
[1] https://github.com/amalon/osgXR
* Relax runway exit route requirement to 80°
* Ensure parking is only reset if airport for AI aircraft has changed
* Heading Error signed and arrival lead distance
This was a long-standing issue where Canvas cameras were rendered
multiple times, once per slave camera. In the case of the Classic
pipeline they were being rendered twice.
Making them slave cameras has the issue of them not being shared
across GraphicsContexts anymore, so it's not possible to see Canvas
displays in extra CameraGroup windows. This is fixed by using OSG
context sharing feature and sharing the initial windows' context
with all subsequent windows.
Add a compositor reload callback object to CameraInfo, with callbacks
for just prior and after the CameraInfo's compositor is reloaded by
reloadCompositors().
This will allow VR cameras to be reconfigured after a reload.
Add removeCamera() method to CameraGroup to find and remove a single
CameraInfo.
This will allow cameras created for VR to be dynamically reconfigured.
Since 'center on aircraft' is now persistent, we need to expliictly init
this value when showing the map. Thanks to Michael Danilov and Colin
Geniet for the fix.
SF-Id: https://sourceforge.net/p/flightgear/codetickets/2637/
Reversed the affect of mouse in some legacy views, e.g. Helicopter and Pilot
views now move in expected direction for mouse drags. Also increased scale
of movement to make things similar to the default view system.
In chase view etc, apply mouse movements after damping of aircraft orientation,
previously mouse movements were getting damped.
Removed SviewStepFinalToTarget. SviewStepFinal now automatically aims at target
if new posdir.target_is_set flag is true.
Improved double views: Avoid duplicate SviewStepCopyToTarget step. Disabled
mouse drag handling - was gives weird results and is not required or
helpful. Be more consistent in using target position if available, otherwise
eye position; for example using a Helicopter view to create a double view now
uses the target of the helicopter view, not the eye point, which works much
better.
Removed internal use of SviewStepFinal from SviewStepDouble - used to be
special case.
Split mouse drag handling out of SviewStepRotate into new SviewStepMouseDrag.
Simplified last-pair code - both last-pair and last-pair double find position
and target in the same way.
Added <startup-current> param. Default is false which preserves previous
behaviour where internal state is initialised to zero. Otherwise we initialise
internal state using the current error value, which can reduce oscillations.
Added <startup-its> param, default is zero. For the first <startup-its>
iterations we don't update the output, which can be used to cope with initial
bad data from earlier controllers.
Also refactored the code to hopefully make it clearer and modified debug
logging to output all info in a single statement and on a single line for
clarity.
For example avoid initial oscillations with:
<pid-controller>
..
<startup-current>true</startup-current>
...
</pid-controller>
Ever since support for CompositeViewer was added in f62e5b9ce3,
FGEventHandler::eventToViewport() has been always calling
window_builder->getDefaultWindow() so it could decide whether an event was for
the main window or not. But if a custom camera-group was specified, there would
be no existing window called 'FlightGear' so getDefaultWindow() would create
one, which then interfered with event handling.
The fix is to change the global WindowBuilder::defaultWindowName to match
sim/rendering/camera-group/gui/window/name when we are handling a custom
camera-group, which ensures that when FGEventHandler::eventToViewport() calls
window_builder->getDefaultWindow(), it gets the main window, not a new window
called 'FlightGear'.
With Normal recordings, if we are recording multiplayer aircraft, we continue
appending to the in-memory recording while replaying, so we need to stop when
we reach the original end of recorded frames.
New properies so recordreplay can know extent of current in-memory normal
recording:
sim/replay/record-normal-begin
sim/replay/record-normal-end
This is required since scripts/python/recordreplay.py improved checking of
recording length when replaying.
scripts/python/recordreplay.py
src/Aircraft/replay.cxx
src/Aircraft/replay.hxx
src/Aircraft/replay.*:
If /sim/replay/record-continuous-compression is true, we compress each
frame's data as a separate raw zlib stream.
Requires latest simgear's simgear/io/iostreams/zlibstream.cxx for
decompression with ZLibCompressionFormat::ZLIB_RAW. Haven't figured out how
to extend simgear's code to provide a compressing ostream so for now we
have our own local compression code.
We open popup and set sim/replay/replay-error=true if we fail to read
compressed data.
scripts/python/recordreplay.py:
Added test of compressed continuous recordings.
docs-mini/README-recordings.md:
Added information about compressed format.
Allow supression of bad_alloc reports based on a RAII helper. This
will allow reducing backend reports for code-paths where we know bad_alloc
is handled.
When we don't have an explicit attribute, check if the file path mentions the current
aircraft directory. This should fix attribution for some GUI dialogs and property rules.
Re-add this clamping of the terrain wetness value, to avoid out of bounds
values in shaders appearing as black. Thanks to Colin Geniet for the testing and fix.
SF-Id: https://sourceforge.net/p/flightgear/codetickets/2604/
- Always set useDefault to false when calling SGPropertyNode::tie()
- Mass flows can now be specified using SI unit (kg/s)
- Add a new property propulsion/fuel_freeze to freeze fuel consumption.
- Add a new flag DONT_EXECUTE_RUN_IC that can be specified to FGFDMExec::ResetToInitialConditions. When specified, this flag avoid calling FGFDMExec::RunIC when executing FGFDMExec::ResetToInitialConditions.
- Fix a bug in <linear_actuator> that resulted in erroneous output values when the input was oscillating around the zero value.
- Add an assert that forbids to set the value of FGPropertyValue when the property was specified with a minus sign.
- Fix the compatibility with recent versions of MinGW64
- Fix ws2tcpip.h casing for compilation on case sensitive OS.
- Improve the templating of FGPropertyManager::Tie().
- Expand FGParameterValue exception message (James Turner)
- TurboProp: Filters out negative powers when the propeller is not rotating
Re-creating the route-path every update is wasteful, just cache it
until the roue changes. Since we already have similar logic for
the property-tree waypoint mirror, just piggy-back off that.
Also fixed uneven MP carrier motion.
If /ai/models/carrier[]/ai-latch is true (e.g. by MPCarrier.nas), we
set /position/* and /orientation/* in C++ every frame instead of in
nasal. For external multiplayer carriers the values are copied from
/ai/models/multiplayer[]/*, so the AI carrier follows the corresponding MP
carrier exactly. For this to be useful, multiplayer motion needs be smooth,
e.g. with /sim/time/simple-time/enabled=true.
scripts/python/recordreplay.py
Added --carrier test - checks that multiplayer carrier moves with even
speed.
src/AIModel/AIBase.hxx
Added speed_fps, to be kept up to date and tied to velocities/uBody-fps
when we are a carrier. Previously this was set from Nasal which doesn't
do what is required when all updates happen in C++.
src/AIModel/AICarrier.cxx
src/AIModel/AICarrier.hxx
If is-user-craft is true, we directly update /position/* every frame.
If ai-latch is true, we don't call TurnToLaunch(), TurnToRecover(),
ReturnToBox(), TurnToBase() etc, because our position and orientation is
determined only by multiplayer packets.
src/AIModel/AIMultiplayer.cxx
src/AIModel/AIMultiplayer.hxx
If an mp craft is a carrier, MP packets define velocities/speed-kts but
set ecLinearVel to all-zeros. So we now copy across to ensure that the
extrapolation algorithm has a velocity to work with. Previously the zero
velocity caused very uneven motion.
If ai-latch is true we set AI craft's position+velocities directly from
the equivalent (extrapolated or interpolated) MP position, every frame. We
also set AI craft's orientation. And we copy MP's uBody-fps to AI's
velocities/speed-kts which ensures that friction works between carrier deck
and aircraft undercarriage.
Added logging of raw speeds implied by multiplayer packets, activated by
/sim/log-multiplayer-callsign; used by scripts/python/recordreplay.py's
--carrier test.
src/AIModel/AIShip.cxx
Tie velocities/uBody-fps to new speed_fps member and set speed_fps in
update() along with members that are tied to properties.
Replaced code that calculated new position using heading and speed:
Previously the new position after dt was calculated using
ft_per_deg_lat, ft_per_deg_lon, speed_north_deg_sec and
speed_east_deg_sec. But this was moving slightly faster than the
specified speed.
This was leading to incremental errors when a different Flightgear
instance extrapolated the multiplayer position from the information in
multiplayer packets, because the specified velocity was too small, so
we jumped forwards when extrapolation moved to a new packet.
The fix is to use a Quaternion-based calculation to calculate movement
in the direction specified by (heading, pitch, roll), as done by other
code such as the view code.
src/Main/fg_init.cxx
Moved FGAIManager to just before FGMultiplayMgr so we send latest info in
mp packets.
src/MultiPlayer/multiplaymgr.cxx
Fixed minimum transmit rate calculation - if transmit rate is less than 1,
default to 1, not 10.
src/Network/props.cxx
Use more precision when sending double-precision values e.g. to telnet
client. Otherwise for example UTC times don't have sufficient resolution.
src/Viewer/viewmgr.cxx
Generate internal logs of multiplayer position and speed (after
interpolation/extrapolation) if /sim/log-multiplayer-callsign is set. Used
by scripts/python/recordreplay.py's --carrier test.
Try to catch NaN SGGeod position before we pass them to the intersect
visitor, so we don’t fill the console/logs with error messages: we
catch NaNs in other places.
Previously we always used the default download dir, and ignored any
user override of this. Use the active download dir as the base for
the cache dir.
Also write the cache dir to the property tree, and wipe it on a
clean uninstall.
GUIDs aren’t stable across different builds of the cache, which causes
odd behaviour when switching between stable and next. Use idents and
lat-lon instead, since these should be stable.
Avoid a per-update() lookup of the AI controls properties. As part
of this, bypass updatePrimaryTargetValues for the user aircraft,
where it doesn’t make sense.
We previously ignored mp packets if their .time was very different from local
time, but this stops time-compensation (e.g. with simple-time) from working and
is unnecessary because we clean up old packets anyway.
Also removed unnecessary erase of mp packets after interpolation.
When we fail to find the request aircraft, ensure we log the paths
to Sentry. If the user didn’t supply any aircraft paths at all, or
was using a hangar aircraft, adjust the error dialog text, to make
it a bit clearer what is going wrong.
Otherwise a SGSharedPtr is implicitly created on ai_list.push_back(model). It's not clear to the caller that FGAIManager takes care of the passed raw pointer.
Also fixes a bug for swift using the passed dangling pointer after the created SGSharedPtr of FGAIManager got out of scope and deleted the resource.
As this commit mainly addresses the swift crash (also for backport to LTS) it doesn't fix other calls to ::attach(..) which might also use the raw pointer afterwards.
Use a transient index for the poly-lines. This avoids NavCache disk
contention when multiple copies of FG race after the rebuild completes.
Should reduce locking errors early in startup.
Some propellers could start windmilling very easily under mild wind conditions (11 kts). And in stronger wind the propeller could even generate some power and torque strong enough to turn the aircraft upside down.
This was due to the combination of:
- Propellers generating power (wind turbine) for advance ratio higher than 1.0 (is it plausible !?!)
- Powers and torques computed with ludicrously small RPMs.
So this commit basically filters out extremely small RPMs in order to avoid huge numbers resulting from division by small values.
Some spacecraft send out-of-range engine numbers from the JSBsim side.
Should probably be fixed in JSBsim itself but let’s check here to
keep compat with existing FDMs.
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