1
0
Fork 0
Commit graph

14484 commits

Author SHA1 Message Date
Julian Smith
f71624e170 src/Viewer/viewmgr.cxx: allow aircraft to set initial view number.
E.g. fgaddon/Aircraft/Icaro_MRX13/Icaro_Laminar_13_MRX-set.xml sets
/sim/current-view/view-number to 9.

It seems that recent View changes broke this, but this fix is in unchanged
code.
2019-08-14 11:07:32 +01:00
Richard Harrison
fa0fb9bc06 Merge /u/cgdae/flightgear/ branch next into next
https://sourceforge.net/p/flightgear/flightgear/merge-requests/173/
2019-08-13 03:56:33 +00:00
Julian Smith
e6cfb56de0 src/Viewer/view.cxx: fix for regression in handling of /sim/current-view/?-offset-m.
Prior to the recent multiplayer view changes, /sim/current-view/?-offset-m
contained the current view's offsets from /sim/view[]/config/?-offset-m. The
multiplayer view changes modified things to set /sim/current-view/?-offset-m
to zeros, and instead use /sim/view[]/config/?-offset-m. This was so
that multiplayer views could be implemented simply by prefixing with
/ai/models/multiplayer[]/set/ to get the right offsets.

We still added in /sim/current-view/?-offset-m, but these were usually zero.

However some aircraft write to /sim/current-view/?-offset-m, and assume that
values must include the /sim/view[]/config/?-offset-m. E.g. the spaceshuttle
does this in order to simulate SRB shaking. This results in the offset being
included twice, which breaks things.

So this commit restores the original handling of /sim/current-view/?-offset-m
by doing an additional subtraction of /sim/view[]/config/?-offset-m. It also
avoids resetting /sim/current-view/?-offset-m to zeros when the view changes.

This results in views working for user aircraft, user aircraft that do custom
view handling, and multiplayer aircraft.
2019-08-12 17:59:49 +01:00
Bertrand Coconnier
0b56397562 Sync'ed JSBSim
- [Backward compatibility breakage] Gyros are now measuring rotation rates instead of rotational accelerations. Gyros that measure rotational accelerations do not exist in the real world.
- Output properties of flight control elements are no longer tied. This saves a lot of spurious warning messages and allows direct references of the same properties among several flight controls.
- Water vapor in the atmosphere is now managed through its mass fraction rather than its partial pressure. The former being the physical quantity that is conserved when pressure and temperature vary.
- Check that there are at least 3 contacts before trying to trim on ground.
- ECEF to ECI frame conversion has been moved from FGLocation to FGPropagate and FGInitialConditions since not all FGLocation need to manage that.
- Gravity computations have been moved to FGInertial because it is where all the constants to compute gravity are stored. This reduces the amount of data transmitted between FGInertial and FGAccelerations.
- Added optional transmission of the simulation time for FG UDP interface
- Code cleanup and use more C++11 idioms (override, constexpr, range-based for loop, etc.)
2019-08-10 13:10:28 +02:00
Julian Smith
377d1c9464 src/Viewer/view.cxx: improved zooming in Tower View AGL.
We now keep the aircraft in view when zooming, sacrificing the view of the
ground. I.e. we move the bottom of the view upwards, while keeping the top of
the view unchanged.
2019-08-10 00:02:44 +01:00
Julian Smith
1facdee3f6 src/Viewer/view.cxx: In Tower View AGL, fixed handling of aircraft with no chase-distance.
Recent changes to ViewPropertyEvaluator mean that
ViewPropertyEvaluator::getDoubleValue() doesn't handle default values very
well, so we were ending up with chase-distance of zero, not the default -25,
leading to over-zooming.
2019-08-09 14:02:29 +01:00
Julian Smith
4f4a793f80 src/Environment/environment_mgr.cxx: update nearest tower more frequently.
Changed interval from 30s to 10s - it appears to take only around 0.1ms so this
seems ok and improves the user experience.

---------------------
2019-08-09 12:56:19 +01:00
Julian Smith
a89fbc40aa src/Viewer/view.*: avoid confusing zooming artifacts in Tower View AGL mode.
Un-caching of scenery appears to happen fairly often, and means that we fail
to find height of ground under aircraft, so we now go back to the last found
value instead of using zero.
2019-08-09 12:56:19 +01:00
Julian Smith
e3b3f40f0a src/Viewer/view.*: in Tower View etc, use tower nearest to the multiplayer aircraft. 2019-08-09 12:56:19 +01:00
Julian Smith
c2f542b085 src/Environment/environment_mgr.cxx: find nearest airport/tower to viewed multiplayer aircraft.
This allows Tower View etc to use nearest tower when vewing remote multiplayer
aircraft.

