Application program generation method and device, equipment, medium and vehicle
By entering DDS scenario information into IDL code generation tool, generating and modifying application framework code, the problems of high development difficulty and low development efficiency in the existing DDS application development process are solved, and efficient and reliable application development is achieved.
Patent Information
- Application Number
- CN202411984279.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-30
- Publication Date
- 2025-05-02
AI Technical Summary
In the existing DDS application development process, developers need to invest a lot of work to write code, which leads to high development difficulty, cumbersome exception handling, and easy to miss or errors, affecting the stability and quality of the application and reducing development efficiency.
By inputting the DDS scenario information of the data distribution service DDS scenario information into the IDL code generation tool, the code of the application framework is generated based on the extended syntax, and the code is modified according to business needs to obtain the application's target code.
Reduces the time for developers to write code, improves the efficiency of application development, reduces the possibility of code errors, and improves the quality and reliability of generated code.
Smart Images

Figure CN119917088A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of computer technology, and in particular to a method, apparatus, device, medium and vehicle for generating an application program. Background Art
[0002] Data Distribution Service (DDS) is an efficient, reliable, scalable, and secure data communication protocol that is widely used in distributed systems. At present, the development process of DDS applications is mainly divided into three steps: first, define the subject data type according to the business scenario, then generate the code file related to the subject data type according to the IDL generator, and finally write the DDS application code according to the code file related to the subject data type. Among them, the last step of writing the DDS application code requires developers to invest a lot of work, accounting for more than 80% of the workload of the entire development process, and the development content is cumbersome.
[0003] Therefore, the existing way for developers to write DDS application code is difficult to develop, and exception handling is cumbersome and prone to omissions or errors, which affects the stability and quality of DDS applications, makes it take a long time to develop applications, and leads to low development efficiency of DDS applications. Summary of the invention
[0004] In order to overcome the problems existing in the related art, the present disclosure provides a method, apparatus, device, medium and vehicle for generating an application, which can improve the development efficiency of the application.
[0005] According to a first aspect of an embodiment of the present disclosure, there is provided a method for generating an application, comprising: inputting acquired data distribution service DDS scenario information into an IDL code generation tool, and generating application framework code based on an extended syntax of the IDL code generation tool, wherein the application framework code includes a data entity instance metadata code and a description metadata code corresponding to the data entity;
[0006] According to the business requirement information of the data distribution service DDS, the code of the application framework is modified to obtain the target code of the application;
[0007] The extended syntax of the IDL code generation tool includes metadata definition syntax corresponding to the data entity. The IDL code generation tool has a template engine for generating codes of the application framework. The template engine is created based on the syntax tree of the IDL code generation tool.
[0008] In an achievable implementation, the metadata definition syntax corresponding to the data entity includes the metadata code definition syntax corresponding to the subject, the metadata code definition syntax corresponding to the DDS data entity instance, the metadata code definition syntax corresponding to the quality of service policy QOS, the metadata code definition syntax corresponding to the listener, and the code definition syntax corresponding to the data type. The metadata code definition syntax corresponding to the listener is used to create a listener to asynchronously receive data.
[0009] In an achievable implementation, the IDL code generation tool includes an initial syntax. Before inputting the acquired data distribution service DDS scenario information into the IDL code generation tool and generating the application framework code based on the extended syntax of the IDL code generation tool, the method further includes:
[0010] The initial grammar is expanded based on the BNF grammar rules to obtain the extended grammar, which is used to define the instance of the data entity;
[0011] The instance of the data entity is defined including a reader who subscribes to data, a writer who publishes data, a subscriber for creating readers, a publisher for creating writers, and a domain participant for creating an instance of the data entity.
[0012] In an achievable implementation, the data entity instance metadata code includes at least one of a metadata code for describing a domain participant, a metadata code for describing a publisher, a metadata code for describing a subscriber, a metadata code for describing a reader, and a metadata code for describing a writer, and the descriptive metadata code corresponding to the data entity includes at least one of a metadata code for describing a domain corresponding to the data entity, a metadata code for describing a quality of service policy corresponding to the data entity, a metadata code for describing a subject corresponding to the data entity, and a metadata code for describing a listener corresponding to the data entity.
[0013] In one feasible implementation, the metadata code for describing the service quality policy corresponding to the data entity includes a first metadata code and a second metadata code, and the second metadata code is obtained based on a combination of at least two metadata codes for describing the service quality policy corresponding to the data entity.
[0014] In an achievable implementation, the target code is a code for autonomous driving; the target code includes a first reader metadata code and a second reader metadata code for describing a reader and a target writer metadata code for describing a writer, the reader created corresponding to the first reader metadata code is used to subscribe to real-time camera image data, the reader created corresponding to the second reader metadata code is used to subscribe to real-time vehicle status information, and the writer created corresponding to the target writer metadata code is used to send corresponding control commands according to the real-time camera image data and the real-time vehicle status information;
[0015] The first reader metadata code corresponds to a first quality of service policy metadata code, a first listener metadata code, a second listener metadata code and a first domain metadata code, the first quality of service policy metadata code is used to stipulate that loss of real-time camera image data is allowed, the first listener metadata code is used to monitor the number of acquired real-time camera image data, the second listener metadata code is used to asynchronously subscribe to real-time camera image data, and the first domain metadata code is used to identify the domain corresponding to the first reader metadata code;
[0016] The second reader metadata code corresponds to a second quality of service policy metadata code, a third listener metadata code, and a second domain metadata code, the second quality of service policy metadata code is used to stipulate that the real-time vehicle status information is not allowed to be lost, the third listener metadata code is used to monitor whether the writing end corresponding to the real-time vehicle status information is offline, and the second domain metadata code is used to identify the domain corresponding to the second reader metadata code;
[0017] The target writer metadata code corresponds to a third service quality policy metadata code, a target subject metadata code and a third domain metadata code. The third service quality policy metadata code is used to specify that loss of control commands is allowed. The target subject metadata code is used to identify the subject corresponding to the target writer metadata code. The third domain metadata code is used to identify the domain corresponding to the target writer metadata code.
[0018] According to a second aspect of an embodiment of the present disclosure, there is provided a device for generating an application program, including:
[0019] An input module, which is used to input the acquired data distribution service DDS scenario information into an IDL code generation tool, and generate application framework code based on the extended syntax of the IDL code generation tool. The application framework code includes data entity instance metadata code and description metadata code corresponding to the data entity;
[0020] A modification module is used to modify the code of the application framework according to the business requirement information of the data distribution service DDS to obtain the target code of the application;
[0021] The extended syntax of the IDL code generation tool includes metadata definition syntax corresponding to the data entity. The IDL code generation tool has a template engine for generating codes of the application framework. The template engine is created based on the syntax tree of the IDL code generation tool.
[0022] According to a third aspect of an embodiment of the present disclosure, a vehicle is provided, storing a set of instruction sets, which are executed by the vehicle to implement the method for generating an application provided by the first aspect of the present disclosure.
[0023] According to a fourth aspect of an embodiment of the present disclosure, an electronic device is provided, comprising: a processor; a memory for storing processor executable instructions; a processor, configured to read executable instructions from the memory and execute the instructions to implement the method for generating an application provided in the first aspect of the present disclosure.
[0024] According to a fifth aspect of an embodiment of the present disclosure, a computer-readable storage medium is provided, on which computer program instructions are stored, and when the program instructions are executed by a processor, the steps of the method for generating an application provided in the first aspect of the present disclosure are implemented.
[0025] The technical solution provided by the embodiments of the present disclosure may include the following beneficial effects: inputting the acquired data distribution service DDS scenario information into an IDL code generation tool, and generating the code of the application framework based on the extended syntax of the IDL code generation tool. According to the data distribution service DDS business requirement information, the code of the application framework is modified to obtain the target code of the application. The embodiments of the present disclosure obtain the code of the application framework by inputting the acquired data distribution service DDS scenario information into an IDL code generation tool, and modifying the code of the application framework to obtain the target code of the application. It enables developers to create applications based on the target code of the application, thereby reducing the time spent by developers on developing applications, and ultimately improving the development efficiency of applications.
[0026] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS
[0027] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and, together with the description, serve to explain the principles of the present disclosure.
[0028] Figure 1 The figure is a flow chart showing a method for developing a DDS application according to an exemplary embodiment.
[0029] Figure 2The figure is a flowchart showing a method for developing a DDS application according to a business scenario according to an exemplary embodiment.
[0030] Figure 3 The invention is a flowchart of a method for generating an application program according to an exemplary embodiment.
[0031] Figure 4 The invention is a block diagram showing generation of an application program according to an exemplary embodiment.
[0032] Figure 5 is a block diagram of a vehicle according to an exemplary embodiment.
[0033] Figure 6 It is a block diagram of an electronic device according to an exemplary embodiment. DETAILED DESCRIPTION
[0034] Exemplary embodiments will be described in detail below with reference to the accompanying drawings.
[0035] It should be pointed out that the relevant embodiments and drawings are only for describing exemplary embodiments provided by the present disclosure, rather than all embodiments of the present disclosure, and it should not be understood that the present disclosure is limited to the relevant exemplary embodiments.
[0036] It should be noted that the terms "first", "second", etc. used in the present disclosure are only used to distinguish different steps, devices or modules, etc. The related terms neither represent any specific technical meanings nor indicate the order or interdependence between them.
[0037] It should be noted that the modifications of the terms "one", "multiple", and "at least one" used in the present disclosure are illustrative rather than restrictive. Unless otherwise clearly indicated in the context, it should be understood as "one or more".
[0038] It should be noted that the term "and / or" used in this disclosure is used to describe the association relationship between associated objects, and generally indicates that there are at least three association relationships. For example, A and / or B can at least indicate the existence of three association relationships: A exists alone, A and B exist at the same time, and B exists alone.
[0039] It should be noted that the various steps described in the method embodiments of the present disclosure may be performed in different orders and / or in parallel. Unless otherwise specified, the scope of the present disclosure is not limited by the order of description of the steps in the relevant embodiments.
[0040] It should be noted that all actions of acquiring signals, information or data in the present disclosure are carried out in compliance with the relevant data protection laws and policies of the country where the device is located and with the authorization given by the owner of the corresponding device.
[0041] Exemplary Methods
[0042] As an efficient, reliable, scalable and secure data communication protocol, DDS is widely used in distributed systems. Based on the various excellent performances of DDS, developers will also develop DDS applications to meet their needs.
[0043] Currently, the schematic diagram of the steps for developing DDS applications is as follows Figure 1 As shown, in S101, the business scenario of DDS is analyzed. In S102, the interface definition language (IDL) is defined according to the business scenario: the subject data type. In S103, the code file of the subject data type is generated using the IDL generator. In S104, the DDS application is developed according to the business scenario. Specifically, step S104 can be divided into three steps as follows: Figure 2 As shown, in S1041, a DDS publish-subscribe entity is created. In S1042, a Quality of Service (QOS) configuration policy of the DDS entity is set. In S1043, receiving and sending data is processed.
[0044] It should be noted that in the above steps, step S104 needs to be processed by developers, that is, developers need to create DDS publish-subscribe entities such as participants, publishers, subscribers, readers and writers involved in DDS, and also need to set the QOS configuration policy of the DDS entity, and finally process the receiving and sending of data. Therefore, the above steps require developers to write with reference to examples or official documents, because the code examples of most DDS applications are of low quality, and the official documents require developers to spend a lot of time to learn.
[0045] Therefore, in the related art, the development efficiency of DDS applications is not high.
[0046] The embodiments of the present disclosure provide a method, apparatus, device, medium and vehicle for generating an application program, which can solve the above-mentioned technical problems existing in the related technologies.
[0047] The disclosed embodiment inputs the acquired data distribution service DDS scenario information into an IDL code generation tool to obtain the code of the application framework, and modifies the code of the application framework to obtain the target code of the application, so that developers can create applications based on the target code of the application, thereby reducing the time spent by developers on developing applications and ultimately improving the development efficiency of the application.
[0048] Figure 3is a flowchart of a method for generating an application according to an exemplary embodiment. Figure 3 As shown, steps S310-S320 are included.
[0049] In step S310, the acquired data distribution service DDS scenario information is input into an IDL code generation tool, and based on the extended syntax of the IDL code generation tool, the code of the application framework is generated.
[0050] In this embodiment, the acquired data distribution service DDS scenario information can be input into an IDL code generation tool, so that the IDL code generation tool generates the code of the corresponding application framework based on the data distribution service DDS scenario information according to the built-in extended syntax.
[0051] The code of the application framework includes data entity instance metadata code and description metadata code corresponding to the data entity. The data entity instance metadata code represents metadata information used to define and describe entity instances corresponding to DDS scenario information. The description metadata code represents metadata information related to data entities. The extended syntax of the IDL code generation tool includes metadata definition syntax corresponding to data entities. The IDL code generation tool has a template engine for generating code for the application framework, and the template engine is created based on the syntax tree of the IDL code generation tool.
[0052] In one example, the DDS scenario information is determined based on a user, ie, a developer.
[0053] In step S320, the code of the application framework is modified according to the data distribution service DDS business requirement information to obtain the target code of the application.
[0054] In this embodiment, after obtaining the code of the application framework, the code of the application framework can be modified according to the acquired data distribution service DDS business demand information to obtain the target code of the application.
[0055] In one example, the data distribution service DDS business demand information is obtained according to user determination.
[0056] In one example, the application may be a DDS application.
[0057] In one embodiment, after obtaining the target code of the application, the user generates DDS business requirement information according to the target code of the application and DDS scenario information, and modifies the code of the application framework according to the DDS business requirement information to obtain the target code of the application.
[0058] In the step flow of the embodiment of the present disclosure, the code of the application framework is modified through the data distribution service DDS business demand information, so that the target code of the application obtained subsequently can be more compatible with the DDS scenario information.
[0059] The disclosed embodiment inputs the acquired data distribution service DDS scenario information into an IDL code generation tool to obtain the code of the application framework, and modifies the code of the application framework to obtain the target code of the application, so that developers can create applications based on the target code of the application, thereby reducing the time spent by developers on developing applications and ultimately improving the development efficiency of the application.
[0060] In addition, the embodiments of the present disclosure have the following advantages:
[0061] (1) The object code of the application can be reused.
[0062] (2) The target code of the application generated by the embodiment of the present disclosure is generated based on an IDL code generation tool, and the IDL code generation tool is a standard specification code provided by a DDS software provider, so the quality reliability of the target code of the application is relatively high.
[0063] (3) IDL code generation tools are naturally language independent, so the application's target code can support a variety of programming languages.
[0064] (4) Since developers are familiar with the use of IDL code generation tools, the extended syntax obtained by extending the syntax of the IDL code generation tool can save the developers' learning cost for the extended syntax.
[0065] In one embodiment, the metadata definition syntax corresponding to the data entity includes the metadata code definition syntax corresponding to the subject, the metadata code definition syntax corresponding to the DDS data entity instance, the metadata code definition syntax corresponding to the quality of service policy QOS, the metadata code definition syntax corresponding to the listener, and the code definition syntax corresponding to the data type. The metadata code definition syntax corresponding to the listener is used to create a listener to asynchronously receive data.
[0066] Among them, the metadata code definition syntax corresponding to the topic is used to generate the metadata code of the topic corresponding to the DDS scenario information. The metadata code definition syntax corresponding to the DDS data entity instance is used to generate the metadata code of the data entity example corresponding to the DDS scenario information. The metadata code definition syntax corresponding to the quality of service policy QOS is used to generate the metadata code of the quality of service policy corresponding to the DDS scenario information. The metadata code definition syntax corresponding to the listener is used to generate the metadata code of the listener corresponding to the DDS scenario information. The code definition syntax corresponding to the data type is used to generate the code of the data type corresponding to the DDS scenario information.
[0067] The disclosed embodiment extends the syntax of the metadata definition syntax corresponding to the data entity in the IDL code generator, so that the metadata code corresponding to the data entity can be subsequently generated based on the IDL code generator, thereby eliminating the need for users to manually generate the code corresponding to the data entity to create an application, thereby improving the development efficiency of the application.
[0068] In one embodiment, the IDL code generation tool includes an initial syntax. Before the acquired data distribution service DDS scenario information is input into the IDL code generation tool and the application framework code is generated based on the extended syntax of the IDL code generation tool, the application generation method also includes step S330.
[0069] In step S330, the initial grammar is expanded based on the BNF grammar rules to obtain an expanded grammar.
[0070] In this embodiment, the initial grammar in the IDL code generation tool may be expanded based on the BNF grammar rules to obtain the expanded grammar.
[0071] The extended syntax is used to define an instance of a data entity, which includes a reader who subscribes to data, a writer who publishes data, a subscriber for creating a reader, a publisher for creating a writer, and a domain participant for creating an instance of a data entity.
[0072] In an example, the extended grammar based on the BNF grammar rules is as follows:
[0073] definition::=
[0074] <annotations><module_dcl>';'
[0075] | <annotations><const_dcl>';'
[0076] | <annotations><type_dcl>';'
[0077] | <annotations><except_dcl>';'
[0078] | <annotations><interface_dcl>';'
[0079] | <annotations><application_dcl>';'
[0080] application_dcl::=
[0081] 'application' <identifier>'{'<application_memeber>+'}'
[0082] application_memeber::=
[0083] <type_spec>'::reader' <declarators>';'
[0084] |<type_spec>'::writer' <declarators>';'
[0085] |<type_spec>'::publisher' <declarators>';'
[0086] |<type_spec>'::subscriber' <declarators>';'
[0087] |<type_spec>'::participant' <declarators>';'
[0088] Definition is used to define metadata, including module_dcl, type_dcl, const_dcl, except_dcl, interface_dcl, and application_dcl. Application_dcl is used to define application_member. Application_member is used to define a DDS data entity instance.<type_spec> '::reader' represents the reader of the subscription data.<type_spec> '::writer' represents the writer that publishes the data.<type_spec> '::publisher' represents the publisher, which is used to create writers.<type_spec> '::subscriber' represents a subscriber, which is used to create a reader.<type_spec> '::participant' represents the domain participant and is used to create all other entities.
[0089] In an example, the extended grammar based on the BNF grammar rule extension may include at least one of the keywords application, reader, writer, publisher, subscriber, and participant.
[0090] The embodiment of the present disclosure expands the initial grammar through the BNF grammar rule to obtain the extended grammar, which can improve the accuracy, simplicity, and versatility of the extended grammar.
[0091] In one embodiment, after the initial grammar is expanded based on the BNF grammar rules to obtain the extended grammar, the Bision grammar analyzer generator can be used to parse the extended grammar to obtain the corresponding grammar tree. Then the corresponding template engine is created through the grammar tree. Finally, the IDL code generation tool is generated according to the template engine.
[0092] In one embodiment, the data entity instance metadata code includes at least one of a metadata code for describing a domain participant, a metadata code for describing a publisher, a metadata code for describing a subscriber, a metadata code for describing a reader, and a metadata code for describing a writer, and the descriptive metadata code corresponding to the data entity includes at least one of a metadata code for describing a domain corresponding to the data entity, a metadata code for describing a quality of service policy corresponding to the data entity, a metadata code for describing a subject corresponding to the data entity, and a metadata code for describing a listener corresponding to the data entity.
[0093] In one example, the metadata code for describing a domain participant may be @Participant(). The metadata code for describing a publisher may be @Publisher(). The metadata code for describing a subscriber may be @Subscriber(). The metadata code for describing the domain corresponding to a data entity may be @Domain(). The metadata code for describing the quality of service policy corresponding to a data entity may be @Qos_(). The metadata code for describing the topic corresponding to a data entity may be @Topic(""). The metadata code for describing a listener corresponding to a data entity may be @Listener().
[0094] Each data entity can only use the metadata code of the corresponding service quality policy. If the metadata code of the service quality policy other than that of the data entity is used, an error will be reported. The metadata code of the service quality policy can include a specific QOS name, such as @Qos_ReliabilityKind() or Qos_HistoryKind().
[0095] Each data entity can only use the metadata code of the corresponding listener. If the metadata code of a listener other than the data entity is used, an error will be reported. For the Reader entity, if @Listener("data_available") is not defined, the waitset mechanism is used to synchronously receive data.
[0096] In one embodiment, the target code of the application further includes @DDSApp. The application needs to use this modification, otherwise the target code of the application cannot be generated.
[0097] In one embodiment, the metadata code for describing the quality of service policy corresponding to the data entity includes a first metadata code and a second metadata code, and the second metadata code is obtained by combining at least two metadata codes for describing the quality of service policy corresponding to the data entity.
[0098] In an example, the second metadata code @Qosx_Reliability() may be obtained by combining @Qos_ReliabilityKind(), @Qos_HistoryKind(), and @Qos_HistoryDepth(), ie, @Qosx_Reliability()=@Qos_ReliabilityKind()+@Qos_HistoryKind()+@Qos_HistoryDepth().
[0099] The disclosed embodiment combines multiple metadata codes for describing the service quality policy corresponding to the data entity to obtain a new metadata code for describing the service quality policy corresponding to the data entity, thereby improving the scalability of the metadata code for describing the service quality policy corresponding to the data entity.
[0100] In an example, @Qosx_Reliability() may support three forms: @Qosx_Reliability(strict), @Qosx_Reliability(normal), and @Qosx_Reliability(none).
[0101] In one example, the target code is a code for autonomous driving. Specifically, the target code can create an autonomous driving program of a pure visual algorithm, and the target code is used to analyze the camera's sequence of pictures and vehicle status information in real time, and then decide how to drive the vehicle according to the autonomous driving algorithm, and continuously issue driving commands to control the vehicle.
[0102] The target code includes a first reader metadata code and a second reader metadata code for describing a reader and a target writer metadata code for describing a writer, wherein the reader created corresponding to the first reader metadata code is used to subscribe to real-time camera image data, the reader created corresponding to the second reader metadata code is used to subscribe to real-time vehicle status information, and the writer created corresponding to the target writer metadata code is used to send corresponding control commands according to the real-time camera image data and the real-time vehicle status information;
[0103] Among them, the first reader metadata code corresponds to the first service quality policy metadata code, the first listener metadata code, the second listener metadata code and the first domain metadata code. Since the amount of data of each camera image is large and the transmission process may be blocked, the first service quality policy metadata code is used to stipulate that the real-time camera image data is allowed to be lost, so the first service quality policy metadata code can be set to @Qos_Reliability(normal). The first listener metadata code is used to monitor the number of real-time camera image data obtained, so the first listener metadata code can be set to @Listener(sample_lost). Exemplarily, when the camera samples 12 pictures per second, the first listener metadata code only needs to ensure that 6 pictures are subscribed per second. The second listener metadata code is used to asynchronously subscribe to the real-time camera image data to avoid blocking the main thread, so the second listener metadata code can be set to @Listener("data_available"). The first domain metadata code is used to identify the domain corresponding to the first reader metadata code, and can be set to @Domain(10).
[0104] The second reader metadata code corresponds to the second quality of service policy metadata code, the third listener metadata code and the second domain metadata code. The second quality of service policy metadata code is used to stipulate that the real-time vehicle status information is not allowed to be lost. Therefore, the second quality of service policy metadata code can be set to @Qos_Reliability(strict). The third listener metadata code is used to monitor whether the writing end corresponding to the real-time vehicle status information is offline. Therefore, the third listener metadata code can be set to @Listener("subscription_matched"). The second domain metadata code is used to identify the domain corresponding to the second reader metadata code, and can be set to @Domain(11). In addition, the second reader metadata code also corresponds to a type of vehicle status information obtained based on a synchronous subscription method, so @Listener("data_available") may not be set.
[0105] The target writer metadata code corresponds to the third quality of service policy metadata code, the target topic metadata code and the third domain metadata code. The third quality of service policy metadata code is used to specify that the control command is allowed to be lost, so the third quality of service policy metadata code can be set to @Qos_ReliabilityKind(reliable)@Qos_HistoryKind(keep_last)@Qos_HistoryDepth(1), that is, a quality of service policy metadata code composed of multiple quality of service policy metadata codes. The target topic metadata code is used to identify the topic corresponding to the target writer metadata code, and can be set to @Topic("DriverCommand"). The third domain metadata code is used to identify the domain corresponding to the target writer metadata code, and can be set to @Domain(12).
[0106] In another example, the above object code can be as follows:
[0107] struct Camera
[0108] {
[0109] int32 pos;
[0110] uint32 pix_width;
[0111] uint32 pix_height;
[0112] };
[0113] struct CameraImage
[0114] {
[0115] sequence <octet>data;
[0116] Camera camera;
[0117] uint64 timestamp;
[0118] };
[0119] struct VehicleStatus
[0120] {
[0121] uint64 timestamp;
[0122] uint32 latitude;
[0123]
[0124] Among them, struct Camera and struct CameraImage represent the data types corresponding to the camera image. Struct Camera includes pos variable with data type int32, pix_width variable with data type uint32, and pix_height variable with data type uint32. Struct CameraImage includes sequence variable with data type <octet>The data variable is the camera variable of the Camera data type and the timestamp of the uint64 data type.
[0125] The struct VehicleStatus represents the data type corresponding to the vehicle status. The struct VehicleStatus includes a timestamp variable with a data type of uint64, a latitude variable with a data type of uint32, a longtitude variable with a data type of uint32, and a speed variable with a data type of uint32.
[0126] struct VehicleControl represents the data type corresponding to the vehicle control information. structVehicleControl includes the adjust_direction variable of the uint32 data type and the adjust_oil_gas variable of the uint32 data type.
[0127] @DDSApp represents the autonomous driving APP, corresponding to three subject domains: @Domain(10), @Domain(11) and @Domain(12).
[0128] Among them, @Domain(10) is related to subscribing to camera images. The code corresponding to @Domain(10) also includes the listener metadata code @Listener("data_available,sample_lost"), the service quality policy metadata code @Qos_Reliability(normal) and the reader metadata code CameraImage::reader images_reader.
[0129] Among them, @Domain(11) is related to the subscribed vehicle status. The corresponding code of @Domain(11) also includes the listener metadata code @Listener("subscription_matched"), the service quality policy metadata code @Qosx_Reliability(strict) and the reader metadata code VehicleStatus::reader status_reader.
[0130] Among them, @Domain(12) is related to publishing vehicle control information. The corresponding code of @Domain(12) also includes the topic metadata code @Topic("DriverCommand"), the service quality policy code @Qos_ReliabilityKind(reliable)@Qos_HistoryKind(keep_last)@Qos_HistoryDepth(1) and the writer metadata code VehicleControl::writer command_writer.
[0131] Compared with the code manually generated by developers in the related art, the target code of the application generated by the embodiment of the present disclosure has fewer lines of code and is more intuitive to understand, thereby reducing the workload of developers and improving development efficiency.
[0132] Exemplary Devices
[0133] Figure 4 is a block diagram of a device generated by an application according to an exemplary embodiment. Figure 4 , the device 400 includes a first module 410 and a second module 420 .
[0134] The first module 410 is used to input the acquired data distribution service DDS scenario information into an IDL code generation tool, and generate application framework code based on the extended syntax of the IDL code generation tool, where the application framework code includes data entity instance metadata code and description metadata code corresponding to the data entity;
[0135] The second module 420 is used to modify the code of the application framework according to the data distribution service DDS business requirement information to obtain the target code of the application;
[0136] The extended syntax of the IDL code generation tool includes metadata definition syntax corresponding to the data entity. The IDL code generation tool has a template engine for generating codes of the application framework. The template engine is created based on the syntax tree of the IDL code generation tool.
[0137] In some embodiments, the metadata definition syntax corresponding to the data entity includes the metadata code definition syntax corresponding to the subject, the metadata code definition syntax corresponding to the DDS data entity instance, the metadata code definition syntax corresponding to the quality of service policy QOS, the metadata code definition syntax corresponding to the listener, and the code definition syntax corresponding to the data type. The metadata code definition syntax corresponding to the listener is used to create a listener to asynchronously receive data.
[0138] In some embodiments, the application generating device includes an extension module, the extension module is used to extend the initial grammar based on the BNF grammar rule to obtain the extended grammar, and the extended grammar is used to define the instance of the data entity;
[0139] The instance of the data entity is defined including a reader who subscribes to data, a writer who publishes data, a subscriber for creating readers, a publisher for creating writers, and a domain participant for creating an instance of the data entity.
[0140] In some embodiments, the data entity instance metadata code includes at least one of a metadata code for describing a domain participant, a metadata code for describing a publisher, a metadata code for describing a subscriber, a metadata code for describing a reader, and a metadata code for describing a writer, and the descriptive metadata code corresponding to the data entity includes at least one of a metadata code for describing a domain corresponding to the data entity, a metadata code for describing a quality of service policy corresponding to the data entity, a metadata code for describing a topic corresponding to the data entity, and a metadata code for describing a listener corresponding to the data entity.
[0141] In some implementations, the metadata code for describing the quality of service policy corresponding to the data entity includes a first metadata code and a second metadata code, and the second metadata code is obtained based on a combination of at least two metadata codes for describing the quality of service policy corresponding to the data entity.
[0142] In some embodiments, the target code is a code for autonomous driving; the target code includes a first reader metadata code and a second reader metadata code for describing a reader and a target writer metadata code for describing a writer, the reader created corresponding to the first reader metadata code is used to subscribe to real-time camera image data, the reader created corresponding to the second reader metadata code is used to subscribe to real-time vehicle status information, and the writer created corresponding to the target writer metadata code is used to send corresponding control commands according to the real-time camera image data and the real-time vehicle status information;
[0143] The first reader metadata code corresponds to a first quality of service policy metadata code, a first listener metadata code, a second listener metadata code and a first domain metadata code, the first quality of service policy metadata code is used to stipulate that loss of real-time camera image data is allowed, the first listener metadata code is used to monitor the number of acquired real-time camera image data, the second listener metadata code is used to asynchronously subscribe to real-time camera image data, and the first domain metadata code is used to identify the domain corresponding to the first reader metadata code;
[0144] The second reader metadata code corresponds to a second quality of service policy metadata code, a third listener metadata code, and a second domain metadata code, the second quality of service policy metadata code is used to stipulate that the real-time vehicle status information is not allowed to be lost, the third listener metadata code is used to monitor whether the writing end corresponding to the real-time vehicle status information is offline, and the second domain metadata code is used to identify the domain corresponding to the second reader metadata code;
[0145] The target writer metadata code corresponds to a third service quality policy metadata code, a target subject metadata code and a third domain metadata code. The third service quality policy metadata code is used to specify that loss of control commands is allowed. The target subject metadata code is used to identify the subject corresponding to the target writer metadata code. The third domain metadata code is used to identify the domain corresponding to the target writer metadata code.
[0146] Example Vehicles
[0147] Figure 5 is a block diagram of a vehicle 500 according to an exemplary embodiment. The vehicle 500 may be a fuel vehicle, a hybrid vehicle, an electric vehicle, a fuel cell vehicle or other types of vehicles.
[0148] Reference Figure 5 , the vehicle 500 may include multiple subsystems, for example, a driving system 510, a control system 520, a perception system 530, a communication system 540, an information display system 550, and a computing system 560. The vehicle 500 may also include more or fewer subsystems, and each subsystem may also include multiple components, which are not described one by one here.
[0149] The driving system 510 includes components that provide power movement for the vehicle 500, such as an engine, an energy source, a transmission device, etc.
[0150] The control system 520 includes components that provide control for the vehicle 500, such as vehicle control, cockpit equipment control, and driving assistance control.
[0151] The perception system 530 includes components that provide surrounding environment perception for the vehicle 500, such as a vehicle positioning system, a laser sensor, a voice sensor, an ultrasonic sensor, a camera device, etc.
[0152] The communication system 540 includes components that provide communication connections for the vehicle 500, such as mobile communication networks (such as 3G, 4G, 5G networks, etc.), WiFi, Bluetooth, and Internet of Vehicles.
[0153] The information display system 550 includes components that provide various information displays for the vehicle 500, such as vehicle information display, navigation information display, entertainment information display, etc.
[0154] The computing and processing system 560 includes components that provide data computing and processing capabilities for the vehicle 500. The computing and processing system 560 may include at least one processor 561 and a memory 562. The processor 561 may execute instructions stored in the memory 562.
[0155] The processor 561 may be any conventional processor, such as a commercially available CPU. The processor may also include a graphics processor (Graphic Process Unit, GPU), a field programmable gate array (Field Programmable Gate Array, FPGA), a system on chip (System on Chip, SOC), an application specific integrated circuit (Application Specific Integrated Circuit, ASIC) or a combination thereof.
[0156] Memory 562 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk.
[0157] In the embodiment of the present disclosure, a set of instruction sets is stored in the memory 562, and the processor 561 can execute the instruction set to implement all or part of the steps of the method for generating an application described in any of the above exemplary embodiments.
[0158] Exemplary Electronic Devices
[0159] Figure 6 1 is a block diagram of an electronic device 600 according to an exemplary embodiment. The electronic device 600 may be a vehicle controller, a vehicle terminal, a vehicle computer or other types of electronic devices.
[0160] Reference Figure 6 , the electronic device 600 may include at least one processor 610 and a memory 620. The processor 610 may execute instructions stored in the memory 620. The processor 610 is communicatively connected to the memory 620 via a data bus. In addition to the memory 620, the processor 610 may also be communicatively connected to an input device 630, an output device 640, and a communication device 650 via a data bus.
[0161] The processor 610 may be any conventional processor, such as a commercially available CPU. The processor may also include a graphics processor (Graphic Process Unit, GPU), a field programmable gate array (Field Programmable Gate Array, FPGA), a system on chip (System on Chip, SOC), an application specific integrated circuit (Application Specific Integrated Circuit, ASIC) or a combination thereof.
[0162] The memory 620 may be implemented by any type of volatile or nonvolatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk.
[0163] In the embodiment of the present disclosure, executable instructions are stored in the memory 620, and the processor 610 can read the executable instructions from the memory 620 and execute the instructions to implement all or part of the steps of the method for generating an application described in any of the above exemplary embodiments.
[0164] Exemplary computer-readable storage media
[0165] In addition to the above methods and devices, the exemplary embodiments of the present disclosure may also be a computer program product or a computer-readable storage medium storing the computer program product. The computer product includes computer program instructions that can be executed by a processor to implement all or part of the steps described in any method in the above exemplary embodiments.
[0166] The computer program product may be written in any combination of one or more programming languages to write program codes for performing the operations of the embodiments of the present application, including object-oriented programming languages, such as Java, C++, etc., and also conventional procedural programming languages, such as "C" language or similar programming languages and scripting languages (e.g., Python). The program code may be executed entirely on the user computing device, partially on the user computing device, as an independent software package, partially on the user computing device and partially on the remote computing device, or entirely on the remote computing device or server.
[0167] The computer readable storage medium can adopt any combination of one or more readable media. The readable medium can be a readable signal medium or a readable storage medium. The readable storage medium can include, for example, but is not limited to, a system, device or device of electricity, magnetism, light, electromagnetic, infrared, or semiconductor, or any combination of the above. More specific examples of readable storage media include: a static random access memory (SRAM) with one or more wires electrically connected, an electrically erasable programmable read-only memory (EEPROM), an erasable programmable read-only memory (EPROM), a programmable read-only memory (PROM), a read-only memory (ROM), a magnetic storage, a flash memory, a magnetic disk or an optical disk, or any suitable combination of the above.
[0168] Those skilled in the art will readily appreciate other embodiments of the present disclosure after considering the specification and practicing the present disclosure. This application is intended to cover any variations, uses or adaptations of the present disclosure, which follow the general principles of the present disclosure and include common knowledge or customary technical means in the art that are not disclosed in the present disclosure. The specification and examples are to be considered as exemplary only, and the true scope and spirit of the present disclosure are indicated by the following claims.
[0169] It should be understood that the present disclosure is not limited to the exact structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.< / octet> < / octet> < / declarators> < / declarators> < / declarators> < / declarators> < / declarators> < / identifier> < / annotations> < / annotations> < / annotations> < / annotations> < / annotations> < / annotations>
Claims
1. A method for generating an application, characterized in that: include: Input the acquired data distribution service DDS scenario information into an IDL code generation tool, and generate application framework code based on the extended syntax of the IDL code generation tool, wherein the application framework code includes data entity instance metadata code and description metadata code corresponding to the data entity; According to the data distribution service DDS business demand information, the code of the application framework is modified to obtain the target code of the application; The extended syntax of the IDL code generation tool includes metadata definition syntax corresponding to the data entity, and the IDL code generation tool has a template engine for generating code for an application framework, and the template engine is created based on a syntax tree of the IDL code generation tool.
2. The method according to claim 1, characterized in that The metadata definition syntax corresponding to the data entity includes the metadata code definition syntax corresponding to the subject, the metadata code definition syntax corresponding to the DDS data entity instance, the metadata code definition syntax corresponding to the quality of service policy QOS, the metadata code definition syntax corresponding to the listener and the code definition syntax corresponding to the data type. The metadata code definition syntax corresponding to the listener is used to create a listener to asynchronously receive data.
3. The method according to claim 1, characterized in that The IDL code generation tool includes an initial syntax. Before inputting the acquired data distribution service DDS scenario information into the IDL code generation tool and generating the code of the application framework based on the extended syntax of the IDL code generation tool, the method further includes: Expanding the initial grammar based on BNF grammar rules to obtain the extended grammar, where the extended grammar is used to define an instance of a data entity; The instance of the defined data entity includes a reader who subscribes to data, a writer who publishes data, a subscriber for creating the reader, a publisher for creating the writer, and a domain participant for creating an instance of the data entity.
4. The method according to claim 3, characterized in that The data entity instance metadata code includes at least one of a metadata code for describing the domain participant, a metadata code for describing the publisher, a metadata code for describing the subscriber, a metadata code for describing the reader, and a metadata code for describing the writer, and the descriptive metadata code corresponding to the data entity includes at least one of a metadata code for describing the domain corresponding to the data entity, a metadata code for describing the quality of service policy corresponding to the data entity, a metadata code for describing the subject corresponding to the data entity, and a metadata code for describing the listener corresponding to the data entity.
5. The method according to claim 4, characterized in that The metadata code used to describe the service quality policy corresponding to the data entity includes a first metadata code and a second metadata code, and the second metadata code is obtained by combining at least two metadata codes used to describe the service quality policy corresponding to the data entity.
6. The method according to any one of claims 1 to 5, characterized in that: The target code is a code for autonomous driving; the target code includes a first reader metadata code and a second reader metadata code for describing a reader and a target writer metadata code for describing a writer, wherein the reader created corresponding to the first reader metadata code is used to subscribe to real-time camera image data, the reader created corresponding to the second reader metadata code is used to subscribe to real-time vehicle status information, and the writer created corresponding to the target writer metadata code is used to send corresponding control commands according to the real-time camera image data and the real-time vehicle status information; The first reader metadata code corresponds to a first quality of service policy metadata code, a first listener metadata code, a second listener metadata code and a first domain metadata code, the first quality of service policy metadata code is used to stipulate that the real-time camera image data is allowed to be lost, the first listener metadata code is used to monitor the number of acquired real-time camera image data, the second listener metadata code is used to asynchronously subscribe to the real-time camera image data, and the first domain metadata code is used to identify the domain corresponding to the first reader metadata code; The second reader metadata code corresponds to a second quality of service policy metadata code, a third listener metadata code, and a second domain metadata code, wherein the second quality of service policy metadata code is used to stipulate that real-time vehicle status information is not allowed to be lost, the third listener metadata code is used to monitor whether the writing end corresponding to the real-time vehicle status information is offline, and the second domain metadata code is used to identify the domain corresponding to the second reader metadata code; The target writer metadata code corresponds to a third service quality policy metadata code, a target subject metadata code and a third domain metadata code, the third service quality policy metadata code is used to stipulate that the control command is allowed to be lost, the target subject metadata code is used to identify the subject corresponding to the target writer metadata code, and the third domain metadata code is used to identify the domain corresponding to the target writer metadata code.
7. A device for generating an application, characterized in that: include: An input module, the input module is used to input the acquired data distribution service DDS scenario information into an IDL code generation tool, and generate application framework code based on the extended syntax of the IDL code generation tool, wherein the application framework code includes a data entity instance metadata code and a description metadata code corresponding to the data entity; A modification module, wherein the modification module is used to modify the code of the application framework according to the data distribution service DDS business demand information to obtain the target code of the application; The extended syntax of the IDL code generation tool includes metadata definition syntax corresponding to the data entity, and the IDL code generation tool has a template engine for generating code for an application framework, and the template engine is created based on a syntax tree of the IDL code generation tool.
8. An electronic device, characterized in that: include: processor; a memory for storing instructions executable by the processor; The processor is used to read the executable instructions from the memory and execute the instructions to implement the method for generating an application program as described in any one of claims 1-6.
9. A computer-readable storage medium having computer program instructions stored thereon, characterized in that: When the program instructions are executed by a processor, the steps of generating the application program described in any one of claims 1 to 6 are implemented.
10. A vehicle, characterized in that: A set of instruction sets is stored, and the instruction sets are executed by the vehicle to implement the method for generating an application as described in any one of claims 1-6.