1
0
Fork 0
Commit graph

785 commits

Author SHA1 Message Date
scttgs0
812107d87c Maintenance: Consistent TODO: tags 2023-05-21 16:21:40 -05:00
scttgs0
060ac34e19 Maintenance: namespace
Clean up namespaces.
Don't use broad 'using namespace' context in header files.
Header Guards.
SPDX tags.
2023-05-20 17:32:09 -05:00
scttgs0
76097ce93c Minor: fix spelling 2023-04-30 22:14:24 -05:00
Erik Hofman
c872b8b4b2 CycloneDDS aparrently stopped supporting booleans 2023-01-15 14:32:42 +01:00
James Turner
36df4c38de More snprintf conversions 2023-01-09 15:04:07 +00:00
James Turner
0f71686388 Another sprintf fix in PVE protocol this time 2023-01-09 10:57:21 +00:00
James Turner
4c42600898 Sprintf to snprintf fixes
Reduce warning from Clang about use of sprintf.
2023-01-08 19:36:44 +00:00
Edward d'Auvergne
12ca368868 SGSubsystemMrg GroupType fixes for a few subsystem registrations. 2022-11-29 11:41:34 +01:00
Edward d'Auvergne
c1c7b043ac SGSubsystemMgr::get_subsystem(): Universal switch to the templated function.
The globals non-templated get_subsystem() helper function has been made private
to enforce the switch.
2022-11-17 15:57:39 +00:00
Edward d'Auvergne
c5aa3ca0f1 SGSubsystem classes: Switch to the new SGSubsystemMgr::add() functions.
Most subsystems are now created via the subsystem manager using the global
subsystem registrations.

The FGGlobals add_subsystem() and add_new_subsystem() methods have been removed
as the subsystem manager addition and creation function interface now exceeds
the functionality of these helper functions.
2022-11-17 15:57:39 +00:00
Roman Ludwicki
ec52a4ee7b Add possibility to call ls2 telnet command without dir parameter (like for ls command) 2022-11-13 18:38:42 +01:00
Lars Toenning
2ccd9bfb30 [swift] Pass struct to updatePlanes() instead of multiple vectors 2022-04-06 07:53:51 +01:00
Lars Toenning
e35c24af99 Update swift license headers 2022-04-06 07:53:51 +01:00
Lars Toenning
9ec7d6b855 swift cleanup 2022-04-06 07:53:51 +01:00
Scott Giese
1e40006f06 'using' statement are for source files, not header files
using-declarations are okay in headers (i.e. aliasing)
2022-01-15 01:48:01 -06:00
Erik Hofman
d813b9cdd9 keep a copy of the string returend by p->getStringValue() in setProp until it is sent to the DDS layer. 2021-12-27 09:04:20 +01:00
Erik Hofman
6414df325d Cope with SGPropertyNode::getStringValue() now returning std::string by value. 2021-12-25 12:56:49 +01:00
Roman Ludwicki
82f967ab92 Cope with SGPropertyNode::getStringValue() now returning std::string by value.
This is by Lars Toenning <dev@ltoenning.de>, Roman Ludwicki <romek21@op.pl> and
SDeAstis <salvatore.deastis@gmail.com>, in 2021 Hackathon.

Also cope with removal of SGPropertyNode::getName() - use getNameString()
instead.
2021-12-24 14:49:06 +00:00
Julian Smith
5ef60c33c6 src/Network/props.cxx: with key=value, allow value to contain '='. 2021-12-08 21:18:01 +00:00
Richard Harrison
be39d5b6ef Fix compile warnings 2021-10-18 18:10:40 +02:00
Lars Toenning
f00d843c8f swift: COM volume support 2021-09-06 14:12:42 +01:00
Julian Smith
581e7980b3 src/Network/props.cxx: use std::setprecision(16) when sending double values. 2021-07-31 10:29:11 +01:00
James Turner
8535126a7d Remove Sentry XML error suppression
We now supress XML errors from reporting internally, so this can
be removed, woo-hoo.
2021-07-28 13:45:23 +01:00
Julian Smith
c872af41bf Allow AI carrier to be always tied exactly to MP carrier.
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.
2021-06-25 11:08:12 +01:00
legoboyvdlp R
3ab4de1436 De-Yodify false == conditions throughout the code-base 2021-06-24 15:29:10 +01:00
James Turner
9695847a00 FGCom: log more IAX messages at SG_INFO 2021-06-08 17:47:11 +01:00
Lars Toenning
8a8973fe15 AIManager: Explicitly take SGSharedPtr
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.
2021-06-07 12:43:50 +01: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
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
e1a9d27ca6 Generic protocols: suppress XML errors 2021-04-21 21:57:10 +01: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
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
Erik Hofman
f196c8418d Update the props sample description: remove an unnecessary type specifier (the union already holds it), add a sample version number and a mode to indicate reading from, or writing to, a property. The option to set a property value is reserved for future use and not yet implemented. 2021-04-15 10:11:42 +02:00
Erik Hofman
4f28e2dfff Add a proprety requester test utility 2021-04-09 14:44:33 +02:00
Erik Hofman
c88c47e1b5 No need to keep two maps: it's enough the have one PropertyList (vector) and a map 2021-04-09 14:43:20 +02:00
Erik Hofman
162f5f317d Switch to always add the GUID. Setting a string to null doesn't work for DDS samples and leads to a segmentation fault. 2021-04-09 14:42:38 +02:00
Erik Hofman
c951f3fcf4 Also log propery samples over DDS 2021-04-07 11:53:22 +02:00
Erik Hofman
202c69ad77 Implement the start of a property server using DDS. 2021-04-06 14:52:37 +02:00
Erik Hofman
e203336546 Udpate the logged name 2021-04-06 14:51:50 +02:00
James Turner
977dd6fd15 Add sentry breadcrumb for FGCom
Trying to understand FLIGHTGEAR-66 crashes where the IAXClient thread
is still running after FGCom::shutdown has (presumably?) been called
2021-04-04 16:35:40 +01:00
Erik Hofman
13a7eeef74 Use the new convenience constructor eliminating the need to call setup separately. 2021-03-28 09:00:15 +02:00
Julian Smith
797f02f9dd Allow listing of property children via telnet.
Adds new ls2 command with machine-readable output.
2021-03-27 22:37:47 +00:00
Erik Hofman
78b383734c Use the new helper function which converts the typename into a topic name. 2021-03-27 15:22:20 +01:00
Erik Hofman
2825feb4b2 Simplify the code even more: no need to explicitly define the type 2021-03-27 13:58:54 +01:00
Erik Hofman
2d684de929 Use the new templated helper functions to simplify the code 2021-03-27 13:57:05 +01:00
Erik Hofman
1467a8a170 Move the C version of fgfdm_log.c to examples/dds/ and convert it to C++ as fg_dds_log.cpp using the SimGear provided hepper classes. 2021-03-27 13:31:39 +01:00
Erik Hofman
f88f38ec53 Dot not only log FDM packets but also GUI and Ctrls packets when they arrive. 2021-03-25 14:21:30 +01:00
Erik Hofman
875713efad Merge all Net/DDS FDM, GUI and Ctrls struct handling into one source file and make it FlightGear agnostic which means that they can be used by, for instance, fgviewer. 2021-03-23 14:30:52 +01:00
Erik Hofman
8f5dc3e764 Use the renamed SG_DDS_Topic class 2021-03-19 13:52:44 +01:00
James Turner
f651ed2f15 Fixes for updated Package API 2021-03-17 09:09:30 +00:00