pilotclient
pilotclient copied to clipboard
Implement VATSIM Velocity compatible "interpolator"
VATSIM Velocity introduced new network packets (i.a. VisualPilotDataUpdate
and VisualPilotDataPeriodic
) that also contain the aircraft velocity in cartesian direction, as well as the pitch, roll and yaw velocities and a nose gear angle.
Further, these new packets are published much more frequent (5 Hz) by aircraft in the vicinity.
Currently swift supports two interpolation modes:
- Spline
- Linear
Both of them are not using the new velocity information yet:
https://github.com/swift-project/pilotclient/blob/46e6eaba7f761a4e1fc3d29c9d5813f0829bb0d0/src/blackcore/fsd/fsdclient.cpp#L1293-L1296
But also without velocity information, there seem to be issues with the interpolators after the Velocity upgrade (aircraft warping mostly into the moving direction, especially when starting to move).
This may be caused by:
- the faster update rate
- that the new
VisualPilotDataUpdate
andVisualPilotDataPeriodic
but alsoPilotDataUpdate
packets are used in the interpolator (which could somehow overlap) - something entirely different that makes the current interpolation methods unstable
My proposal would be to add a new "interpolator" which uses the velocity information. This can be done by extrapolating the aircraft position and rotation, using the velocity information. The extrapolation error could be smoothly reduced with the next incoming update by adding the position/rotation error vector to the new velocities for some time.
I began implementing this some time ago (see feature/extrapolator) but encountered several difficulties and tasks that must be addressed:
- [ ] Testing seems to be somewhat complicated. Some easy (standardized?) testing environment should be used.
- [ ] The base class for interpolators (
CInterpolator
) is quite large and may contain some functionality that is not required for the proposed extrapolation method. Perhaps this could be simplified and cleaned up. - [ ] The old interpolation methods must continue to work for non-VATSIM networks without Velocity.
- [ ] The new method must also work for aircraft not in the fastpos range, as these aircraft may still be displayed on TCAS.
- [ ] IIRC there were some inconsistencies between different pilotclients about which packets are (initially?) sent when the aircraft is not moving. This caused some issues in my first implementation.
- [ ] Perhaps we should find a new name for "Interpolator" as the new method isn't doing interpolation only.
As the main issue with "zooming" aircraft was solved with 0.14.142 (see https://github.com/swift-project/pilotclient/pull/256#issuecomment-1942721827) , this issue isn't as urgent anymore.