Need to use simgear::HTTP::FileRequestRef shared pointer, otherwise
HTTPFileRequest will delete it after the transfer.
Also changed callback to a lambda to match reinstated simgear API.
The fgfs executable is the unit within which it makes sense to check
preconditions with assert. We are not in control of aircraft code in the same
way.
This allows debug build of test-suite to check handling of out-of-range view
numbers.
E.g. for --load-tape=http[s]://foo.com/foo/bar/wibble.fgtape, we download in
the background to a file called foo.com_[MD5]_wibble.fgtape, where [MD5] is an
8-character hash of /foo/bar.
We assume any existing file contains valid data and only download any remaining
data (by specifying an http Range header).
Also, when loading/downloading and replaying continuous recordings at startup,
we set the aircraft and airport from the recording.
src/Aircraft/replay.cxx
src/Aircraft/replay.hxx
FGReplay::loadContinuousHeader()
Loads properties from Continuous recording's header, distinguishing
between failure due to incorrect header, or due to a truncated file.
FGReplay::indexContinuousRecording()
Contains Continuous recording indexing code, in a form that can be used
in background while we are downloading.
Added a mutex to protect m_continuous_in_time_to_frameinfo, which can now
be modified in background as Continuous recording is downloaded.
src/Main/fg_init.cxx
src/Main/options.cxx
fgOptLoadTape():
Modified to handle --load-tape=<url>. We start download, and read
the header before returning, so that we can force the FDM to use the
recording's aircraft instead of the user's default. Limit recording
download rate if /sim/replay/download-max-bytes-per-sec is set, by
calling new filerequest->setMaxBytesPerSec().
Recording of extra properties is only supported in Continuous recordings.
Modified Continuous recording format to allow future forwards
compatibility. See docs-mini/README-recordings.md for details. This breaks
compatibility with previously-generated Continuous recordings, but this only
affects next.
To reduce overhead we record all extra property values in the first frame and
then later frames contain only extra property changes. When replaying, if the
user jumps backwards we replay all extra property changes since the start of
the recording. Similarly if the user jumps forwards, we replay any intervening
extra property changes.
Recording extra properties:
This is enabled by:
/sim/replay/record-extra-properties
The extra properties that are recorded are identified by the property
paths in the values of /sim/replay/record-extra-properties-paths/path[]
properties. We record the entire tree for each specified path.
Recording of main window position size:
We have specific support for record and replay of main window position/size.
This is enabled by:
/sim/replay/record-main-window
Recording of main window view:
We have specific support for recording the view type and direction/zoom
settings.
This is enabled by:
/sim/replay/record-main-view
We record the /sim/current-view/ property tree, excluding some subtrees
that continuously vary but are not required for replaying of the view.
When replaying, we allow separate control of what extra property changes are
replayed, with:
/sim/replay/replay-extra-property-changes
/sim/replay/replay-extra-property-removal
/sim/replay/replay-main-window-position
/sim/replay/replay-main-window-size
/sim/replay/replay-main-view
We work around some problems caused by the use of tied properties when
replaying changes to view-number.
Window position issue:
When replaying window position and size changes, things get a little tricky
because osgViewer::GraphicsWindow::setWindowRectangle() takes a position
for the entire window, but osgGA::GUIEventAdapter::RESIZE events contain
the position of the interior of the window; for example the y values will
differ by the height of the window's titlebar. This can cause windows to
move progressively further down each time they are positioned or resized.
There doesn't seem to be a way of finding the size of a window's
furniture directly. So instead this commit adds a new method
osgGA::GUIEventAdapter::setWindowRectangleInteriorWithCorrection() which
wraps osgViewer::GraphicsWindow::setWindowRectangle(). We listen for the
following osgGA::GUIEventAdapter::RESIZE event and calculate corrections
for x and y position that are used for subsequent calls.
docs-mini/README-recordings.md:
Updated to document new Continuous format.
scripts/python/recordreplay.py:
New script to test various aspects of record/replay.
Other:
We now create convenience softlink to most recent continuous recording, using
SGPath::makeLink(). Note that SGPath::makeLink() currently does nothing on
Windows.
Changed format of Continuous recordings to contain a single property tree
in header. This is much simpler than having separate Config and Meta trees.
It was supposed to be in ft/min, but everything except AIAircraft was
using it as ft/sec. Change the name to AIBase::vs_fps and ensure the
same unit is used everywhere.
QML implementation of getting started tips, with a nice styled
background box. Tips are defined+positioned inline, and displayed
when their enclosing scope is active.
Translocation forces us to rebuild the nav-cache each launch, and might
mess up some other details, so let’s warn the user they should copy
the app to Applications or similar.
If the user double-clicks, and their system is slow, the action can
fire twice, which then breaks because we add options twice.
Sentry-Id: FLIGHTGEAR-HKV
Move forward 1 metre in tower view look from, to slightly improve view of
ground near tower.
Removed incorrect attempt to move towards target in other tower views, that
didn't work.
This means that the image on screen moves by the same distance as the mouse
(for small movements), regardless of window size or zoom level. Current mouse
drag handling in extra view windows is poor though - mouse is constrained by
screen size.
Would be good to do this for standard views as well, but the code in view.cxx
is more complex so haven't been able to figure out how.
Allow the option to have the marker beacon instrument use either the
correct timing, or ‘always on’ when the beacon is in range. Try to
ensure the audio is synchronised with the visual property. by using
the same timing values.
Also avoids losing sync when using the ‘audio-btn’ toggle, and increases
the update rate to allow accurate timing. Finally, switch from tied
properties to regular ones, so listeners on the beacon properties are
updated directly.
Configure the VPB elevation mesh via properties:
/scenery/elevation-mesh/sample-ratio controls the elevation
mesh sampling, allowing reduction in mesh size
/scenery/elevation-mesh/vertical-scale is just for fun and
scales the mesh vertically making mountains taller.
/scenery/elevation-mesh/constraint-gap-m controls how much below
airports etc. elevation vertices are forced to be.
[Marked as 'Partial' because, for me, reset eventually runs out of memory with
both composite-viewer and non-composite-viewer.]
fgStartNewReset(): pass existing composite_viewer to FGRenderer constructor so
that it is used after reset instead of us creating a new instance. Also reuse
existing osgViewer::View.
In FGRenderer::init(), don't create new osgViewer::CompositeViewer if
this->composite_viewer is already set.
- Summary.qml - new row with Flight Plan info
- LauncherController.hxx, Launcher.qml - signals to show flightPlan &
exposing flight plan object
- FlightPlan.qml - add red color to information about airport mismatch
- FlightPlanController.cxx, FlightPlanController.hxx - description
handling, support to loading flight-plan from command line argument
'flight-plan', saving last used dir when loading/saving flightplans
Fixes https://sourceforge.net/p/flightgear/codetickets/2521/
For submodels with rotation offsets, the rotation was applied to the
translation offset.
This is incorrect: translation offsets should be in the aircraft local
frame, and thus are not affected by submodel rotation offsets.
This scales all LOD ranges and was added in an attempt
to control WS3.0 LOD ranges. However it badly impacts
WS2.0 draw distances, and is not the right solution
for WS3.0. So removing.
Elevation constraints are now added by the ReaderWriterSTG
for all OBJECT entries, so aren't explicitly required for
the .icao loader. This also allows us to clean up the BVH
generation, as the constraint is added after the model loading
is completed and the BVH policy applied.
Previously WS3.0 airports could be placed via .stg
file.
Now they are OBJECT entries rather than OBJECT_STATIC
and the placement information is taken from the apt.dat file.
Also added as elevation constraint for WS3.0 terrain.
Setting useDefault to true is equivalent to using unitialized variables we are getting whatever is currently in the memory whether it is relevant or not.
avoids an exception throw when the controller fails to init, which
avoids us breaking the stack when called via setMode, etc. Showed
up as error reports on Sentry.
Make this exception inherit std::runtime_exception, so that it’s
caught by the ‘normal’ exception cases in FG boostrap.cxx
This is the only exception I can find in the codebase, which does not
inherit from either std::exception or std::string, so this is to fix
‘unknown exception’ errors reported in the wild.
Sentry-Id: FLIGHTGEAR-1C
It seems that some aircraft sometimes incorrectly pass view indices rather
than numbers resulting in out-of-range access to FGViewMgr::views[]; See
flightgear-devel thread with subject "View crash (after loading errors)".
With this commit, if we are given an incorrect view number, we output a
diagnostic with SG_ALERT, assert fail, and cope with the problem. Arguably we
could do something more serious such as opening a popup or throw an exception.
We now attach global event handler to extra view windows so key presses are
handled as normal.
And the main event handler for mouse movements now calls new SviewMouseMotion()
which pans/tilts extra view windows in response to right-button mouse-drag.
Check for NaNs after each FDM iteration, and freeze the sim if found.
Report this condition to the user and to the reporting backend, along
with the last valid position.
Probably needs some refinement, this is just a first guess.
Sentry-Id: FLIGHTGEAR-AM
When in LEG mode, and within the intercept cone, but further away from
the leg waypoint than the leg origin, we were computing a bogus
abeam point and hence a bogus desired track.
Detect this situation, and invert the computed along-track-distance,
so the computed abeam point is actually near where we are, and not ahead
of us.
- exclude POIs and some other types from the ident match, to avoid
confusing results
- improve how the search vicinity is computed when inserting a leg,
which is the common case for a route with a destination set. Use
the midpoint of the leg ending at the insert position, as the optimal
search vicinity
- move the waypointFromString code into route.cxx, since it is mostly
independent of a FlightPlan instance
- extend the tests to cover the bug which flagged these issues
Ticket-Id: https://sourceforge.net/p/flightgear/codetickets/2372/
Prevent errors from property code when leading / trailing whitespace
occurs in the autopilot XML, in a property path. Use strutils::strip
to remove whitespace.
Ticket-Id: https://sourceforge.net/p/flightgear/codetickets/2445/
SviewCreate() now takes a SGPropertyNode* config which contains all information
needed to specify the view, including window size and position.
By default views are defined using a series of <step>...</step> nodes which map
to SviewStep* classes internally.
Alternatively, existing extra-view functionality is supported using
type='current', 'last_pair' or 'last_pair_double', plus one can use old-style
<view>...<view> nodes with type='legacy'.
See src/Viewer/sview.hxx for details and examples.
The extra-view commands view-clone, view-last-pair and view-last-pair-double
now pass the supplied SGPropertyNode* through the underlying FGViewMgr to
SviewCreate().
Improved handling of +/- heading and pitch values. For example some legacy
views have inverse relationship between heading-offset-deg and the actual
heading offset, so we now only multiply by -1 early on when handling these
legacy views, and SviewStepRotate does not negate.
Fixed Helicopter view direction bug with multiplayer aircraft - need to use
global /sim/current-view/heading-offset-deg, even for multiplayer aircraft.
Fixed incorrect handling of roll in pilot view - when adding in extra changes
of heading, pitch and roll to things like Helicopter view, simply adding to
heading, pitch and roll doesn't work if aircraft roll is not zero. Instead we
need to do the calculation with SGQuatd, so have added optional rotation params
to SviewStepFinal.
Added support for legacy Tower view look from.
Details:
src/Main/fg_commands.cxx
src/Viewer/viewmgr.cxx
src/Viewer/viewmgr.hxx
Added 'view-new' command.
All recently-added view commands now pass the SGPropertyNode* arg to
globals->get_viewmgr() and from there to SviewCreate().
src/Viewer/sview.cxx
src/Viewer/sview.hxx
SviewStepAircraft and SviewStepNearestTower uses new Callsign
class for tracking multiplayer aircraft by callsign instead of
/ai/models/multiplayer[] number, so we cope when multiplayer aircraft
are renumbered by network outages.
Double views are now implemented as a final view step, instead of
in a separate class derived from SviewView. So all views are
implemented using SviewViewEyeTarget, and there is arguably no
need for the separate SviewView base class.
SviewViewEyeTarget now has a single list of steps, instead of separate
lists for eye and target, because the use of SviewStepCopyToTarget makes
separate lists unnecessary.
Chase distances are supposed to be negative. Otherwise in external views
vertical mouse moves have reversed behaviour when changing view angle. E.g.
see:
https://sourceforge.net/p/flightgear/codetickets/2454
src/MultiPlayer/multiplaymgr.cxx
Fix +ve chase-distance-m for multiplayer aircraft.
src/Viewer/viewmgr.cxx
Fix +ve chase-distance-m for user aircraft.
Gives the ability to define graphics settings via an XML file at
startup or later during runtime. Tracks if changes to graphics settings
required additional actions (eg, scenery reload or restart of the sim)
When a preset is active, and properties are modified, the system will
detect this and mark the preset as edited.
For FGAIBallistic objects affected by wind, speed vector denotes airspeed.
However, submodels initialize the speed vector using ground speed of the
parent aircraft, instead of its airspeed.
In effect, this means that wind is added to the initial airspeed,
or 'wind is applied twice on initialization'.
This was very noticeable when releasing a submodel with strong sidewind:
the submodel immediately starts drifting laterally at the speed of wind.
Fix the issue by subtracting wind vector from initial speed in
FGSubmodelMgr::transform for submodels affected by wind.
Overview:
Previously Flightgear always used a single osgViewer::Viewer(), which
inherits from both osgViewer::ViewerBase and osgViewer::View, giving a
single view window.
If CompositeViewer is enabled, we instead use a osgViewer::CompositeViewer
which contains a list of osgViewer::View's. Each of these View's can have
its own eye position, so we can have multiple different views of the same
scene.
Enable at runtime with: --composite-viewer=1
Changes to allow use of osgViewer::CompositeViewer:
Previously FGRenderer had this method:
osgViewer::Viewer* getViewer();
This has been replaced by these two new methods:
osgViewer::ViewerBase* getViewerBase();
osgViewer::View* getView();
If CompositeViewer is not enabled (the default), the actual runtime state
is unchanged, and getViewerBase() and getView() both return a pointer to
the singleton osgViewer::Viewer() object.
If CompositeViewer is enabled, getViewerBase() returns a pointer to a
singleton osgViewer::CompositeViewer object, and getView() returns a
pointer to the first osgViewer::View in the osgViewer::CompositeViewer's
list.
The other significant change to FGRenderer() is the new method:
osg::FrameStamp* getFrameStamp()
If CompositeViewer is not enabled, this simply returns
getView()->getFrameStamp(). If CompositeViewer is enabled it returns
getViewerBase()->getFrameStamp(). It is important that code that previously
called getView()->getFrameStamp() is changed to use the new method, because
when CompositeViewer is enabled individual osgViewer::View's appear to
return an osg::FrameStamp with zero frame number).
All code that uses FGRenderer has been patched up to use the new methods so
that things work as before regardless of whether CompositeViewer is enabled
or not.
We make FGRenderer::update() call SviewUpdate() which updates any extra
views.
Extra view windows:
If CompositeViewer is enabled, one can create top-level extra view windows
by calling SviewCreate(). See src/Viewer/sview.hxx for details.
Each extra view window has its own simgear::compositor::Compositor
instance.
Currently SviewCreate() can create extra view windows that clone the
current view, or view from one point to another (e.g. from one multiplayer
aircraft to the user's aircradt) or keep two aircraft in view, one at a
fixed distance in the foreground.
SviewCreate() can be called from nasal via new nasal commands "view-clone",
"view-last-pair", "view-last-pair-double" and "view-push". Associated
changes to fgdata gives access to these via the View menu. The "view-push"
command tags the current view for later use by "view-last-pair" and
"view-last-pair-double".
Extra view windows created by SviewCreate() use a new view system called
Sview, which allows views to be constructed at runtime instead of being
hard-coded in *-set.xml files. This is work in progress and views aren't
all fully implemented. For example Pilot view gets things slightly wrong
with large roll values, Tower View AGL is not implemented, and we don't
implement damping. See top of src/Viewer/sview.cxx for an overview.
OpenSceneGraph-3.4 issues:
OSG-3.4's event handling seems to be incorrect with CompositeViewer -
events get sent for the wrong window which causes issues with resize and
closing. It doesn't seem to be possible to work around this, so closing
extra view windows can end up closing the main window for example.
OSG-3.6 seems to fix the problems.
We warn if CompositeViewer is enabled and OpenSceneGraph is 3.4.
Avoid passing missing add-ons to FlightGear. Since we only write a
cleaned list back to QSettings upon some user change, we can persist
bad paths.
Sentry-Id: FLIGHTGEAR-NG
This very first query was left un-finalized, which apparently blocks
another process from obtaining the exclusive lock needed to
COMMIT. Found using the trace funtions, phew.
Sentry-Id: FLIGHTGEAR-8C
Sentry-Id: FLIGHTGEAR-8F
- Removed the ENABLE_COMPOSITOR CMake flag.
- Removed /sim/version/compositor-support.
- Removed miscellaneous branching to check if the Compositor is enabled.
- Removed custom resource loader since Compositor Effects are now located in $FG_ROOT/Effects.
- Removed splash screen warning.
- Only use the Compositor versions of CameraGroup and FGRenderer.
- Fix redout/blackout not appearing under certain circumstances.
Previously the center of the airport was defined with the correct
elevation, but the runways etc. were built at 0 elevation.
This makes everything at 0 elevation so we can set the elevation
in the STG file for the moment.
Don’t probe for, or pass, missing paths to FlightGear. Since we don’t
show such paths in the UI, they hang around forever, causing exceptions
Sentry-Id: FLIGHTGEAR-NG
If impatient users start multiple copies of FlightGear when a cache
rebuild is required, we can get into a mess. Use an additional
named mutex on Windows to avoid this situation, and block the secondary
copies until the primary instance has completed its cache rebuild.
Sentry-Id: FLIGHTGEAR-8D
Sentry-Id: FLIGHTGEAR-FY
* Fall back to Ocean climate if the koppen-geiger image is not found.
* Fixes to temperature calculations based on viewer and sun lat and lon.
* Fix season and day progress factors, add an autumn progress factor.
* Set the environment parameters like ice-cover, dust-cover and wetness:
for now always active, should be a menu option in the future.
* Add a compile-time option to dump a climate report to the console.
We previously only showed the magnitude of the thrust; this patch uses the sign
of first element of thrust vector. Makes things less confusing if an engine is
stopped or otherwise causing drag rather than thrust.
Uses these properties:
/sim/atis/speed
/sim/atis/volume
/sim/atis/pitch
Values 1.0 behave as default. Other values are used to multiply default
settings.
Changes don't take affect immediately. But changing com frequency seems to
often cause an update which will then pick up the new values.
Increased diagnostics from SG_WARN to SG_ALERT, to mitigate confusion if METAR
is out of date etc.
Will add a better mechanism for reporting errors at some point.
Changing style will reload style from filesystem, so one can edit styles and
see results without restarting fg.
Note that this duplicates initial populating of /gui/styles/ from
defaults.xml's <sim><gui>...</gui></sim> section, so it's a bit of a hack.
If user specified --load-tape then failure to load it should be fatal to avoid
confusion. It also avoids needlessly overwriting a valid recovery tape if
/sim/replay/recovery-period is set.
Throwing an exception was too harsh. Instead the clipping is ignored and a warning message issued.
Reintroducing the commit 90a04a that has been inadvertently removed.
These were due to the ground callback instance of FlightGear not setting the ellipse parameters of the 'contact' location. this commit make JSBSim immune to that scenario.
Includes the following new features and bug fixes:
- The <random> function now uses C++ std::default_random_engine
- WGS84 is now used everywhere in JSBSim (previously a mix of spherical/WGS84 earcth was used resulting in inaccuracies).
- A new <planet> XML element can be used to tweak the planet characteristics (such as semimajor/smemiminor axes, gravity, etc.)
- The FGGroundCallback instance is now managed by FGInertial with a dynamic pointer std::unique_ptr<>. JSBSim was previously using a static pointer which was causing memory access failures when several instances of JSBSim were used or when an instance was replaced by a new one (the structure pointed to by the static pointer was then lost when the old instance was destroyed).
- Removed calls to exit() and replaced them by exceptions that can be caught by FlightGear (should avoid FlightGear from being ungracefully stopped by an error found by JSBSim).
- Sockets interface: replaced the usage of obsolete functions gethostbyname()/gethostbyaddr() by getaddrinfo().
- FGColumnVector3 and FGMatrix33 can now be initialized by C++ std::initializer_list
- Disable the delays implemented in some flight control components during trimming (was sometimes preventing the trim algorithm from converging to a solution).
- Fixed the magnetometer initialization (was not updated during the first 1000 time steps)
- More conversions to C++11 features (nullptr, override, std::unique_ptr<>, etc.).
Since our data encoding is incompatible between 2018 and 2020, use
different settings keys so running both versions in parallel is easier.
Without this, each version screws up the data for the other.
When local aircraft scanning is slow, we can end up clearing
the locale while a scan is in progress, which crashes. Ensure we
abandon any in-progress scan when closing the launcher.
Sentry-Id: FLIGHTGEAR-CH
Add pop-up notification when we migrate to a new version of a hangar.
Convert the ‘new version available’ message to use a pop-up
notification as well.
Avoid filling up the logs when the launcher parses broken aircraft XML;
wait until the user actually pick one to fly with, before reporting
XML errors.
This is to avoid console/log spam from jetways.nas in particular,
which uses loadxml to probe for file existence, every 10 seconds. But
in general it seems useful to have this potentially be quiet, since
there is a result code.
AirportDyanmics::innerGetActiveRunway can unfortunately return an
empty string even when it return ‘true’. Check for this in the wrapper,
and switch to the fallback, to avoid returning a bogus runway to
other parts of the code.
Sentry-Id: FLIGHTGEAR-39
This causes QApplication to become unhappy and crash, so use a
graceful exit via a new return code and FG_OPTIONS_EXIT instead.
Sentry-Id: FLIGHTGEAR-6B
Fix the include context when -set.xml are parsed by the launcher to
extract states and other data. Ensure aircraft paths are available
and handled consistently with normal -set.xml parsing. Without this,
many -set.xmls fail to parse.
Sentry-Id: FLIGHTGEAR-4H
Sentry-Id: FLIGHTGEAR-3B
Sentry-Id: FLIGHTGEAR-3R
Sentry-Id: FLIGHTGEAR-3Q
Sentry-Id: FLIGHTGEAR-3F
Sentry-Id: FLIGHTGEAR-2R
Sentry-Id: FLIGHTGEAR-65
Sentry-Id: FLIGHTGEAR-42
FGCom was added to the wrong group, leading it to be shutdown after
FGSoundManager, and hence, after OpenAL wad closed, which causes
crashes.
Sentry-Id: FLIGHTGEAR-66
Adjust the wording and links for these pages, after a review session
with Stuart and others. Include a link to the manual and short-ref
from the local installation.