Also force an update of nearest airport whenever multiplayer view changes, to
reduce delay before Tower View works.
2019-08-09 12:55:24 +01:00
Julian Smith
da5fe03851 src/Viewer/ViewPropertyEvaluator.*: added support for dumping info about a single spec. 2019-08-08 11:31:44 +01:00
Julian Smith
83e98653c7 src/Viewer/view.cxx: fix fly-by view offset.
Need to treat /sim/view[]/config/root="" as "/".
2019-08-08 11:30:30 +01:00
Julian Smith
3b77ca4ce8 src/Viewer/view.: removed some now-unused code. 2019-08-08 11:30:12 +01:00
Ferran Obón Santacana
a0f47c151c Fix shadowing of static variable in ITM adiff() function 2019-08-07 16:02:45 +02:00
Julian Smith
af538746ac src/Viewer/viewmgr.cxx:FGViewMgr::setView(): don't call update(0).
This fixes transient view corruption when view is changed (e.g. by v or V).
2019-08-05 07:33:26 +01:00
Julian Smith
92c934f410 src/Viewer/ViewPropertyEvaluator.*: fixed bug with non-existent property nodes.
The fix is to call globals->get_props()->getNode with create=true, so that we
get to hear about changes to property nodes that do not currently exist.
2019-08-05 07:33:26 +01:00
Julian Smith
f00cfeaa02 src/Viewer/view.cxx: use /sim/current-view/view-number-raw.
Requires latest fgdata, and fixes problem with non-sequential view numbers,
e.g. on 777.
2019-08-05 07:33:26 +01:00
Torsten Dreyer
ca2072bf74 silence a warning (initialization order) 2019-08-01 17:34:11 +02:00
Torsten Dreyer
2ba77f7f73 ints can't be NULL 2019-08-01 17:29:12 +02:00
Torsten Dreyer
d34bcf0422 whitespace formatting issues. No functional change 2019-08-01 17:26:43 +02:00
Edward d'Auvergne
42459c05d1 TestSuite: Activation of a few unit tests not being run as CTests. 2019-07-30 15:54:25 +02:00
Scott Giese
f55d7c3c37 [ViewPropertyEvaluator] assert does not compile. 2019-07-29 10:31:33 -05:00
Richard Harrison
e8a50475ec Mutiplayer: increase log level for potential problems;
This is partly experimental to see how often these occur; but also errors in MP packets should be more visible to the developer.
2019-07-29 14:33:45 +02:00
Julian Smith
d71f8daa86 Revert "src/MultiPlayer/multiplaymgr.cxx: don't overwrite /sim/multiplay/visibility-range-nm if already set."
This reverts commit 4a067e721f.
2019-07-27 15:42:17 +01:00
Julian Smith
f770dc1c50 src/Viewer/viewmgr.cxx: FGViewMgr::unbind(): call new ViewPropertyEvaluator::clear().
Frees all ViewPropertyEvaluator's SGPropertyNode_ptr's.
2019-07-27 08:47:28 +01:00
Julian Smith
dfb94c6cc6 src/Viewer/view.*: use new ViewPropertyEvaluator system.
Allows recently-modified multiplayer View code to run without overheads.
2019-07-27 08:47:28 +01:00
Julian Smith
bf29e469b0 src/Viewer/ViewPropertyEvaluator.*: added ViewPropertyEvaluator system.
Evaluates and caches nested properties.
2019-07-27 08:47:17 +01:00
Julian Smith
e778848dcb src/Viewer/view.cxx: fixed breakage of /sim/current-view/internal.
Breakage was introduced by the Tower AGL / multiplayer view changes.
2019-07-26 18:59:59 +01:00
James Turner
28398fd041 FGQCanvas: screen handling argument (for RPi4)
Allow the QScreen to be specified, trying to get dual-screen output
working correctly on my RPi4
2019-07-25 16:03:47 +01:00
Bertrand Coconnier
2fe0137e92 [JSBSim] Fixed a actuator SEGFAULT when triggering "hardover" without specifying <clipto>. 2019-07-24 23:15:40 +02:00
Julian Smith
f666a551b3 src/Viewer/view.cxx: Fix bad initialisation of SGVec3d's.
SGVec3d's default constructor leaves the fields uninitialised, which seems to
sometimes break fg with lots of NaN-related diagnostics.

The fix is to use SGVec3d::zeros() instead.

