A method for communication between an unreal engine and a semi-physical simulation system
By integrating FastDDS communication middleware and making plug -ins, in the semi -physical simulation system, the same communication protocol is used to solve the efficiency and reliability of data interaction between the illusory engine and the semi -object simulation system. Efficient and reliable data transmission.
Patent Information
- Application Number
- CN202410290614.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-03-14
- Publication Date
- 2025-01-28
- Estimated Expiration
- 2044-03-14
AI Technical Summary
In the prior art, the data interaction between Unreal Engine and the semi-physical simulation system has problems such as large delay, small data volume, complex communication protocols and easy frame loss, and lacks FastDDS communication plug-in.
The FastDDS communication middleware is used as the underlying communication protocol to make a third -party library plug -in in the illusory engine. In the semi -physical simulation system, the same communication protocol is used to achieve data interaction with the unreal engine through the control software to achieve data interaction.
The data transmission delay, fast transmission speed, large transmission data volume, simple and easy -to -use communication protocols, light simulation machine loads, strong software and hardware platforms have strong adaptability, and have reliable transmission error correction capabilities and interrupt signal transmission support.
Smart Images

Figure CN118069395B_ABST
Abstract
Description
Technical Field
[0001] The invention relates to the technical field of semi-physical simulation, in particular to a method for communication between an unreal engine and a semi-physical simulation system. Background Art
[0002] Equipment simulation tests play an important role in simulation technology. LVC (integrated) simulation technology, which combines semi-physical simulation systems with digital simulation systems, is the current research frontier of joint combat experimental technology. Through LVC (virtual-real integration) simulation, a cross-level simulation environment combining virtual and real can be constructed, which greatly improves the credibility of simulation and can be used to verify digital simulation models and train intelligent combat algorithms.
[0003] Unreal Engine (UE) is an open source industrial-grade development engine. It has become one of the most popular game engines today due to its powerful real-time rendering capabilities, highly realistic image quality effects, and rich auxiliary development tools in the open source community.
[0004] DDS (Data Distribution Service) middleware adopts the publish / subscribe model and provides a variety of QoS service quality strategies to ensure real-time, efficient and flexible data release.
[0005] In the prior art, the Unreal Engine has the function of creating plug-ins, but there is no available FastDDS (Fast Date-Distribution Service) plug-in for communication.
[0006] The disadvantages of the prior art are as follows:
[0007] 1. Traditional Ethernet data transmission based on TCP / IP protocol has large delay, small data transmission volume, complex communication protocol, and easy frame loss.
[0008] 2. There is no FastDDS communication plugin available for Unreal Engine.
[0009] 3. There is little research on the interaction between Unreal Engine and semi-physical simulation systems. Summary of the invention
[0010] In order to overcome the shortcomings of the prior art, the present invention provides a method for communication between an unreal engine and a semi-physical simulation system, which solves the problems existing in the prior art such as difficulty in realizing efficient and reliable data interaction between the unreal engine and the semi-physical simulation system.
[0011] The technical solution adopted by the present invention to solve the above problems is:
[0012] A method for communicating between an Unreal Engine and a semi-physical simulation system adopts FastDDS communication middleware as the underlying communication protocol, makes a third-party library plug-in in the Unreal Engine, and adopts the same communication protocol with the Unreal Engine through control software in the semi-physical simulation system to realize data interaction between the Unreal Engine and the semi-physical simulation system.
[0013] As a preferred technical solution, the following steps are included:
[0014] S1, FastDDS protocol encapsulation: encapsulate the FastDDS protocol by encapsulating the FastDDS standard library;
[0015] S2, Unreal Engine plugin production: Make FastDDS into a third-party library plugin;
[0016] S3, use of semi-physical simulation system management and control software: use the management and control software in the semi-physical simulation system to manage the semi-physical simulation machine and communicate with the outside world.
[0017] As a preferred technical solution, step S1 includes the following steps:
[0018] S11, creating a .idl file of a message transmission style: defining a .idl file in the FastDDS protocol, specifying a message transmission style, and compiling and generating a FastDDS library based on the message transmission style; wherein the FastDDS library includes a static link library .lib file and a dynamic link library .dll file;
[0019] S12, create a C++ base class of the publisher: create a publisher base class in the project, use the message transmission style defined in step S11 to send data, and expose the function of data sending;
[0020] S13, create a C++ base class of the subscriber: create a subscriber base class in the project, receive data that conforms to the message transmission style defined in step S11, and expose the function of data reception;
[0021] S14, create an initialized C++ base class: create an initialized base class in the project;
[0022] S15, Encapsulation Protocol: Encapsulate the project, based on the publisher base class, subscriber base class, and initialization base class created in the project, define the channel creation interface function createChannel, the message sending interface function sendMsg, and the message receiving interface function recvMsg.
[0023] As a preferred technical solution, in step S11, the message transmission style includes one or more of the following: message identifier, timestamp, sender identifier, receiver identifier, and interactive content.
[0024] As a preferred technical solution, in step S12, the publisher base class references the Publisher library in the FastDDS standard library, defines a specific implementation function for message sending in the publisher base class, and initializes the DDS publishing class.
[0025] As a preferred technical solution, in step S13, the subscriber base class references the Subscriber library in the FastDDS standard library, defines a specific implementation function for message reception in the subscriber base class, and initializes the DDS subscription class.
[0026] As a preferred technical solution, in step S14, the initialization of the FastDDS message channel is defined in the initialization base class, including the initialization of the publisher and the initialization of the subscriber.
[0027] As a preferred technical solution, step S2 includes the following steps:
[0028] S21, expand the FastDDS standard library into a C++ project, compile the project into a dynamic link library, add the macro definition required by the Unreal Engine plug-in in the project preprocessor, so that the dynamic link library can be recognized and used by the Unreal Engine;
[0029] S22, creating a blank plug-in in the Unreal Engine, adding the .dll file and .lib file generated in step S11 to the generated plug-in directory, and adding the header file in the FastDDS standard library in step S1 to the generated plug-in directory;
[0030] S23, in the .build.cs file of the plug-in, use PublicIncludePaths to set the include directory of the plug-in, use PublicAdditionalLibraries to set the library directory information, and add other module information required by the plug-in;
[0031] S24, add a blueprint function library class in the plug-in, create a blueprint function in the blueprint function library class, convert the data types of the messages to be sent and received, and the data types exposed to the blueprint are all data types available to the blueprint.
[0032] As a preferred technical solution, in step S24, the blueprint function includes one or more of the following functions: initialization function, message sending function, message receiving function, encapsulated channel creation interface function, message sending interface function, and message receiving interface function.
[0033] As a preferred technical solution, step S3 includes the following steps:
[0034] S31, using control software to manage the semi-physical simulation machine;
[0035] S32, the control software uses the FastDDS protocol of step S1 to achieve communication with the Unreal Engine.
[0036] Compared with the prior art, the present invention has the following beneficial effects:
[0037] (1) The data transmission based on FastDDS of the present invention has the characteristics of small data transmission delay, fast transmission speed, large transmission data volume, simple and easy-to-use communication protocol, light load of simulation machine, strong adaptability of software and hardware platform, reliable transmission error correction capability, support for interrupt signal transmission, etc., which can meet the requirements of semi-physical simulation system and Unreal Engine for real-time and large-scale data transmission.
[0038] (2) The present invention integrates FastDDS into the Unreal Engine and encapsulates it into a plug-in to facilitate the transplantation of communication functions. BRIEF DESCRIPTION OF THE DRAWINGS
[0039] Figure 1 Flowchart for FastDDS communication protocol encapsulation;
[0040] Figure 2 A flowchart made for the FastDDS plugin in the Unreal Engine platform;
[0041] Figure 3 This is a flowchart of data interaction between Unreal Engine and semi-physical simulation system. DETAILED DESCRIPTION
[0042] The present invention will be further described in detail below in conjunction with embodiments and drawings, but the embodiments of the present invention are not limited thereto.
[0043] Example 1
[0044] like Figures 1 to 3 As shown, the present invention proposes a method for communication between an Unreal Engine and a semi-physical simulation system based on FastDDS. The method mainly allows the Unreal Engine and the semi-physical simulation system to use the efficient and stable FastDDS middleware protocol for data transmission, and uses json as the data transmission format. By encapsulating the FastDDS standard library, a convenient external interface is provided; by encapsulating the third-party library plug-in supported by the Unreal Engine, the FastDDS service is provided for the Unreal Engine, and the reuse capability of the service is realized; the semi-physical simulation system is uniformly managed and communicated with the outside through the control software, providing a high-quality communication method for the integrated joint experiment between the Unreal Engine and the semi-physical simulation.
[0045] Therefore, the present invention adopts FastDDS, an open source DDS standard implementation, for communication between the Unreal Engine and the semi-physical simulation system, providing effective data interaction support for LVC simulation.
[0046] In order to solve the communication problem of virtual-reality integrated experiment, the present invention proposes a method for communication between Unreal Engine and semi-physical simulation system based on FastDDS to solve the problem of how to achieve efficient and reliable data interaction between Unreal Engine and semi-physical simulation system. The method adopts FastDDS communication middleware as the underlying communication protocol, makes a third-party library plug-in in Unreal Engine, and adopts the same communication protocol with Unreal Engine in the semi-physical simulation system through the control software to achieve data interaction.
[0047] Furthermore, the method of the invention needs to perform the following steps:
[0048] (1) FastDDS protocol encapsulation
[0049] In order to make it more convenient for users, it is necessary to encapsulate the FastDDS standard library, encapsulate the code for creating channels, initializing "publishers" and "subscribers", and only expose a few common interfaces. The specific methods include:
[0050] 1) Create a message transmission style .idl file
[0051] Define the .idl file in the FastDDS protocol to specify the message transmission style. The data includes information about the message ID, timestamp, sender ID, receiver ID, and interaction content, and compile and generate the FastDDS library based on this style.
[0052] 2) Create a C++ base class for "Publisher"
[0053] Create a "Publisher" base class in the project, which references the Publisher library in the FastDDS standard library. In this base class, define the specific implementation function of message sending, and initialize the DDS publishing class through the DataWriterListener object pointer, publishing topic and other information. Use the message transmission style defined in step 1) to send data and expose the data sending function.
[0054] 3) Create a C++ base class for "Subscriber"
[0055] Create a "Subscriber" base class in the project. This base class references the Subscriber library in the FastDDS standard library. In this base class, define the specific implementation function of message reception, initialize the DDS subscription class through the DataReaderListener object pointer, subscription topic and other information. Receive data that conforms to the message transmission style defined in step 1) and expose the data reception function.
[0056] 4) Create an "initialized" C++ base class
[0057] Create an "initialization" base class in the project. In this base class, define the initialization of the FastDDS message channel, including the initialization of the publisher and the initialization of the subscriber.
[0058] 5) Encapsulation Protocol
[0059] Encapsulate the project and, based on the classes created in steps (2), (3), and (4), define the channel creation interface function createChannel, the message sending interface function sendMsg, and the message receiving interface function recvMsg for other programs to call.
[0060] (2) Unreal Engine plugin production
[0061] To use FastDDS in Unreal Engine, you need to make FastDDS into a third-party library plug-in. The specific steps include:
[0062] 1) Compile the project described in step (2) into a dynamic link library, and add the macro definitions required by the Unreal Engine plug-in in the project preprocessor, including UE_EXPORTS, so that the dynamic link library can be recognized and used by the Unreal Engine.
[0063] 2) Create a blank plugin in Unreal Engine, add the .dll file and .lib file generated in step 1) to the generated plugin directory, and add the header file in the project in step 1) to the generated plugin directory.
[0064] 3) In the .build.cs file of the plug-in, use PublicIncludePaths to set the include directory of the plug-in, use PublicAdditionalLibraries to set the library directory information, and add other module information required by the plug-in through other macro definitions.
[0065] 4) Add a blueprint function library class in the plug-in, create blueprint functions in this class, including initialization, message sending and message receiving functions, encapsulated channel creation interface function, message sending interface function and message receiving interface function, perform data type conversion on the messages to be sent and received, and the data types exposed to the blueprint are all data types available to the blueprint, which is convenient for use in the blueprint.
[0066] (3) Use of semi-physical simulation system control software
[0067] The semi-physical simulation system uses control software to manage the semi-physical simulation machine and communicate with the outside world. The specific practices include:
[0068] 1) Use a control software developed by QT to manage all semi-physical simulation machines.
[0069] 2) The control software adopts the communication protocol described in step (1) to achieve communication with the Unreal Engine.
[0070] The present invention encapsulates FastDDS into a plug-in of an unreal engine, and solves the reliability and efficient interaction problems of data transmission between a semi-physical system and the unreal engine through FastDDS.
[0071] The present invention creates a FastDDS communication plug-in in the Unreal Engine and communicates with the semi-physical simulation system based on the protocol.
[0072] Preferably, there is an OpenDDS plugin in the Unreal community.
[0073] Preferably, the semi-physical system can communicate with the outside via UDP.
[0074] As described above, the present invention can be preferably implemented.
[0075] All features disclosed in all embodiments in this specification, or steps in all methods or processes implicitly disclosed, except for mutually exclusive features and / or steps, can be combined and / or expanded or replaced in any manner.
[0076] The above description is only a preferred embodiment of the present invention and does not limit the present invention in any form. According to the technical essence of the present invention, within the spirit and principles of the present invention, any simple modification, equivalent replacement and improvement made to the above embodiment still falls within the protection scope of the technical solution of the present invention.
Claims
1. A method for communicating between an Unreal Engine and a semi-physical simulation system, characterized in that: Adopt FastDDS communication middleware as the underlying communication protocol, create a third-party library plug-in in the Unreal Engine, and use the same communication protocol with the Unreal Engine through the control software in the semi-physical simulation system to realize data interaction between the Unreal Engine and the semi-physical simulation system; The following steps are involved: S1, FastDDS protocol encapsulation: encapsulate the FastDDS protocol by encapsulating the FastDDS standard library; S2, Unreal Engine plugin production: Make FastDDS into a third-party library plugin; S3, use of semi-physical simulation system management and control software: use the management and control software in the semi-physical simulation system to manage the semi-physical simulation machine and communicate with the outside world; Step S2 includes the following steps: S21, expand the FastDDS standard library into a C++ project, compile the project into a dynamic link library, add the macro definition required by the Unreal Engine plug-in in the project preprocessor, so that the dynamic link library can be recognized and used by the Unreal Engine; S22, creating a blank plug-in in the Unreal Engine, adding the .dll file and .lib file generated in step S11 to the generated plug-in directory, and adding the header file in the FastDDS standard library in step S1 to the generated plug-in directory; S23, in the .build.cs file of the plug-in, use PublicIncludePaths to set the include directory of the plug-in, use PublicAdditionalLibraries to set the library directory information, and add other module information required by the plug-in; S24, add a blueprint function library class in the plug-in, create a blueprint function in the blueprint function library class, convert the data types of messages to be sent and received, and the data types exposed to the blueprint are all data types available to the blueprint; Step S3 includes the following steps: S31, using control software to manage the semi-physical simulation machine; S32, the control software uses the FastDDS protocol of step S1 to achieve communication with the Unreal Engine.
2. The method for communicating between an Unreal Engine and a semi-physical simulation system according to claim 1, characterized in that: Step S1 includes the following steps: S11, creating a .idl file of a message transmission style: defining a .idl file in the FastDDS protocol, specifying a message transmission style, and compiling and generating a FastDDS library based on the message transmission style; wherein the FastDDS library includes a static link library .lib file and a dynamic link library .dll file; S12, create a C++ base class of the publisher: create a publisher base class in the project, use the message transmission style defined in step S11 to send data, and expose the function of data sending; S13, create a C++ base class of the subscriber: create a subscriber base class in the project, receive data that conforms to the message transmission style defined in step S11, and expose the function of data reception; S14, create an initialized C++ base class: create an initialized base class in the project; S15, Encapsulation Protocol: Encapsulate the project, based on the publisher base class, subscriber base class, and initialization base class created in the project, define the channel creation interface function createChannel, the message sending interface function sendMsg, and the message receiving interface function recvMsg.
3. The method for communicating between an Unreal Engine and a semi-physical simulation system according to claim 2, characterized in that: In step S11, the message transmission style includes one or more of the following: message identifier, timestamp, sender identifier, receiver identifier, and interactive content.
4. The method for communicating between an Unreal Engine and a semi-physical simulation system according to claim 3, characterized in that: In step S12, the publisher base class references the Publisher library in the FastDDS standard library, defines the specific implementation function of message sending in the publisher base class, and initializes the DDS publishing class.
5. The method for communicating between an Unreal Engine and a semi-physical simulation system according to claim 4, characterized in that: In step S13, the subscriber base class references the Subscriber library in the FastDDS standard library, defines the specific implementation function of message reception in the subscriber base class, and initializes the DDS subscription class.
6. The method for communicating between an Unreal Engine and a semi-physical simulation system according to claim 5, characterized in that: In step S14, the initialization of the FastDDS message channel is defined in the initialization base class, including the initialization of the publisher and the initialization of the subscriber.
7. The method for communicating between an Unreal Engine and a semi-physical simulation system according to claim 1, characterized in that: In step S24, the blueprint function includes one or more of the following functions: initialization function, message sending function, message receiving function, encapsulated channel creation interface function, message sending interface function, and message receiving interface function.
Citation Information
Patent Citations
Collaborative simulation method of Modelica platform and UE4 based on Opendds
CN115422723A
Virtual-real combined simulation method, device and system for multiple unmanned aerial vehicles
CN115951598A