Flight data display method and device, electronic equipment and storage medium
Patent Information
- Application Number
- CN202610713269.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-05-22
- Publication Date
- 2026-09-01
AI Technical Summary
[0004]本发明提供一种飞行数据展示方法、装置、电子设备及存储介质,用以解决现有技术中无法直观展现飞机在三维空间中的真实运动轨迹、姿态变化及空间位置关系,导致飞行数据展示维度较为单一的技术问题
[0015]本发明根据飞行数据与三维笛卡尔坐标系的逐点映射,进行三维轨迹的实时渲染与多对象区分绘制,使得飞行路径在深色主题的三维窗口中呈现为可交互的空间曲线,从而使用者能够通过鼠标拖曳改变观察方位角和仰角,从多个视角观察飞机的运动趋势与姿态变化,直观展现飞机在三维空间中的真实运动轨迹、姿态变化及空间位置关系,从而能够从多维度展示飞行数据,有利于提高模拟教学的效果。
Smart Images

Figure CN122676718A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of aerospace engineering technology, and in particular to a flight data display method, device, electronic device, and storage medium. Background Technology
[0002] In the process of using flight simulators, in order to quickly improve students' flying ability, instructors need to guide and teach students during the flight process. Therefore, it is necessary to record students' flight data and evaluate and score them in a timely manner.
[0003] Existing flight data display methods typically involve equipping simulators with flight data recording modules to collect and store key flight data such as altitude, speed, heading, and engine parameters in real time, forming data log files in .dat format. During playback, the system re-drives the instrument displays with the recorded historical data, allowing instructors to analyze deviations in students' flight data. However, flight data is mainly presented in the form of data display or reverse-drive visuals and instrument displays, which cannot intuitively show the aircraft's real motion trajectory, attitude changes, and spatial positional relationships in three-dimensional space, resulting in a relatively singular dimension of flight data display. Summary of the Invention
[0004] This invention provides a flight data display method, device, electronic device, and storage medium to solve the technical problem that the existing technology cannot intuitively display the real motion trajectory, attitude changes, and spatial positional relationships of an aircraft in three-dimensional space, resulting in a relatively single dimension of flight data display.
[0005] This invention provides a method for displaying flight data, comprising: Acquire target flight data, map the target flight data to a pre-constructed three-dimensional Cartesian coordinate system, and generate a three-dimensional trajectory; The three-dimensional trajectory is displayed according to the preset display window; Listen for mouse events input by the user and determine the mouse displacement based on the mouse events; The viewpoint of the three-dimensional trajectory is updated based on the mouse displacement, wherein the viewpoint includes azimuth and elevation angles.
[0006] According to the flight data display method provided by the present invention, before acquiring target flight data and mapping the target flight data to a pre-constructed three-dimensional Cartesian coordinate system to form a three-dimensional trajectory, the method includes: If a configuration file is detected, the display parameters in the configuration file are read; A preset display window is constructed based on the display parameters; If no configuration file is detected, a configuration file is generated based on preset display parameters; Read the configuration file and construct a preset display window based on the preset display parameters.
[0007] According to the flight data display method provided by the present invention, the mouse events include press events and movement events, and the step of listening to user-inputted mouse events and determining mouse displacement based on the mouse events includes: Upon receiving a press event, record the starting coordinates of the press event; Upon receiving a movement event, the mouse displacement is determined based on the starting coordinates and the current coordinates.
[0008] According to the flight data display method provided by the present invention, the mouse displacement includes X-axis displacement and Y-axis displacement, and the step of updating the perspective of the three-dimensional trajectory based on the mouse displacement includes: The azimuth angle of the three-dimensional trajectory is updated based on the X-axis displacement using a preset adjustment coefficient. The elevation angle of the three-dimensional trajectory is updated based on the Y-axis displacement using a preset adjustment coefficient.
[0009] According to the flight data display method provided by the present invention, the step of displaying the three-dimensional trajectory according to a preset display window includes: Calculate the data range of the target flight data, and if the data range is zero, set the data range to a preset lower limit value; wherein, the data range includes longitude range, latitude range, and altitude range; Using a preset ratio of data range as the margin, the display range of the coordinate axes is adjusted, and the three-dimensional trajectory is displayed within the display range.
[0010] According to the flight data display method provided by the present invention, before displaying the three-dimensional trajectory according to the preset display window, the method further includes: Continuously acquire flight data using a non-blocking data acquisition method; The flight data is parsed into floating-point values based on a preset segmentation string; wherein the floating-point values include longitude floating-point values, latitude floating-point values, and altitude floating-point values; Update the current 3D trajectory based on the floating-point value.
[0011] The present invention also provides a flight data display device, comprising: A three-dimensional trajectory generation module is used to acquire target flight data, map the target flight data to a pre-constructed three-dimensional Cartesian coordinate system, and generate a three-dimensional trajectory. A 3D trajectory display module is used to display the 3D trajectory according to a preset display window; The mouse displacement determination module is used to listen to mouse events input by the user and determine the mouse displacement based on the mouse events. A perspective update module is used to update the perspective of the three-dimensional trajectory based on the mouse displacement, wherein the perspective includes azimuth and elevation angles.
[0012] The present invention also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the row data display method as described above.
[0013] The present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the row data display method as described above.
[0014] The present invention also provides a computer program product, including a computer program that, when executed by a processor, implements the row data display method as described above.
[0015] This invention performs real-time rendering and multi-object differentiation of three-dimensional trajectory based on point-by-point mapping of flight data to a three-dimensional Cartesian coordinate system. This allows the flight path to be presented as an interactive spatial curve in a dark-themed three-dimensional window, enabling users to drag the mouse to change the azimuth and elevation angles and observe the aircraft's motion trend and attitude changes from multiple perspectives. It intuitively displays the aircraft's real motion trajectory, attitude changes, and spatial positional relationships in three-dimensional space, thus providing a multi-dimensional display of flight data and improving the effectiveness of simulation teaching.
[0016] Furthermore, by recording the starting coordinates of the press event and calculating the displacement in real time during the movement event, this invention enables users to naturally control the rotation of the three-dimensional view simply by pressing and dragging, without the need for additional buttons or menu operations. This allows instructors to intuitively observe the spatial deviation of the flight trajectory from multiple angles, significantly improving the ease of operation and analysis efficiency during the review process. Attached Figure Description
[0017] To more clearly illustrate the technical solutions in this invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.
[0018] Figure 1 This is a flowchart illustrating the flight data display method provided by the present invention.
[0019] Figure 2 This is a schematic diagram of window creation provided by the present invention.
[0020] Figure 3 This is a schematic diagram of the coordinate axis range adjustment provided by the present invention.
[0021] Figure 4 This is a schematic diagram of the three-dimensional trajectory update provided by the present invention.
[0022] Figure 5 This is a schematic diagram of the flight data display device provided by the present invention.
[0023] Figure 6 This is a schematic diagram of the structure of the electronic device provided by the present invention. Detailed Implementation
[0024] To make the objectives, technical solutions, and advantages of this invention clearer, the technical solutions of this invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of this invention. All other embodiments obtained by those skilled in the art based on the embodiments of this invention without creative effort are within the scope of protection of this invention.
[0025] Figure 1 This is a flowchart illustrating the flight data display method provided by the present invention, which includes the following: S1. Acquire target flight data, map the target flight data to a pre-constructed three-dimensional Cartesian coordinate system, and generate a three-dimensional trajectory; In this embodiment of the invention, the target flight data is the flight data that needs to be displayed. The target flight data is mapped to a pre-built three-dimensional Cartesian coordinate system to construct the flight trajectory. The generated flight trajectory can be rendered in real time as a three-dimensional curve using the matplotlib 3D plotting engine, generating a three-dimensional trajectory. This allows instructors and students to intuitively understand the motion trajectory and attitude changes of the flight simulator from a spatial perspective. Furthermore, this invention can clear all historical trajectory data and redraw the data.
[0026] In this embodiment of the invention, different curve objects can be created, such as red curve objects and green position point objects, which are used to draw historical trajectory paths and mark real-time positions, respectively.
[0027] This invention maps target flight data to a three-dimensional Cartesian coordinate system and uses a three-dimensional graphics engine to render and generate three-dimensional trajectory curves and real-time position points in real time. This transforms flight data from abstract numerical values into spatial three-dimensional dynamic trajectories, allowing users to intuitively understand the motion trajectory and attitude changes of the flight simulator from a spatial perspective, thereby providing a basic visualization object for subsequent interactive observation.
[0028] S2. Display the three-dimensional trajectory according to the preset display window; The size of the preset display window in this invention can be determined according to the display parameters in the configuration file. The preset display window can be configured with theme colors according to actual needs, such as a dark theme (background color #121212), white coordinate axis labels and gray scales, so as to reduce visual fatigue during long-term observation while ensuring visual clarity.
[0029] S3. Listen for mouse events input by the user and determine the mouse displacement based on the mouse events; This invention, by listening to mouse events and calculating displacement, allows users to control the viewing angle through natural dragging operations without additional input, thereby effectively improving the display of flight data.
[0030] S4. Update the view of the three-dimensional trajectory based on the mouse displacement, wherein the view includes azimuth and elevation angles.
[0031] In this embodiment of the invention, the azimuth and elevation angles of the three-dimensional trajectory are updated in real time based on the mouse displacement, allowing users to observe the motion trajectory and positional relationship of the aircraft from multiple spatial angles, thereby enhancing their understanding of complex three-dimensional flight paths.
[0032] This invention, based on the point-by-point mapping of flight data to a three-dimensional Cartesian coordinate system, performs real-time rendering of the three-dimensional trajectory and multi-object differentiation drawing. This makes the flight path appear as an interactive spatial curve in a dark-themed three-dimensional window, allowing users to drag and change the azimuth and elevation angles of observation, and observe the aircraft's motion trend and attitude changes from multiple perspectives. It intuitively displays the aircraft's real motion trajectory, attitude changes, and spatial positional relationships in three-dimensional space, thus enabling the display of flight data from multiple dimensions and improving the effectiveness of simulation teaching.
[0033] In one embodiment, before S1, acquiring target flight data and mapping the target flight data to a pre-constructed three-dimensional Cartesian coordinate system to form a three-dimensional trajectory, the process includes: S101. If a configuration file is detected, read the display parameters in the configuration file; In this embodiment of the invention, a unified management of system configuration parameters can be achieved by designing a ConfigManager class. When the class is initialized, it first checks whether the configuration file config.ini exists. If it exists, the configuration file is loaded directly, and the window is created by obtaining the display parameters in the configuration file. The display parameters include window size, etc.
[0034] This invention actively detects the existence of a configuration file and reads the preset display parameters therein, enabling window construction to reuse the personalized display configuration preset by the user or the system last time. This avoids the repetitive operation of manually adjusting the window style every time the system starts, and provides parameter basis for the rapid construction of subsequent windows.
[0035] S102. Construct a preset display window based on the display parameters; In this embodiment of the invention, a display window is directly generated based on display parameters (such as window size, theme color, coordinate axis style, etc.), so that the appearance and layout of the window meet the pre-set display requirements, thereby ensuring the consistency of the three-dimensional trajectory display interface.
[0036] S103. If the configuration file cannot be detected, generate the configuration file according to the preset display parameters; In this embodiment of the invention, if no configuration file is detected, the create_default_config() method is automatically called to generate a configuration file based on preset display parameters (such as 500 pixels wide and 400 pixels high).
[0037] When no existing configuration file is detected, the present invention automatically generates a new configuration file based on the built-in preset display parameters, enabling the system to start with zero configuration and automatically save default settings. This eliminates the tedious process of users manually creating configuration files and provides a standardized source of parameters for subsequent window construction.
[0038] S104. Read the configuration file and construct a preset display window according to the preset display parameters.
[0039] In this embodiment of the invention, when reading configuration parameters, a fallback mechanism can be used to handle abnormal values. When a configuration item is missing or the value is invalid, it will automatically fall back to the default value, ensuring that the system can start and run normally under various configuration states.
[0040] Please see Figure 2 This is a schematic diagram of window creation provided in one embodiment of the present invention, such as... Figure 2 As shown, the window is created by checking if a configuration file exists. If it does not exist, the configuration file is created and display parameters such as width and height are written into it. If it exists, the configuration file is loaded and the display parameters in it are read to create the window.
[0041] This invention creates a display window by reading display parameters from a configuration file, allowing users to customize display parameters by modifying the configuration file. Users can adjust the width and height of the display window according to actual needs without changing the source code, thus adapting to different display requirements. Furthermore, it automatically creates a configuration file when it is missing, effectively improving the convenience of display window configuration.
[0042] In one embodiment, the mouse events include press events and move events. Step S3, listening to user-input mouse events and determining the mouse displacement based on the mouse events, includes: S311. Upon receiving a press event, record the starting coordinates of the press event; In this embodiment of the invention, mouse events are signals generated by the system when a user operates the mouse, such as mouse events corresponding to pressing the left mouse button, moving the mouse, and releasing the button. A press event is triggered the instant the user presses the left mouse button (or other key); a move event is triggered when the mouse pointer position changes continuously as the user presses and drags the mouse; the starting coordinates are the (x, y) positions of the mouse pointer on the screen or canvas at the instant the mouse button is pressed, serving as the reference origin for dragging; and the mouse displacement is the offset of the current coordinates relative to the starting coordinates.
[0043] S312. Upon receiving a movement event, determine the mouse displacement based on the starting coordinates and the current coordinates.
[0044] This invention enables interactive functionality where users can naturally control the rotation of a three-dimensional view simply by pressing and dragging, by recording the starting coordinates of a press event and calculating the displacement in real time during a movement event. No additional buttons or menu operations are required, allowing instructors to intuitively observe the spatial deviation of the flight trajectory from multiple angles, significantly improving the ease of operation and analysis efficiency during the debriefing process.
[0045] In one embodiment, the mouse displacement includes X-axis displacement and Y-axis displacement. Step S3, updating the viewpoint of the three-dimensional trajectory based on the mouse displacement, includes: S321. Update the azimuth angle of the three-dimensional trajectory according to the X-axis displacement using a preset adjustment coefficient; In this embodiment of the invention, the preset adjustment coefficient is a fixed multiplier factor used to control the sensitivity of mouse dragging and view rotation angle. The preset adjustment coefficient can be set and adjusted according to actual needs; for example, the preset adjustment coefficient can be set to 0.4, 0.5, or 0.6, etc.
[0046] S322. Update the elevation angle of the three-dimensional trajectory according to the Y-axis displacement using a preset adjustment coefficient.
[0047] In this embodiment of the invention, the X-axis displacement is the horizontal drag distance of the mouse; the Y-axis displacement is the vertical drag distance of the mouse. The azimuth angle is the angle at which the observation point in a 3D scene rotates around the vertical axis (Z-axis), which can be understood as left-right panning; adjusting the azimuth angle allows the screen to rotate horizontally. The elevation angle is the pitch angle of the observation point relative to the horizontal plane, which can be understood as up-down panning; a positive elevation angle indicates looking down from above, and a negative angle indicates looking up from below. In this embodiment of the invention, the azimuth angle range can be limited to 90° to prevent viewpoint flipping.
[0048] In this embodiment of the invention, the mouse event also includes a release event, which is the event generated by releasing the mouse button. When the release event is detected, the drag state is cleared, and after each view update, view_init() can be called immediately to apply the new parameters and redraw the canvas, achieving a smooth and fluid real-time rotation effect, thereby allowing the user to observe the three-dimensional trajectory from multiple angles.
[0049] The embodiments of the present invention control the sensitivity by preset adjustment coefficients and determine the mouse displacement based on the mouse events in order to adjust the viewing angle of the three-dimensional trajectory, so that users can intuitively observe the spatial shape of the flight trajectory from multiple angles through simple drag operations.
[0050] In one embodiment, step S2, displaying the three-dimensional trajectory according to a preset display window, includes: S21. Calculate the data range of the target flight data, and if the data range is zero, set the data range to a preset lower limit value; wherein, the data range includes longitude range, latitude range and altitude range; In this embodiment of the invention, the target flight data is a combination of all currently received flight data points. Each data point includes longitude, latitude, and altitude data, and each data point corresponds to a data range. The data range is the difference between the maximum and minimum values in a certain dimension. For example, the longitude range is the maximum longitude value minus the minimum longitude value among all data points; the latitude range is the maximum latitude value minus the minimum latitude value among all data points; and the altitude range is the maximum altitude value minus the minimum altitude value among all data points.
[0051] In this embodiment of the invention, the preset lower limit value serves as a minimum value set manually to avoid division by zero or image degradation when the range is zero (i.e., all data are exactly the same in that dimension). For example, it can be set as a lower limit of 0.0001° for longitude / latitude and 10 meters for altitude.
[0052] In this embodiment of the invention, all values of longitude, latitude, and altitude are extracted respectively, the maximum and minimum values of each dimension are calculated, and then the difference is taken to obtain the range. It is determined whether each range is equal to 0: if it is not equal to 0, the original range value is maintained. If it is equal to 0 (for example, all longitudes are 120.5°), the range is forcibly set to a preset lower limit value, for example, longitude / latitude is 0.0001°, and altitude is 10 meters.
[0053] S22. Using the data range of a preset ratio as the margin, adjust the display range of the coordinate axes and display the three-dimensional trajectory within the display range.
[0054] In this embodiment of the invention, the preset ratio is a percentage used to calculate the margin, which can be set and adjusted as needed. For example, the preset ratio can be set to 10% or 12%. The margin is an additional display space beyond the minimum and maximum values of the data, so that the trajectory does not tightly adhere to the coordinate axis borders. The coordinate axis display range is the interval between the minimum and maximum values displayed for each of the X, Y, and Z axes in the three-dimensional coordinate system.
[0055] In this embodiment of the invention, using a preset ratio of data range as the margin, the display range of the coordinate axes can be adjusted as follows: Using margins as buffer spaces, buffer spaces are left on both sides of the minimum and maximum values of the data to ensure that the trajectory does not touch the coordinate axis boundaries. For example, assuming the flight longitude range is 120.1~120.5, with a longitude range of 0.4°, leave 0.4×10%=0.04° on the left and 0.04° on the right, so the X-axis display range becomes: 120.06~120.54.
[0056] This invention enables adaptive display of flight trajectories in multiple scenarios by processing the range to zero and dynamically adjusting the coordinate axis range using a preset ratio range as the bidirectional margin, thus ensuring the integrity of the image.
[0057] Please see Figure 3 This is a schematic diagram of coordinate axis range adjustment provided in an embodiment of the present invention, as shown below. Figure 3 As shown, the system receives data points and updates the data list. It calculates the range of each dimension in the data list and determines whether the dimension range (range data) is 0. If it is not 0, it uses 10% of the range data as the margin and adjusts the range of the X, Y and Z axes.
[0058] In one embodiment, before S2, which displays the three-dimensional trajectory according to a preset display window, the method further includes: S201. Continuously acquire flight data through a non-blocking data acquisition method; In this embodiment of the invention, the flight data includes longitude, latitude, and altitude data, which are segmented using a preset segmentation string.
[0059] In this embodiment of the invention, a UDP Socket can be created using the UDPReceiver class, bound to port 12345, and the receive timeout set to 0.1 seconds. During program execution, the main loop calls the data acquisition function every 100 milliseconds using the after(100, update_plot) method of tkinter. Inside update_plot(), a while loop continuously calls socket.recv() until the timeout occurs, thereby reading all arriving data packets in batches.
[0060] This invention sets a receive timeout to achieve non-blocking data acquisition, so that the display interface will not lag due to waiting for data, thereby effectively improving the stability of flight data display.
[0061] S202. Parse the flight data into floating-point values according to the preset segmentation string; wherein, the floating-point values include longitude floating-point values, latitude floating-point values, and altitude floating-point values; In this embodiment of the invention, the read flight data can be split into three substrings according to a preset segmentation string, and the three substrings can be converted into floating-point values respectively. The three floating-point values are longitude floating-point values, latitude floating-point values and altitude floating-point values, so as to perform mathematical calculations and three-dimensional coordinate mapping.
[0062] S203. Update the current three-dimensional trajectory based on the floating-point value.
[0063] In this embodiment of the invention, three floating-point values can be added to the end of the global trajectory data group to obtain a data list. Then, the longitude, latitude, and altitude data of the 3D curve object are reset using the updated global trajectory data. The position of the current point is set to the latest data coordinates, the coordinate axis display range is recalculated based on all current data points, and the canvas is redrawn, thereby displaying the updated 3D trajectory in a timely manner.
[0064] Please see Figure 4 This is a schematic diagram of a three-dimensional trajectory update provided by an embodiment of the present invention. Figure 4 As shown, when a UDP (User Datagram Protocol) packet arrives, the packet is received by calling a socket and a receive timeout of 0.1 seconds is set. The UTF-8 string is parsed, separated by commas, to convert it into multiple floating-point values. These floating-point values are then added to a data list. The curve data and the current point position are updated using the data in the data list, thus updating the 3D trajectory. The canvas is then redrawn, ensuring the updated 3D trajectory is displayed promptly.
[0065] In one embodiment, the embedded WindowsFormsHost can also be initialized, and an external process can be started asynchronously. When the control is loaded, PYTHON_3D_PLOT.exe is started in a background thread. The multi-strategy window handle is obtained by first searching for a process ID similar to the window title, and then traversing all processes with the same name to determine the single executor. After finding the executor, the main thread is switched to perform the embedding operation. When the program is closed, a process cleanup operation is performed to ensure that the process exits completely.
[0066] In this embodiment of the invention, WindowsFormsHost is a container in WPF used to host WinForms controls, allowing traditional Windows Forms controls to be displayed in the WPF (Windows Presentation Foundation) interface; asynchronous startup: an external process is started in a background thread without blocking the main interface, and the main thread can still respond to user operations. Multi-strategy window handle acquisition refers to using multiple methods (window title matching, process name traversal) to find the operating system handle (HWND) of the target window, ensuring accurate capture of the running 3D program window.
[0067] This invention integrates the 3D trajectory program into the main interface of the presentation by using WindowsFormsHost, asynchronous startup, multi-strategy window handle acquisition, main thread embedding, and process cleanup. The main program is unified and separated from third-party programs, thereby effectively improving code usability and reducing maintenance workload.
[0068] Implementing the embodiments of the present invention has the following beneficial effects: This invention performs real-time rendering of the 3D trajectory and differentiates and draws multiple objects (historical trajectory curves, real-time position points) based on point-by-point mapping of flight data to a 3D Cartesian coordinate system. This makes the flight path appear as an interactive spatial curve in a dark-themed 3D window, allowing users to drag the mouse to change the azimuth and elevation angles and observe the aircraft's motion trend and attitude changes from multiple perspectives. It intuitively displays the aircraft's real motion trajectory, attitude changes, and spatial position relationships in 3D space, thus enabling multi-dimensional display of flight data and improving the effectiveness of simulation teaching.
[0069] Furthermore, by recording the starting coordinates of the press event and calculating the displacement in real time during the movement event, this invention enables users to naturally control the rotation of the three-dimensional view simply by pressing and dragging, without the need for additional buttons or menu operations. This allows instructors to intuitively observe the spatial deviation of the flight trajectory from multiple angles, significantly improving the ease of operation and analysis efficiency during the review process.
[0070] The flight data display device provided by the present invention is described below. The flight data display device described below and the flight data display method described above can be referred to in correspondence.
[0071] Please see Figure 5 This invention provides a flight data display device, comprising: The three-dimensional trajectory generation module 510 is used to acquire target flight data, map the target flight data to a pre-constructed three-dimensional Cartesian coordinate system, and generate a three-dimensional trajectory. In this embodiment of the invention, the target flight data is mapped to a pre-built three-dimensional Cartesian coordinate system to construct the flight trajectory. The generated flight trajectory can be rendered in real time as a three-dimensional curve using the matplotlib 3D plotting engine, generating a three-dimensional trajectory. This allows instructors and students to intuitively understand the motion trajectory and attitude changes of the flight simulator from a spatial perspective. Furthermore, this invention can clear all historical trajectory data and redraw the data.
[0072] In this embodiment of the invention, different curve objects can be created, such as red curve objects and green position point objects, which are used to draw historical trajectory paths and mark real-time positions, respectively.
[0073] This invention maps target flight data to a three-dimensional Cartesian coordinate system and uses a three-dimensional graphics engine to render and generate three-dimensional trajectory curves and real-time position points in real time. This transforms flight data from abstract numerical values into spatial three-dimensional dynamic trajectories, allowing users to intuitively understand the motion trajectory and attitude changes of the flight simulator from a spatial perspective, thereby providing a basic visualization object for subsequent interactive observation.
[0074] The three-dimensional trajectory display module 520 is used to display the three-dimensional trajectory according to a preset display window; The size of the preset display window in this invention can be determined according to the display parameters in the configuration file. The preset display window can be configured with theme colors according to actual needs, such as a dark theme (background color #121212), white coordinate axis labels and gray scales, so as to reduce visual fatigue during long-term observation while ensuring visual clarity.
[0075] The mouse displacement determination module 530 is used to listen to mouse events input by the user and determine the mouse displacement based on the mouse events. This invention, by listening to mouse events and calculating displacement, allows users to control the viewing angle through natural dragging operations without additional input, thereby effectively improving the display of flight data.
[0076] The viewpoint update module 540 is used to update the viewpoint of the three-dimensional trajectory according to the mouse displacement, wherein the viewpoint includes azimuth and elevation angles.
[0077] In this embodiment of the invention, the azimuth and elevation angles of the three-dimensional trajectory are updated in real time based on the mouse displacement, allowing users to observe the motion trajectory and positional relationship of the aircraft from multiple spatial angles, thereby enhancing their understanding of complex three-dimensional flight paths.
[0078] This invention, based on the point-by-point mapping of flight data to a three-dimensional Cartesian coordinate system, performs real-time rendering of the three-dimensional trajectory and differentiates and draws multiple objects (historical trajectory curves, real-time position points), so that the flight path is presented as an interactive spatial curve in a dark-themed three-dimensional window. Users can drag the mouse to change the azimuth and elevation angles, observe the aircraft's motion trend and attitude changes from multiple perspectives, and intuitively display the aircraft's real motion trajectory, attitude changes, and spatial position relationships in three-dimensional space. This allows for multi-dimensional display of flight data, which is beneficial to improving the effectiveness of simulation teaching.
[0079] In one embodiment, before acquiring target flight data and mapping the target flight data to a pre-constructed three-dimensional Cartesian coordinate system to form a three-dimensional trajectory, the process includes: If a configuration file is detected, the display parameters in the configuration file are read; In this embodiment of the invention, a unified management of system configuration parameters can be achieved by designing a ConfigManager class. When the class is initialized, it first checks whether the configuration file config.ini exists. If it exists, the configuration file is loaded directly, and the window is created by obtaining the display parameters in the configuration file. The display parameters include window size, etc.
[0080] This invention actively detects the existence of a configuration file and reads the preset display parameters therein, enabling window construction to reuse the personalized display configuration preset by the user or the system last time. This avoids the repetitive operation of manually adjusting the window style every time the system starts, and provides parameter basis for the rapid construction of subsequent windows.
[0081] A preset display window is constructed based on the display parameters; In this embodiment of the invention, a display window is directly generated based on display parameters (such as window size, theme color, coordinate axis style, etc.), so that the appearance and layout of the window meet the pre-set display requirements, thereby ensuring the consistency of the three-dimensional trajectory display interface.
[0082] If no configuration file is detected, a configuration file is generated based on preset display parameters; In this embodiment of the invention, if no configuration file is detected, the create_default_config() method is automatically called to generate a configuration file based on preset display parameters (such as 500 pixels wide and 400 pixels high).
[0083] When no existing configuration file is detected, the present invention automatically generates a new configuration file based on the built-in preset display parameters, enabling the system to start with zero configuration and automatically save default settings. This eliminates the tedious process of users manually creating configuration files and provides a standardized source of parameters for subsequent window construction.
[0084] Read the configuration file and construct a preset display window based on the preset display parameters.
[0085] In this embodiment of the invention, when reading configuration parameters, a fallback mechanism can be used to handle abnormal values. When a configuration item is missing or the value is invalid, it will automatically fall back to the default value, ensuring that the system can start and run normally under various configuration states.
[0086] This invention creates a display window by reading display parameters from a configuration file, allowing users to customize display parameters by modifying the configuration file. Users can adjust the width and height of the display window according to actual needs without changing the source code, achieving flexible configuration and adapting to different display requirements. Furthermore, it automatically creates a configuration file when it is missing, effectively improving the convenience of display window configuration.
[0087] In one embodiment, the mouse events include press events and move events, and the step of listening to user input mouse events and determining mouse displacement based on the mouse events includes: Upon receiving a press event, record the starting coordinates of the press event; In this embodiment of the invention, mouse events are signals generated by the system when a user operates the mouse, such as mouse events corresponding to pressing the left mouse button, moving the mouse, and releasing the button. A press event is triggered the instant the user presses the left mouse button (or other key); a move event is triggered when the mouse pointer position changes continuously as the user presses and drags the mouse; the starting coordinates are the (x, y) positions of the mouse pointer on the screen or canvas at the instant the mouse button is pressed, serving as the reference origin for dragging; and the mouse displacement is the offset of the current coordinates relative to the starting coordinates.
[0088] Upon receiving a movement event, the mouse displacement is determined based on the starting coordinates and the current coordinates.
[0089] This invention enables interactive functionality where users can naturally control the rotation of a three-dimensional view simply by pressing and dragging, by recording the starting coordinates of a press event and calculating the displacement in real time during a movement event. No additional buttons or menu operations are required, allowing instructors to intuitively observe the spatial deviation of the flight trajectory from multiple angles, significantly improving the ease of operation and analysis efficiency during the debriefing process.
[0090] In one embodiment, the mouse displacement includes X-axis displacement and Y-axis displacement, and updating the viewpoint of the three-dimensional trajectory based on the mouse displacement includes: The azimuth angle of the three-dimensional trajectory is updated based on the X-axis displacement using a preset adjustment coefficient. In this embodiment of the invention, the preset adjustment coefficient is a fixed multiplier factor used to control the sensitivity of mouse dragging and view rotation angle. The preset adjustment coefficient can be set and adjusted according to actual needs; for example, the preset adjustment coefficient can be set to 0.4, 0.5, or 0.6, etc.
[0091] The elevation angle of the three-dimensional trajectory is updated based on the Y-axis displacement using a preset adjustment coefficient.
[0092] In this embodiment of the invention, the X-axis displacement is the horizontal drag distance of the mouse; the Y-axis displacement is the vertical drag distance of the mouse. The azimuth angle is the angle at which the observation point in a 3D scene rotates around the vertical axis (Z-axis), which can be understood as left-right panning; adjusting the azimuth angle allows the screen to rotate horizontally. The elevation angle is the pitch angle of the observation point relative to the horizontal plane, which can be understood as up-down panning; a positive elevation angle indicates looking down from above, and a negative angle indicates looking up from below. In this embodiment of the invention, the azimuth angle range can be limited to 90° to prevent viewpoint flipping.
[0093] In this embodiment of the invention, the mouse event also includes a release event, which is the event generated by releasing the mouse button. When the release event is detected, the drag state is cleared, and after each view update, view_init() can be called immediately to apply the new parameters and redraw the canvas, achieving a smooth and fluid real-time rotation effect, thereby allowing the user to observe the three-dimensional trajectory from multiple angles.
[0094] The embodiments of the present invention control the sensitivity by preset adjustment coefficients and determine the mouse displacement based on the mouse events in order to adjust the viewing angle of the three-dimensional trajectory, so that users can intuitively observe the spatial shape of the flight trajectory from multiple angles through simple drag operations.
[0095] In one embodiment, displaying the three-dimensional trajectory according to a preset display window includes: Calculate the data range of the target flight data, and if the data range is zero, set the data range to a preset lower limit value; wherein, the data range includes longitude range, latitude range, and altitude range; In this embodiment of the invention, the target flight data is a combination of all currently received flight data points. Each data point includes longitude, latitude, and altitude data, and each data point corresponds to a data range. The data range is the difference between the maximum and minimum values in a certain dimension. For example, the longitude range is the maximum longitude value minus the minimum longitude value among all data points; the latitude range is the maximum latitude value minus the minimum latitude value among all data points; and the altitude range is the maximum altitude value minus the minimum altitude value among all data points.
[0096] In this embodiment of the invention, the preset lower limit value serves as a minimum value set manually to avoid division by zero or image degradation when the range is zero (i.e., all data are exactly the same in that dimension). For example, it can be set as a lower limit of 0.0001° for longitude / latitude and 10 meters for altitude.
[0097] In this embodiment of the invention, all values of longitude, latitude, and altitude are extracted respectively, the maximum and minimum values of each dimension are calculated, and then the difference is taken to obtain the range. It is determined whether each range is equal to 0: if it is not equal to 0, the original range value is maintained. If it is equal to 0 (for example, all longitudes are 120.5°), the range is forcibly set to a preset lower limit value, for example, longitude / latitude is 0.0001°, and altitude is 10 meters.
[0098] Using a preset ratio of data range as the margin, the display range of the coordinate axes is adjusted, and the three-dimensional trajectory is displayed within the display range.
[0099] In this embodiment of the invention, the preset ratio is a percentage used to calculate the margin, which can be set and adjusted as needed. For example, the preset ratio can be set to 10% or 12%. The margin is an additional display space beyond the minimum and maximum values of the data, so that the trajectory does not tightly adhere to the coordinate axis borders. The coordinate axis display range is the interval between the minimum and maximum values displayed for each of the X, Y, and Z axes in the three-dimensional coordinate system.
[0100] In this embodiment of the invention, using a preset ratio of data range as the margin, the display range of the coordinate axes can be adjusted as follows: Using margins as buffer spaces, buffer spaces are left on both sides of the minimum and maximum values of the data to ensure that the trajectory does not touch the coordinate axis boundaries. For example, assuming the flight longitude range is 120.1~120.5, with a longitude range of 0.4°, leave 0.4×10%=0.04° on the left and 0.04° on the right, so the X-axis display range becomes: 120.06~120.54.
[0101] This invention enables adaptive display of flight trajectories in multiple scenarios by processing the range to zero and dynamically adjusting the coordinate axis range using a preset ratio range as the bidirectional margin, thus ensuring the integrity of the image.
[0102] In one embodiment, before displaying the three-dimensional trajectory according to a preset display window, the method further includes: Continuously acquire flight data using a non-blocking data acquisition method; In this embodiment of the invention, the flight data includes longitude, latitude, and altitude data, which are segmented using a preset segmentation string.
[0103] In this embodiment of the invention, a UDP Socket can be created using the UDPReceiver class, bound to port 12345, and the receive timeout set to 0.1 seconds. During program execution, the main loop calls the data acquisition function every 100 milliseconds using the after(100, update_plot) method of tkinter. Inside update_plot(), a while loop continuously calls socket.recv() until the timeout occurs, thereby reading all arriving data packets in batches.
[0104] This invention sets a receive timeout to achieve non-blocking data acquisition, so that the display interface will not lag due to waiting for data, thereby effectively improving the stability of flight data display.
[0105] The flight data is parsed into floating-point values based on a preset segmentation string; wherein the floating-point values include longitude floating-point values, latitude floating-point values, and altitude floating-point values; In this embodiment of the invention, the read flight data can be split into three substrings according to a preset segmentation string, and the three substrings can be converted into floating-point values respectively. The three floating-point values are longitude floating-point values, latitude floating-point values and altitude floating-point values, so as to perform mathematical calculations and three-dimensional coordinate mapping.
[0106] Update the current 3D trajectory based on the floating-point value.
[0107] In one embodiment, the embedded WindowsFormsHost can also be initialized, and an external process can be started asynchronously. When the control is loaded, PYTHON_3D_PLOT.exe is started in a background thread. The multi-strategy window handle is obtained by first searching for a process ID similar to the window title, and then traversing all processes with the same name to determine the single executor. After finding the executor, the main thread is switched to perform the embedding operation. When the program is closed, a process cleanup operation is performed to ensure that the process exits completely.
[0108] In this embodiment of the invention, WindowsFormsHost is a container in WPF used to host WinForms controls, allowing traditional Windows Forms controls to be displayed in the WPF interface; asynchronous startup: an external process is started in a background thread without blocking the main interface, and the main thread can still respond to user operations. Multi-strategy window handle acquisition refers to using multiple methods (window title matching, process name traversal) to find the operating system handle (HWND) of the target window, ensuring accurate capture of the running 3D program window.
[0109] This invention integrates the 3D trajectory program into the main interface of the presentation by using WindowsFormsHost, asynchronous startup, multi-strategy window handle acquisition, main thread embedding, and process cleanup. The main program is unified and separated from third-party programs, thereby effectively improving code usability and reducing maintenance workload.
[0110] Implementing the embodiments of the present invention has the following beneficial effects: This invention performs real-time rendering of the 3D trajectory and differentiates and draws multiple objects (historical trajectory curves, real-time position points) based on point-by-point mapping of flight data to a 3D Cartesian coordinate system. This makes the flight path appear as an interactive spatial curve in a dark-themed 3D window, allowing users to drag the mouse to change the azimuth and elevation angles and observe the aircraft's motion trend and attitude changes from multiple perspectives. It intuitively displays the aircraft's real motion trajectory, attitude changes, and spatial position relationships in 3D space, thus enabling multi-dimensional display of flight data and improving the effectiveness of simulation teaching.
[0111] Furthermore, by recording the starting coordinates of the press event and calculating the displacement in real time during the movement event, this invention enables users to naturally control the rotation of the three-dimensional view simply by pressing and dragging, without the need for additional buttons or menu operations. This allows instructors to intuitively observe the spatial deviation of the flight trajectory from multiple angles, significantly improving the ease of operation and analysis efficiency during the review process.
[0112] Figure 6 An example is a schematic diagram of the physical structure of an electronic device, such as... Figure 6 As shown, the electronic device may include: a processor 610, a communications interface 620, a memory 630, and a communication bus 640, wherein the processor 610, the communications interface 620, and the memory 630 communicate with each other via the communication bus 640. The processor 610 can call logical instructions in the memory 630 to execute flight data display methods, including: Acquire target flight data, map the target flight data to a pre-constructed three-dimensional Cartesian coordinate system, and generate a three-dimensional trajectory; The three-dimensional trajectory is displayed according to the preset display window; Listen for mouse events input by the user and determine the mouse displacement based on the mouse events; The viewpoint of the three-dimensional trajectory is updated based on the mouse displacement, wherein the viewpoint includes azimuth and elevation angles.
[0113] Furthermore, the logical instructions in the aforementioned memory 630 can be implemented as software functional units and, when sold or used as independent products, can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0114] On the other hand, the present invention also provides a computer program product, the computer program product comprising a computer program, the computer program being able to be stored on a non-transitory computer-readable storage medium, and when the computer program is executed by a processor, the computer being able to execute the flight data display method provided by the above methods, including: Acquire target flight data, map the target flight data to a pre-constructed three-dimensional Cartesian coordinate system, and generate a three-dimensional trajectory; The three-dimensional trajectory is displayed according to the preset display window; Listen for mouse events input by the user and determine the mouse displacement based on the mouse events; The viewpoint of the three-dimensional trajectory is updated based on the mouse displacement, wherein the viewpoint includes azimuth and elevation angles.
[0115] In another aspect, the present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, is implemented to perform the flight data display methods provided by the above methods, including: Acquire target flight data, map the target flight data to a pre-constructed three-dimensional Cartesian coordinate system, and generate a three-dimensional trajectory; The three-dimensional trajectory is displayed according to the preset display window; Listen for mouse events input by the user and determine the mouse displacement based on the mouse events; The viewpoint of the three-dimensional trajectory is updated based on the mouse displacement, wherein the viewpoint includes azimuth and elevation angles.
[0116] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Those skilled in the art can understand and implement this without any creative effort.
[0117] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus necessary general-purpose hardware platforms, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solutions, in essence or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in the various embodiments or some parts of the embodiments.
[0118] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A method for displaying flight data, characterized in that, include: Acquire target flight data, map the target flight data to a pre-constructed three-dimensional Cartesian coordinate system, and generate a three-dimensional trajectory; The three-dimensional trajectory is displayed according to the preset display window; Listen for mouse events input by the user and determine the mouse displacement based on the mouse events; The viewpoint of the three-dimensional trajectory is updated based on the mouse displacement, wherein the viewpoint includes azimuth and elevation angles.
2. The flight data display method as described in claim 1, characterized in that, Before acquiring target flight data and mapping it to a pre-constructed three-dimensional Cartesian coordinate system to form a three-dimensional trajectory, the process includes: If a configuration file is detected, the display parameters in the configuration file are read; A preset display window is constructed based on the display parameters; If no configuration file is detected, a configuration file is generated based on preset display parameters; Read the configuration file and construct a preset display window based on the preset display parameters.
3. The flight data display method as described in claim 1, characterized in that, The mouse events include press events and move events. Listening for user input mouse events and determining the mouse displacement based on these events includes: Upon receiving a press event, record the starting coordinates of the press event; Upon receiving a movement event, the mouse displacement is determined based on the starting coordinates and the current coordinates.
4. The flight data display method as described in claim 1, characterized in that, The mouse displacement includes X-axis displacement and Y-axis displacement, and updating the viewpoint of the three-dimensional trajectory based on the mouse displacement includes: The azimuth angle of the three-dimensional trajectory is updated based on the X-axis displacement using a preset adjustment coefficient. The elevation angle of the three-dimensional trajectory is updated based on the Y-axis displacement using a preset adjustment coefficient.
5. The flight data display method as described in claim 1, characterized in that, The step of displaying the three-dimensional trajectory according to the preset display window includes: Calculate the data range of the target flight data, and if the data range is zero, set the data range to a preset lower limit value; wherein, the data range includes longitude range, latitude range, and altitude range; Using a preset ratio of data range as the margin, the display range of the coordinate axes is adjusted, and the three-dimensional trajectory is displayed within the display range.
6. The flight data display method as described in claim 1, characterized in that, Before displaying the three-dimensional trajectory according to the preset display window, the following is also included: Continuously acquire flight data using a non-blocking data acquisition method; The flight data is parsed into floating-point values based on a preset segmentation string; wherein the floating-point values include longitude floating-point values, latitude floating-point values, and altitude floating-point values; Update the current 3D trajectory based on the floating-point value.
7. A flight data display device, characterized in that, include: A three-dimensional trajectory generation module is used to acquire target flight data, map the target flight data to a pre-constructed three-dimensional Cartesian coordinate system, and generate a three-dimensional trajectory. A 3D trajectory display module is used to display the 3D trajectory according to a preset display window; The mouse displacement determination module is used to listen to mouse events input by the user and determine the mouse displacement based on the mouse events. A perspective update module is used to update the perspective of the three-dimensional trajectory based on the mouse displacement, wherein the perspective includes azimuth and elevation angles.
8. An electronic device comprising a memory, a processor, and a computer program stored in the memory and running on the processor, characterized in that, When the processor executes the computer program, it implements the flight data display method as described in any one of claims 1 to 6.
9. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the flight data display method as described in any one of claims 1 to 6.
10. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by the processor, it implements the flight data display method as described in any one of claims 1 to 6.