Also call resetOffsetsAndFOV() from the View::View() constructor, to ensure
that things are set up consistently.
2019-07-22 14:05:54 +01:00
Julian Smith
9a67910899 src/MultiPlayer/multiplaymgr.cxx: don't create view 8.
View 8 used to be new Tower View AGL view, but this interfered with hard-coded
aircraft view numbers. So fgdata now has removed Model View, meaning Tower
View AGL uses Model View's old number (7), which keeps sequential view numbers
unchanged.
2019-07-20 22:04:35 +01:00
James Turner
ed0a009224 Merge /u/cgdae/flightgear/ branch next into next
https://sourceforge.net/p/flightgear/flightgear/merge-requests/166/
2019-07-18 20:21:36 +00:00
James Turner
f643100dad Avoid a warning when inserting nil into a FP
This avoids the warning when procedure construction fails, and we have
a nil result rather than an empty vector as the arg.
2019-07-15 14:37:29 +01:00
Julian Smith
5990ba92f8 src/MultiPlayer/multiplaymgr.cxx: use std::initializer_list instead of C array.
After review. This simplifies iterating.
2019-07-04 13:16:22 +01:00
Julian Smith
2888eb00de Various fixes to view/multiplayer code after review.
src/MultiPlayer/multiplaymgr.cxx
src/MultiPlayer/multiplaymgr.hxx
    removed starts_with() and ends_with() - already provided in simgear::.
    removed output() fn for SGPropertyNode, as unused.
    added makeStringPropertyNameSafe().
    FGMultiplayMgr::addMultiplayer(): use std::find_if() to find model file.
    added FGMultiplayMgr::subsystemName().
src/Viewer/view.cxx
src/Viewer/view.hxx
    removed getDoubleValue() as not required.
    moved agl code into new View::handleAGL() fn.
    renamed View::Damping::setGet() => View::Damping::updateTarget().
2019-07-04 13:16:22 +01:00
Julian Smith
a0ee3a4cc4 src/Viewer/renderer_legacy.cxx: fixed compiler warning about initialisation ordering. 2019-07-04 13:16:22 +01:00
Julian Smith
4a067e721f src/MultiPlayer/multiplaymgr.cxx: don't overwrite /sim/multiplay/visibility-range-nm if already set.
This allows it to be set e.g. in ~/.fgfsrc with --prop.
2019-07-04 13:16:22 +01:00
Julian Smith
5772325bc6 Allow most default views to work on multiplayer aircraft as well as the user's aircraft.
Currently this works for all the default views except for Tower Look From (for
which it doesn't really make sense) and Fly-by View.

We now search for and load a -set.xml that matches the model .xml,
when new multiplayer aircraft is set up. This allows us to find view
offsets etc, e.g. allowing cockpit and helicopter views to work with
multiplayer aircraft. Properties from the -set.xml are placed into
/ai/models/multiplayer[]/set, so for example viewing offsets are in
/ai/models/multiplayer[]/set/sim/view[]/config/target-{x,y,z}-offset-m. We also
copy the aircraft's chase-distance into the view config params, similar to how
fgdata:defaults.xml does for the user's aircraft. And we also fill in views'
missing offsets from the Helicopter View config; e.g. this enables the new
Tower View AGL to show aircraft correctly centred, despite aircraft currently
not having this view defined in their -set.xml. [We don't currently attempt to
cache or reuse -set.xml data.]

Have ensured that view position responds to mouse movement in the same way for
viewing the user's aircraft as for multiplayer aircraft (previously, Model View
reversed the affect of vertical mouse movements).

Added new Tower AGL view. Behaves similarly to Tower view, but automatically
scales and pans vertically in order to always show the vertical range
extending from just above the aircraft down to the ground immediately below
the aircraft. We use aircrafts chase-distance as an indication of size. We
damp the ground level value to reduce the viewing jumping around too much
e.g. if the aircraft flies over buildings. The amount of damping is set by
fgdata:defaults.xml's lookat-agl-damping value.

Fixed problem where Tower View eye position moves slightly as target
aircraft heading changes. This was caused by us unnecessarily applying the
aircraft-centre correction to the eye position.

src/FDM/flight.cxx: also make /orientation/true-heading-deg. This allows
local orientation to be used like multiplayer orientation, which only
has /ai/models/multiplayer[]/orientation/true-heading-deg. [A better fix
might be to replace all occurrencies of /orientation/true-heading-deg with
/orientation/heading-deg, but this would be a rather large commit.]

Details:

src/Viewer/view.*: removed View::updateData() as is no longer required.

