Board index FlightGear Development

Wrong positioning of planes when ending replay mode

FlightGear is opensource, so you can be the developer. In the need for help on anything? We are here to help you.
Forum rules
Core development is discussed on the official FlightGear-Devel development mailing list.

Bugs can be reported in the bug tracker.

Wrong positioning of planes when ending replay mode

Postby Fritz » Tue Aug 09, 2016 11:39 pm

This is easy to reproduce, you don't even have to start-up a plane: Start FG with the Super Constellation, place it at the beginning of a runway, switch to an outside view, and look where the plane is located in relation to the runway markings. Then start the replay mode, and stop it again. The plane will be shifted by almost half its length in a forward direction, and it also seems to drop a little bit, because it has been lifted slightly. This phenomenon is plane-dependent, e.g. the DC-3 seems less affected than the L 1049H, but it can lead to the tail being pushed up and the plane ending up on its nose. I've tested this with two Yasim planes too, and they don't seem to be affected at all. But this could be a coincidence with the planes I chose (B-17 and R44).

I've noticed this long ago, but I've never looked at it in detail, although it can be a little annoying when using my way to restart from a previous flight, and obviously it is irrelevant and won't even be noticed if you replay during flight.

But now I noticed that the space ship I'm modelling is severely affected by this: After stopping the replay, it is pressed into the ground by about 10.4 metres! The distance and direction of movement led me to the probable cause of the error rather quickly: 10.4 metres is the vertical distance between the JSBSim coordinate origin and the centre of gravity (my ship is rather high, even compared to an A380, and the coordinate origin is at the bottom). Both points are exactly on the z axis, and that's why the ship doesn't move to the front or back when stopping replay, only down.

Looking at the L 1049H, we will see that the coordinate origin is at the nose, while the CoG should be somewhere between the wings. The difference of 681.6 inches is the distance the plane is moved forward, and the small difference in z position of coordinate origin and CoG (only -34.1 inches, compared to +410 inches in my space ship) causes the slight upward movement followed by the drop.

So what is happening? During replay, some of the properties have obviously to be saved somewhere, and when ending replay mode, they are written back into the property tree. Either during saving or restoring, something gets mixed up. It looks as if the CoG is placed at the saved position of the coordinate origin, causing the forward and upward movement of the L 1049H and the downward movement of my Python. In this context it may be interesting that the property "position/altitude-agl-ft" refers to the CoG, while the property "position/altitude-ft" refers to the coordinate origin. This probably has a good reason, but it looks like a bug waiting to happen, and it could be somehow involved with the repositioning bug.

If anybody can reproduce this, I'll try to get it to the bug tracker.
Fritz
 
Posts: 283
Joined: Tue Apr 26, 2016 11:04 pm
Location: Bavaria, Germany, near ETSL
Version: 2018.3.6
OS: Windows 7 Prof.

Re: Wrong positioning of planes when ending replay mode

Postby Fritz » Wed Aug 10, 2016 9:01 pm

A little addendum:

This is not only a replay bug, replay only makes it obvious. The same thing happens when you change /orientation/altitude-ft manually in the property browser.

Example: My ship was sitting on the runway at 1513 ft on a runway. I change altitude-ft to 1530 ft to let it drop down a bit (to test how the landing gear reacts on impact). But it ended up below ground again! I have to add the vertical distance between CoG and coordinate origin (34 ft) to achieve the desired result.

altitude-ft is calculated correctly to be the altitude of the coordinate origin, but if you try to change it directly, your value is assigned to the altitude of the CoG. So this property is not made to be changed by hand - or by the replay system.
Fritz
 
Posts: 283
Joined: Tue Apr 26, 2016 11:04 pm
Location: Bavaria, Germany, near ETSL
Version: 2018.3.6
OS: Windows 7 Prof.

Re: Wrong positioning of planes when ending replay mode

Postby Thorsten » Thu Aug 11, 2016 6:35 am

Subtle one... explains why placing the Shuttle on the pad never worked as I calculated and I had to introduce a weird offset - CoG for the whole launch stack is of course completely different from the coordinate origin of the orbiter alone.
Thorsten
 
Posts: 12490
Joined: Mon Nov 02, 2009 9:33 am

Re: Wrong positioning of planes when ending replay mode

Postby Fritz » Thu Aug 11, 2016 10:04 am

It isn't subtle anymore when the CoG is 10 m above the coordinate origin! In plane models, this is probably very rare with reasonably placed origins, and the shifting along the x axis is causing less severe problems. But it is annoying if you park an airliner perfectly next to an airbrige, then replay, and the plane ends up partly inside or even on top of the terminal building. I wonder that nobody noticed this, because a rather big fraction of FG users seems to fly airliners.

I suppose the x-axis of the shuttle is vertical during launch, and the coordinate origin is somewhere inside the orbiter (nose tip?). So if you attach the external tank, your CoG will probably be inside the tank, so you get noticeable shifting by several metres along the x as well as along the z axis.

I'm just starting to wonder if the positioning applies to the CoG defined by <location name="CG" > or if the calculated actual CoG is relevant. I suspect the former, but I haven't tested this yet.

With my Python model, I have the relatively simple option of shifting the coordinate origin up towards the specified CoG if there is no other way to fix this, and I'll probably do this, because I often use replay to re-watch my landings. But it's probably more difficult with the shuttle, because you have three very different configurations, and the model is in a much more advanced state.
Fritz
 
Posts: 283
Joined: Tue Apr 26, 2016 11:04 pm
Location: Bavaria, Germany, near ETSL
Version: 2018.3.6
OS: Windows 7 Prof.

Re: Wrong positioning of planes when ending replay mode

Postby Johan G » Mon Dec 05, 2016 8:59 pm

Sorry for the "necrobump", but are there any updates on this?
Low-level flying — It's all fun and games till someone looses an engine. (Paraphrased from a YouTube video)
Improving the Dassault Mirage F1 (Wiki, Forum, GitLab. Work in slow progress)
Some YouTube videos
Johan G
Moderator
 
Posts: 6625
Joined: Fri Aug 06, 2010 6:33 pm
Location: Sweden
Callsign: SE-JG
IRC name: Johan_G
Version: 2020.3.4
OS: Windows 10, 64 bit


Return to Development

Who is online

Users browsing this forum: No registered users and 4 guests