Add FGAuxiliary setters for host-owned propagation#1482
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1482 +/- ##
=======================================
Coverage 25.10% 25.10%
=======================================
Files 171 171
Lines 18843 18843
=======================================
Hits 4731 4731
Misses 14112 14112 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Adds Setadot, Setbdot, SetNx, SetNy and SetNz to FGAuxiliary so a host that owns the state integration can inject the alpha/beta rates and body-axis load factors that Auxiliary would otherwise derive from the propagation it is no longer running. The host-owned domain is propagation together with ground reactions. The two are tightly coupled through the 6DoF integration and are externalised as one unit, so when a host takes them over these are among the few derived quantities Auxiliary cannot recompute and must be supplied. Together with the per-model enable property (JSBSim-Team#1481), this is the main JSBSim-core change needed to host the engine inside an externally hosted simulation such as DCS World. The rest reuses existing mechanisms: atmosphere override, FGWinds, and the existing velocity setters. A large capability for a small, additive surface. It follows the state-propagation review that Agostino De Marco raised in JSBSim-Team#1390 and JSBSim-Team#1391.
89c914c to
21c95aa
Compare
|
Overall, it looks good to me, thanks @Zaretto for this solution. |
|
Will take a look on the weekend at this PR and #1481 to refresh my memory of the details. |
|
@Zaretto how come there are so few new Looking at my comment - #1390 (comment) in the previous discussion I noted 12 new |
|
There again I agree with @seanmcleod70 and in addition to that, this looks to me like a quick and dirty implementation to solve the particular issues that the DCS interface is facing. The problem is that in most cases these methods will be no-op's because the content passed to the setters will be overwritten by the method My point here is not to reject the PR upfront but to tell that:
Also why are the setters not used to allow modifying their related properties ? jsbsim/src/models/FGAuxiliary.cpp Lines 438 to 440 in f46a071 jsbsim/src/models/FGAuxiliary.cpp Lines 454 to 455 in f46a071 |
|
@seanmcleod70 With only propagate and ground reactions disabled, Auxiliary still runs, so the only things that @bcoconni I think making these five properties that are already bound read/write is a much better solution than adding methods, and one that will permit this all to be done from the XML. This is not designed as a Q&D way to integrate DCS as I've already done that, as discussed on #1390. This is a real attempt to bring extra functionality into JSBSim that will have more widespread use and increase the flexibility of what JSBSim can be used for. I've already seen one real world case where JSBSim couldn't be used without patches Merging #1481 into this is my preferred approach but I will take guidance. |
Yep, I relooked at the code in that context, i.e. jsbsim/src/models/FGAuxiliary.cpp Lines 176 to 177 in d371f38 I must be missing something? |
|
Yes I agree with @seanmcleod70, if
Yes, I like this idea with one caveat: the properties are currently read-only (they only have a getter) so you will need to re-wire them on the fly to make them read/write as soon as the model is disabled. |
|
Since I first had the idea of using JSBSim inside DCS it's been quite a journey, and the last few months have achieved real progress because now I've got acEFM working with zero changes to JSBSim. Credit for this goes to @seanmcleod70 and @bcoconni for the thorough review of my pull requests that has consistently guided what I've been doing into the right places in the codebase. In the end all that was needed was simply to set the integrators in |
|
@Zaretto great to hear it's as simple as disabling the integrators in JSBSim. Just trying to understand the comment about // Alpha/beta rates - Auxiliary::Run() zeros adot/bdot then recomputes
// from in.vUVWdot (which is stale in DCS mode). We compute from
// frame-to-frame differencing and apply AFTER Run() in update().
if (init_body) {
double factor = 1.0 / dT;
pending_adot = (alpha_rads - last_alpha_rads) * factor;
pending_bdot = (beta_rads - last_beta_rads) * factor;
}
....
....
// DCS-provided Vt for debug logging (Auxiliary will compute its own from vAeroUVW)
double Vt_ms = Magnitude(vx - wind_vx, vy - wind_vy, vz - wind_vz); |
Together with the per-model enable property (#1481), these five FGAuxiliary setters are the main JSBSim-core changes that permit running the engine inside an externally hosted simulation such as DCS World.
Adds to FGAuxiliary:
When a host owns the state integration it injects the derived quantities Auxiliary would otherwise compute from the propagation it no longer runs. The host-owned domain is propagation together with ground reactions, tightly coupled through the 6DoF integration and externalised as one unit. These rates and load factors are among the few quantities Auxiliary cannot recompute once that integration is external, so the host supplies them.
Follows the state-propagation review @agodemar raised in #1390 and #1391.