src/MultiPlayer/multiplaymgr.cxx: use helicopter view target offsets as
defaults. E.g. in tower view agl, aircraft won't currently be defining these
offsets. More generally, this allows aircraft to define target offsets only in
helicoter view.

src/FDM/flight.cxx
    FGMultiplayMgr::FillMsgHdr(): Added tie of /orientation/true-heading-deg to
    get_Psi_deg, so it duplictes the existing /orientation/heading-deg.

src/MultiPlayer/multiplaymgr.cxx
src/MultiPlayer/multiplaymgr.hxx
    FGMultiplayMgr::addMultiplayer(): look for and load -set.xml that matches
    the model. Patch various view-related things up in similar way to what we
    do for the user's aircraft, so that multiplayer views work.

    Made FGMultiplayMgr::getMultiplayer() public, so it can be used by
    src/Viewer/view.cxx.

src/Viewer/view.cxx
src/Viewer/view.hxx
    View::View(): Added lookat_agl, lookat_agl_damping params for new Tower
    View AGL. Preserve user's field-of-view in separate variable so that Tower
    View AGL can modify the actual field of view independently.

    Added view_index param so that we can find multiplayer view[]/config/
    properties.

    getViewOffsets(): new fn that finds view offsets for user aircraft or
    multiplayer aircraft.

    View::recalcLookFrom() View::recalcLookAt: Lots of changes to allow things
    to work with multiplayer aircraft. View::recalcLookAt() can now do Tower
    View AGL.

    View::Damping: support for damping, used by Tower View AGL. Might be good
    to use this for other damping.

    View::updateData(): removed, as calculations are now all done inside
    View::recalc*().

    put properties {x,y,z}-offset-m into new View::_adjust_offset_m member
    instead of _offset_m. This avoids confusion between a view's offsets and
    the offsets added in by the user via the 'Adjust View Position' dialogue.

src/Viewer/viewmgr.cxx
    FGViewMgr::init(): pass view number to
    flightgear::View::createFromProperties().
2019-07-04 13:16:22 +01:00
Edward d'Auvergne
34a6cb3c74 SGSubsystem classes: Registration of all subsystems. 2019-07-01 14:51:32 +02:00
Edward d'Auvergne
d259c70560 SGSubsystem classes: Addition of staticSubsystemClassId() to all subsystems. 2019-07-01 14:51:32 +02:00
Edward d'Auvergne
0eb8716d45 Autopilot components: Switch to using the subsystem name.
The _name, get_name(), and set_name() variables and functions have been removed.
The Component::get_name() function is now handled by Subsystem::subsystemId(),
and Component::set_name() replaced by SGSubsystem::set_name().  The
Component::_name variable is replaced by SGSubsystem::_subsystemId.
2019-07-01 14:27:30 +02:00
Edward d'Auvergne
332c240b38 SGSubsystemGroup: Removal of the subsystem group naming.
This is a partial reversion of 5253215065, the
changes of which are incompatible with the subsystem class IDs.
2019-07-01 14:27:30 +02:00
Edward d'Auvergne
fb5c36fc82 SGSubsystem classes: Renaming of the subsystem ID variables and functions. 2019-07-01 14:27:30 +02:00
Edward d'Auvergne
a9e0ec843b Documentation: Generalised the subsystem example. 2019-07-01 14:27:30 +02:00
Edward d'Auvergne
7a6e63ddb9 SGSubsystem classes: Subsystem and subsystem group API declaration standardisation.
This is a cleanup commit.
2019-07-01 14:27:30 +02:00
Edward d'Auvergne
60a2444766 SGSubsystem classes: Whitespace standardisation of the declarations.
This is a clean up commit prior to the subsystem API standardisation to simplify
the diffs.  It includes all SGSubsystem and SGSubsystemGroup derived classes.
2019-07-01 14:27:28 +02:00
James Turner
8428cd2a44 Revert "CommRadio: fix tuning 25Khz and 75Khz channels"
Revert this change - I will re-add the unit-tests again, but we need
a different approach for 8.3 stations, than what I did here.

This reverts commit 91cc83abb5.
2019-07-01 06:29:05 +01:00
James Turner
9f8b6f50f9 Fix navRadio tests for revised power supply paths 2019-06-27 15:46:09 +01:00
James Turner
91cc83abb5 CommRadio: fix tuning 25Khz and 75Khz channels
In 8.3 mode, ensure that 25 and 75Khz channels can be tuned using the
abbreviated syntax (eg 118.02 for 118.025). 

As part of this, add test coverage of the CommRadio for basic and 8.3-
mode operation.
2019-06-27 15:45:53 +01:00