Rear-end development method and device of automatic driving application graphical developer
By setting up a lightweight backend framework in the Node.js operating environment and abstractly processing the configuration of autonomous driving application services, the limitations of developing autonomous driving applications based on Node.js in the existing technology are solved, and the backend service development is realized that adapts to the performance requirements of autonomous driving applications.
Patent Information
- Application Number
- CN202412000244.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-31
- Publication Date
- 2025-04-22
AI Technical Summary
The existing Node.js-based web backend framework has limitations when developing autonomous driving applications, and it is difficult to meet the complex business needs and performance requirements of desktop applications.
It provides a back-end development method and device for graphical developer of autonomous driving applications. By setting up a lightweight back-end framework in the Node.js operating environment, abstractly processing the configuration of autonomous driving application services, and using configuration files to save and manage configuration information, so as to realize the startup and management of autonomous driving application back-end services.
It reduces the complexity of code organization and adapts to the performance requirements of autonomous driving applications, making the back-end services developed in the Node.js operating environment also suitable for autonomous driving applications, improving development efficiency and system stability.
Smart Images

Figure CN119861921A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of autonomous driving technology, and in particular to a back-end development method and device for an autonomous driving application graphical developer. Background Art
[0002] In the process of developing applications based on Node.js, it is very important to choose a suitable backend framework for backend service development.
[0003] In the related technologies, the backend framework based on NodeJs is mainly used to solve the problem of Web application development. For example, in Node.js, the Express framework is combined to build Web applications. The Express framework is an ideal choice for quickly developing simple and efficient Web applications due to its simple routing system and powerful middleware support. Another example is that in Node.js, Koa is combined to build Web applications. Koa is a lighter and more modern framework. It is based on a more modern syntax design and provides a high degree of configuration flexibility. Its core is very lightweight and does not bundle any built-in middleware. Developers are encouraged to expand functions through npm packages. Another example is that in Node.js, NestJs is combined to build Web applications. NestJs is known for building scalable and efficient NodeJs server-side applications. It allows for more maintainable module management, handles high traffic through microservices and asynchronous operations, and achieves seamless expansion.
[0004] However, although these Node.js-based Web backend frameworks have obvious advantages in developing Web applications, they have certain limitations when developing desktop applications based on Node.js, especially when developing autonomous driving applications based on Node.js in a graphical developer. Summary of the invention
[0005] The embodiments of the present application provide a back-end development method and device for an autonomous driving application graphical developer, so as to achieve the effect of being able to develop autonomous driving applications based on Node.js.
[0006] In a first aspect, an embodiment of the present application provides a backend development method of an autonomous driving application graphical developer, comprising:
[0007] In response to the start operation, in the Node.Js running environment in the application development environment, a configuration file is obtained based on an abstract read interface, wherein the configuration file is generated after abstract processing of a configuration for starting the autonomous driving application service, and configuration information of a backend service of the autonomous driving application may be input in the configuration file;
[0008] Parsing the configuration file to obtain configuration information of the backend service of the autonomous driving application;
[0009] Establish a backend service for the autonomous driving application based on the configuration information.
[0010] In a possible implementation, establishing a backend service for the autonomous driving application according to the configuration information includes at least one of the following:
[0011] Creating a window according to the window configuration parameters, wherein the window is used to load a front-end page of the autonomous driving application, and the configuration information includes the window configuration parameters;
[0012] Establishing a communication service for communicating with a front-end of the autonomous driving application according to the communication configuration parameters, wherein the configuration information includes the communication configuration parameters;
[0013] A database service for an autonomous driving application is established according to database configuration parameters, wherein the configuration information includes the database configuration parameters.
[0014] In a possible implementation, establishing a communication service for communicating with a front-end of an autonomous driving application according to the communication configuration parameters includes:
[0015] According to the communication configuration parameters, communication supporting http protocol and websocket protocol is established.
[0016] In a possible implementation manner, after establishing the communication supporting the http protocol and the websocket protocol according to the communication configuration parameters, the method further includes:
[0017] In response to the websocket connection request, obtaining target routing information of the websocket connection request;
[0018] When a websocket processing function is found according to the target routing information, a websocket communication object is created;
[0019] The websocket communication object is encapsulated into a context environment corresponding to the target routing information, so that the websocket processing function accesses the websocket communication object in the context environment.
[0020] In a possible implementation manner, after encapsulating the websocket communication object into the context environment corresponding to the target routing information, the method further includes:
[0021] Responding to a modeling and simulation instruction, wherein the modeling and simulation instruction is received when running a modeling and simulation test on a graphical interface of a graphical developer;
[0022] Based on the websocket processing function, in the context environment, access the websocket communication object to obtain the data generated in the modeling simulation test process sent by the server;
[0023] The data is sent to the graphical developer.
[0024] In a possible implementation, the database service of the autonomous driving application is established according to the database configuration parameters, wherein the configuration information includes the database configuration parameters, including:
[0025] The process of establishing a database service for an autonomous driving application is executed based on an ORM component, wherein the process of establishing a database service includes: obtaining an entity class marked by a decorator, and associating a corresponding API interface according to the attributes of the entity class; and generating SQL statements for the entity class and the database according to the database configuration parameters and the mapping relationship between the marked entity class and the database.
[0026] In a possible implementation, in response to the start operation, after obtaining the configuration file based on the abstract read interface in the Node.Js runtime environment in the application development environment, the method further includes:
[0027] Scanning the decorated processing function and controller method, wherein the processing function and the controller method are used to process the communication request;
[0028] Obtaining routing information of the processing function and the controller method according to the decorator that decorates the processing function, wherein the decorator marks the routing information of the processing function;
[0029] A mapping relationship table of the processing function, controller method and routing information is established.
[0030] In a possible implementation, in response to the start operation, after obtaining the configuration file based on the abstract read interface in the Node.Js runtime environment in the application development environment, the method further includes:
[0031] Acquire the extended middleware configuration information in the configuration file, wherein the configuration file also includes the extended middleware configuration information;
[0032] According to the configuration information, an intermediate function and an extended middleware type of the extended middleware are obtained;
[0033] Determining a registration location of the extended middleware according to the extended middleware type, wherein the registration location includes a pipeline before request processing and a pipeline after request processing;
[0034] Register the middleware function and the extended middleware to corresponding registration locations.
[0035] In a second aspect, an embodiment of the present application provides a back-end development device of an autonomous driving application graphical developer, including:
[0036] an acquisition module, configured to, in response to a startup operation, acquire a configuration file based on an abstract read interface in a Node.Js runtime environment in an application development environment, wherein the configuration file is generated after abstract processing of a configuration for starting an autonomous driving application service, and configuration information of a backend service of the autonomous driving application may be input into the configuration file;
[0037] A parsing module, used to parse the configuration file to obtain configuration information of the backend service of the autonomous driving application;
[0038] A processing module is used to establish a backend service for the autonomous driving application according to the configuration information.
[0039] In a third aspect, an embodiment of the present application provides an electronic device, including: a memory, a processor;
[0040] The memory stores computer-executable instructions;
[0041] The processor executes the computer-executable instructions stored in the memory, so that the processor executes various possible implementations of the first aspect as described above.
[0042] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, in which computer-executable instructions are stored. When the computer-executable instructions are executed by a processor, they are used to implement various possible implementation methods of the first aspect above.
[0043] In a fifth aspect, an embodiment of the present application provides a computer program product, including a computer program, which, when executed by a processor, implements various possible implementation methods of the first aspect above.
[0044] A back-end development method and device for an autonomous driving application graphical developer provided in an embodiment of the present application provides a back-end framework in the Node.Js operating environment in the application development environment, which can abstract the configuration for starting the autonomous driving application service and save it in the form of a configuration file; the developer configures the configuration information of the autonomous driving application through the configuration file, and then obtains the configuration file based on the abstract read interface when responding to the startup operation, and parses the configuration file to obtain the configuration information, and then creates the back-end service of the autonomous driving application according to the configuration information to start the back-end service of the autonomous driving application, while the configuration for starting the autonomous driving application service is independent of the code and configured and managed by the back-end framework, so as to avoid the dispersion of this information in various locations of the program code, reduce the complexity of code organization, adapt to the performance requirements of the autonomous driving application, and make the back-end service developed in the Node.Js operating environment also suitable for autonomous driving applications. BRIEF DESCRIPTION OF THE DRAWINGS
[0045] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0046] Figure 1 A schematic diagram of a scenario of a backend development method for a graphical developer of an autonomous driving application provided in this application;
[0047] Figure 2 Schematic diagram of the backend development method of the autonomous driving application graphical developer provided in this application Figure 1 ;
[0048] Figure 3 A schematic diagram of establishing interaction for WebSocket communication provided in an embodiment of the present application;
[0049] Figure 4 A schematic diagram of starting a database service provided in an embodiment of the present application;
[0050] Figure 5 A schematic diagram of database creation in different scenarios provided in the embodiments of the present application;
[0051] Figure 6 Schematic diagram of the backend development method of the autonomous driving application graphical developer provided in this application Figure 2 ;
[0052] Figure 7 A schematic diagram of routing management and distribution provided in an embodiment of the present application;
[0053] Figure 8 Schematic diagram of the backend development method of the autonomous driving application graphical developer provided in this application Figure 3 ;
[0054] Fig. 9 A schematic diagram of the structure of the back-end development device of the autonomous driving application graphical developer provided in this application;
[0055] Fig.10 A schematic diagram of the structure of the electronic device provided in this application.
[0056] The above drawings have shown clear embodiments of the present application, which will be described in more detail later. These drawings and text descriptions are not intended to limit the scope of the present application in any way, but to illustrate the concept of the present application to those skilled in the art by referring to specific embodiments. DETAILED DESCRIPTION
[0057] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the following exemplary embodiments do not represent all implementations consistent with the present application. Instead, they are merely examples of devices and methods consistent with some aspects of the present application as detailed in the appended claims.
[0058] First, the terms involved in this application are explained:
[0059] Node.js: refers to an open source JavaScript runtime environment that is based on the Chrome V8 engine and allows JavaScript code to run on the server.
[0060] Graphical Application Development Tool (GAASD): It is a low-code, drag-and-drop visual graphical application development tool for future autonomous driving.
[0061] In the process of developing applications based on Node.js, it is very important to choose a suitable backend framework for backend service development.
[0062] The backend framework based on NodeJs is mainly used to solve the problem of web application development. For example, in Node.js, the Express framework is combined to build web applications. The Express framework is an ideal choice for quickly developing simple and efficient web applications due to its simple routing system and powerful middleware support. Another example is that in Node.js, Koa is combined to build web applications. Koa is a lighter and more modern framework. It is based on a more modern syntax design and provides a high degree of configuration flexibility. Its core is very lightweight and does not bundle any built-in middleware. Developers are encouraged to expand functions through npm packages. Another example is that in Node.js, NestJs is combined to build web applications. NestJs is famous for building scalable and efficient NodeJs server-side applications. It allows for more maintainable module management, handles high traffic through microservices and asynchronous operations, and achieves seamless expansion.
[0063] However, although these Node.js-based Web backend frameworks have obvious advantages in developing Web applications, they have certain limitations when developing desktop applications based on Node.js, especially when developing autonomous driving applications based on Node.js in a graphical developer.
[0064] In the development of desktop applications based on Node.js, the unique functional requirements of desktop applications are combined. For example, since the business requirements of desktop applications are more complex than those of Web program development, when developing back-end services in the back-end framework, the processing and optimization of desktop applications in terms of performance, real-time, resource management, and cross-platform compatibility must be met. Therefore, desktop application development based on Node.js will make it difficult for the server to form a unified structure in terms of code organization, structure, and business stratification, which increases the complexity of back-end development.
[0065] Based on this, an embodiment of the present application provides a back-end development method of an autonomous driving application graphical developer based on NodeJs, specifically the back-end service development of an autonomous driving application. In combination with the business needs of the autonomous driving application, a lightweight back-end framework suitable for the back-end service development of the autonomous driving application is set up in the Node.Js running environment in the application development environment. The back-end framework can provide a program for starting desktop application services, realize the startup of the desktop application back-end service, create a desktop application window, display the autonomous driving application through the window, and allow the user to interact with the autonomous driving application through the window; create a communication method adapted to the communication between the front-end and back-end services of the autonomous driving application, etc., to realize the development of the back-end service of the autonomous driving application based on the Node.Js running environment in the application development environment.
[0066] Figure 1A schematic diagram of a scenario of a backend development method for an autonomous driving application graphical developer provided in this application, such as Figure 1 As shown, the specific application scenarios of this application include a front-end development platform, a back-end framework and a server.
[0067] Optionally, the front-end development platform is a graphical developer that provides a drag-and-drop visual graphical application development method. The graphical developer is used to develop front-end applications for autonomous driving applications.
[0068] Optionally, the backend framework is a tool for backend service development in the Node.js runtime environment. Through the backend framework, you can create corresponding backend services that can run on the server for the front-end application developed by the front-end development platform, and then implement business logic on the created backend service to complete the backend service development of the autonomous driving application.
[0069] The technical solution of the present application and how the technical solution of the present application solves the above-mentioned technical problems are described in detail below with specific embodiments. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. The embodiments of the present application will be described below in conjunction with the accompanying drawings.
[0070] Figure 2 Schematic diagram of the backend development method of the autonomous driving application graphical developer provided in this application Figure 1 ,like Figure 2 As shown, the method includes:
[0071] S201, in response to the start operation, in the Node.Js running environment in the application development environment, obtaining a configuration file based on an abstract read interface;
[0072] Optionally, the execution device of the embodiment of the present application is a terminal, such as a computer terminal; optionally, the execution device of the embodiment of the present application may also be a server. The following description will be made taking the terminal as an example.
[0073] In this embodiment, the terminal provides a backend framework in the Node.Js operating environment in the development environment, which can meet the development requirements of the backend service of the autonomous driving application. For example, the backend framework of the autonomous driving application needs to provide a user interaction interface relative to the web application, and needs to have the function of starting the autonomous driving application service, thereby realizing the front-end and back-end communication of the autonomous driving application.
[0074] The business requirements based on autonomous driving applications are more complex. For example, when running road condition algorithms and vehicle speed algorithms, a lot of data is initialized when the autonomous driving application starts. After startup, it is necessary to process the data generated by real-time interactions and be able to respond to requests quickly. Therefore, autonomous driving applications have higher requirements for performance and need to adopt more complex architectures and algorithms to meet performance requirements, which increases the difficulty of code organization.
[0075] In this embodiment, an abstract processing unit is set in the back-end framework, and the configuration for enabling the autonomous driving application service is abstracted by the abstract processing unit. The configuration for enabling the autonomous driving application service is independent of the code. By configuring and managing this information through the abstract processing unit, it is avoided that this information is scattered in various locations in the program code, thereby reducing the complexity of code organization.
[0076] Optionally, the configuration for starting the autonomous driving application service includes at least one of window configuration, communication configuration and database configuration. The back-end framework centralizes, unifies and clarifies the configuration information for starting the autonomous driving application service, defines the abstract nature of the configuration information, and saves it in the project's app.config.js file in the form of a configuration file. Back-end service developers can configure the service startup configuration data of the autonomous driving application to be developed in the configuration file, and thus realize the configuration of starting the autonomous driving application service without configuring relevant information in the startup program. Among them, the configuration information includes configuration items and configuration data. The configuration items are the abstract nature of the configuration information. The developer enters the configuration data in the configuration items and then saves the configuration file in the back-end framework.
[0077] Exemplarily, for window configuration, the window configuration is abstracted as follows:
[0078] Title: set the title; width: set the window width; height: set the window height; icon: icon; debug: whether to enable debug mode; http: configure page url; menu: whether to display the menu, etc.
[0079] Exemplarily, for the communication configuration, the communication configuration is abstracted as follows:
[0080] port: the port of http service; static: the static resource address of http; cors: whether to support cross-domain, etc.
[0081] For example, for database configuration, the database configuration is abstracted as follows:
[0082] dbType: database type, such as sqlite, mysql, etc.; db: sqlite file address or mysql connection address; name: database name, etc.
[0083] Developers only need to configure the configuration data corresponding to each configuration item in the configuration file to complete the configuration of the autonomous driving application service.
[0084] After completing the above configuration, start the autonomous driving application service by calling the start function of the backend framework and build the autonomous driving application service.
[0085] When the start function is called, the start operation of the backend framework is triggered, and in response to the start operation, the backend framework calls the abstract read interface to scan the configuration file to obtain the configuration file of the backend service of the autonomous driving application.
[0086] The startup operation responded to in this embodiment is an initialization startup operation.
[0087] S202, parse the configuration file to obtain configuration information of the backend service of the autonomous driving application.
[0088] After the configuration file is obtained, the configuration file is parsed to obtain configuration information in a unified format.
[0089] Optionally, in this embodiment, the abstract read interface can read and parse configuration files in different formats, and convert the configuration information into a unified format to facilitate starting the autonomous driving application service.
[0090] S203: Establish a backend service for the autonomous driving application based on the configuration information.
[0091] After the configuration information is obtained, the backend service of the autonomous driving application is created according to the configuration information.
[0092] The backend framework abstracts the configuration of the backend services. On the one hand, it can simplify the code components, and on the other hand, it can quickly obtain the configuration information of each service and quickly start the backend service without scanning the code. This is especially true for autonomous driving applications, where the implementation code is complex and diverse. By abstracting the configuration information and separating it from the code layer, the backend of the autonomous driving application can be developed in the Node.Js runtime environment.
[0093] In this embodiment, the backend service of the autonomous driving application includes at least one of a window service, a communication service, and a database service.
[0094] As an example, if the configuration file configures the window configuration parameters of the window service, the specific implementation method of establishing the backend service of the autonomous driving application according to the configuration information is:
[0095] A window is created according to the window configuration parameters. The window can be called by the autonomous driving application to load the front-end page of the autonomous driving application in the window and run it in the window, so that the front-end page can interact with the user in the window, and the front-end page of the application can run as a desktop application in the Node.Js running environment, thereby realizing the development of desktop applications in the Node.Js running environment.
[0096] Based on the technical solution provided in this example, developers can start desktop applications by configuring and calling corresponding interfaces. Other related services such as communication services and database services can be established in other ways.
[0097] As an example, if the configuration file configures the communication configuration parameters of the communication service, the specific implementation method of establishing the backend service of the autonomous driving application according to the configuration information is:
[0098] A communication service for communicating with a front-end of the autonomous driving application is established according to the communication configuration parameters.
[0099] The communication between the front and back ends of autonomous driving applications is complex, and real-time communication and synchronization functions such as real-time message push and data update are required, which requires the back-end service to support efficient real-time communication protocols and mechanisms. In the Node.Js operating environment, the HTTP protocol cannot meet the needs of autonomous driving applications. Based on this, in this embodiment, the back-end framework is set to provide support for setting two communication modes to support the back-end services of autonomous driving applications. Optionally, the two communication modes include communication based on the HTTP protocol and communication based on the WebSocket protocol.
[0100] Therefore, in this embodiment, according to the communication configuration parameters, communication supporting the http protocol and the websocket protocol is established.
[0101] HTTP is a protocol based on a request-response model, which communicates by sending requests and waiting for responses from the server. WebSocket is a full-duplex communication method that allows two-way real-time data transmission between the client and the server, which meets the need for two-way real-time data transmission between the front-end and back-end of autonomous driving applications.
[0102] Optionally, in this embodiment, when the backend framework calls the startup function in response to the startup operation, it will read the configuration information and related packages of the configuration file about http, and initialize the http service at the corresponding port according to the configuration information such as the configuration port. Similar to the http communication protocol, the websocket communication service also starts the websocket communication service when the startup function is called in response to the startup operation. In this embodiment, in order to simplify the network configuration, the websocket service is created on the http service port, that is, the websocket and http are created using one port.
[0103] In an optional implementation, after the backend framework creates the websocket, the frontend and the backend can establish a websocket connection.
[0104] For example, Figure 3 As shown, the client requests to establish a websocket connection with the backend, then creates a websocket object, sends an HTTP through the websocket object, and when the backend framework receives the HTTP request, it determines that it is a websocket connection request based on the request information in the HTTP request, responds to the websocket connection request, starts the websocket connection listening, obtains the target routing information of the websocket connection request, searches for a websocket processing function based on the target routing information, and when the websocket processing function is found, creates a websocket communication object, and then encapsulates the websocket communication object into the context environment corresponding to the target routing information, thus establishing websocket communication between the client and the server. The client and the server can subsequently implement two-way data transmission based on websocket communication.
[0105] After the client and server establish a websocket communication connection, the corresponding routing processing function (websocket processing function) can access the websocket communication object in the context environment to listen to or send messages.
[0106] Exemplarily, this embodiment is applied to autonomous driving applications, such as desktop applications developed on a graphical developer. Based on the requirement for real-time interaction between the autonomous driving application and the server, the server is also required to feed back the operating data of the autonomous driving application to the autonomous driving application in real time or at a fixed time, and display the corresponding operating data on the graphical interface. Therefore, in the application scenario of this embodiment, the back-end framework supports two communication methods, and can select the appropriate communication method according to the usage scenario of the front-end application to meet the back-end service requirements of the autonomous driving application at the same time.
[0107] Take the modeling and simulation test of autonomous driving applications as an example. When the autonomous driving application is modeling and simulation tested, various data (including test data and log data, etc.) will be generated in real time. The server will continuously return the generated data to the front end for display in real time, and the data can only be sent in real time if the server actively sends it. Therefore, in this scenario, the backend framework chooses websocket communication to transmit data.
[0108] Exemplarily, after encapsulating the websocket communication object into the context environment corresponding to the target routing information, the method further includes:
[0109] Responding to a modeling and simulation instruction;
[0110] When running the modeling simulation test on the graphical interface of the graphical developer, the graphical application platform will send the modeling simulation test to the server. The server responds to the modeling simulation test instruction and determines that websocket communication is required for communication. Based on the websocket processing function, in the context environment, the websocket communication object is accessed to obtain the data generated during the modeling simulation test sent by the server; and the data is sent to the graphical developer.
[0111] Similarly, the server accesses the websocket communication object in the context environment through the websocket processing function, obtains the data sent by the client, determines the corresponding database, and saves the data in the database.
[0112] Http communication is based on request-response mode. Only after the front end initiates the request, the server receives the request, processes it, and then returns the data to the front end. In HTTP communication based on request-response, the server must wait until the front end initiates the request before returning the data. It cannot be done in real time, resulting in the occupation of a large number of http connection channels and affecting the normal transmission of other data. In this scenario, websocket communication can transmit data in real time, ensure the timeliness of data, and avoid channel occupation.
[0113] In this example, in terms of communication, both HTTP and WebSocket are supported, so that the backend of the autonomous driving application can be developed in the Node.Js runtime environment.
[0114] As an example, if the configuration file configures the database configuration parameters, the specific implementation method of establishing the backend service of the autonomous driving application according to the configuration information is:
[0115] Establish database services for autonomous driving applications based on database configuration parameters.
[0116] Among them, establishing a database service for autonomous driving applications refers to establishing a mapping relationship between the front-end and back-end databases of autonomous driving applications, so that when the autonomous driving application is running, the data generated during runtime can be accurately stored in the corresponding database, and the database can accurately read the corresponding data.
[0117] The back-end framework provided in this embodiment pre-establishes a database service for the autonomous driving application according to the requirements of the front-end of the autonomous driving application. After the front-end of the autonomous driving application communicates with the back-end framework, the mapping between the front-end and the back-end database can be realized based on the mapping relationship between the back-end framework and the database.
[0118] Autonomous driving applications need to manage more system resources, such as memory, CPU, etc., when running. Therefore, backend services need to implement effective resource management mechanisms to ensure the stability and performance of the application. This increases the complexity of backend development and makes code organization more difficult.
[0119] Based on this, in an optional implementation, in order to improve the efficiency and convenience of data access when users use the back-end framework, the back-end framework provided in this implementation extracts the data persistence layer into an independent ORM component, and then establishes the service between the back-end framework and the database through the ORM component. Therefore, the back-end framework can realize comprehensive operations on the database by calling relevant APIs, effectively manage resources, ensure the stability and performance of the application, and at the same time reduce the complexity of back-end development and make code organization simpler.
[0120] Exemplarily, the ORM component provides a decorator, through which the developer describes the custom entity class, including the mapping relationship between the attributes of the entity class and the fields of the database table. Then, when creating a database service, the mapping relationship with the database is obtained from the decorator of the entity class, and the configured database configuration parameters are obtained from the configuration file, etc., to establish the relationship between the entity class and the database.
[0121] Therefore, in this example, the specific implementation method of establishing the database service of the autonomous driving application according to the database configuration parameters is as follows:
[0122] The process of establishing a database service for an autonomous driving application based on an ORM component.
[0123] Exemplarily, the process of establishing a database service based on the ORM component includes:
[0124] A1: Get the entity class marked by the decorator and associate the corresponding API interface according to the attributes of the entity class;
[0125] A2: Generate SQL statements for entity classes and databases based on the mapping relationship between the marked entity classes and the database and the database configuration parameters.
[0126] Among them, developers use decorators to describe the mapping relationship between the attributes of the entity class and the database. When the backend framework is initialized, the decorated entity class and the database configuration parameters can be obtained to generate SQL statements for the entity class and the database, and the data table structure is created by executing SQL statements. In an optional example, if there is no corresponding database table in the database, the SQL statement is executed to create a new data table structure. In another optional example, if there is already a corresponding database table in the database, the SQL statement is executed to modify the data table structure to establish a mapping relationship between the autonomous driving application and the database.
[0127] Optionally, in some embodiments, Figure 4 As shown, according to the mapping relationship between the entity class and the database and the database configuration parameters, the SQL statements of the entity class and the database are generated, including:
[0128] When instantiating the model object corresponding to each entity class, the SQL statement between the model object and the database is generated according to the mapping relationship between the entity class and the database and the database configuration parameters.
[0129] Then execute the SQL statement to generate the data tables corresponding to the entity class.
[0130] Optionally, the model object also provides basic database operation APIs for each entity class, such as insert, query, update, and delete. These APIs allow developers to interact with the database in an object-oriented manner without having to write specific SQL statements.
[0131] When developers use the instantiation object of the entity class to call the API provided by the model object, the ORM component dynamically generates a complete SQL execution statement based on the query parameters passed in, and executes the SQL statement to complete the database operation.
[0132] Since the interactive data involved in autonomous driving applications is more than that of conventional desktop applications, for example, when the speed calculation model and visual perception model are running, a large amount of interactive data will be generated, and the data is complex. If the data is read and stored on the server side, it will take a lot of time to establish a link to the database by writing SQL statements, which will increase the workload and be detrimental to data management. Based on this, the back-end framework provided by the embodiment of the present application provides a mapping relationship between the database and the ORM component. When the front-end of the autonomous driving application generates interactive data, it determines the entity class to which it belongs based on the attributes of the interactive data, and then calls the corresponding API interface. Then, the database operation is performed according to the API interface (for example, the corresponding SQL statement is called through the entity class associated with the API interface), without the need to write specific SQL statements, thereby simplifying the operation process of data storage and consuming less time.
[0133] Optionally, in this embodiment, if Figure 5 As shown in the figure, ORM component supports two usage scenarios: single database and multi-database. The multi-database scenario provides an effective solution for projects that need to support multiple databases at the same time. When using multiple databases, you can configure the target database under which each table is to be created through entity annotations and addDB method parameters. Database creation can be achieved by initializing multiple databases through init and dynamically adding new databases through addDb. Each instantiated data source will be injected into the data pool to maintain the connection. defaultDbChange provides the function of switching the current operating database.
[0134] Optionally, in this embodiment, through the above method, based on the configuration of windows, communications, and databases, a complete and operational desktop project can be quickly built. Optionally, in this embodiment, the startup process is procedurally controlled, and a predefined and orderly process is followed from reading and parsing the configuration file to starting the application to ensure that the application can be started correctly and stably, reducing problems caused by incorrect startup sequence and optimizing the startup performance of the autonomous driving application.
[0135] In this embodiment, a backend framework is provided in the Node.Js operating environment in the application development environment, which can abstract the configuration for starting the autonomous driving application service and save it in the form of a configuration file; the developer configures the configuration information of the autonomous driving application through the configuration file, and then obtains the configuration file based on the abstract read interface when responding to the startup operation, and parses the configuration file to obtain the configuration information, and then creates the backend service of the autonomous driving application according to the configuration information, and realizes the startup of the backend service of the autonomous driving application, while the configuration for starting the autonomous driving application service is independent of the code and configured and managed by the backend framework, so as to avoid the dispersion of this information in various locations of the program code, reduce the complexity of code organization, adapt to the performance requirements of the autonomous driving application, and make the backend service developed in the Node.Js operating environment also suitable for autonomous driving applications.
[0136] In this embodiment, on the server side, developers can quickly start desktop applications and related services by configuring and calling corresponding interfaces. In terms of communication, HTTP and WebSocket are supported to meet the needs of complex communication scenarios of desktop programs. The ORM component provides a set of standardized interfaces for database operations, which improves the efficiency and convenience of data access.
[0137] Figure 6 Schematic diagram of the backend development method of the autonomous driving application graphical developer provided in this application Figure 2 ,like Figure 6 As shown, in this embodiment Figure 2 Based on the embodiment, the method further comprises:
[0138] S601, responding to a start operation;
[0139] Among them, the principle and implementation method of responding to the startup operation in this step are the same as those in the above embodiment and will not be repeated here.
[0140] S602, scanning the decorated processing functions and controller methods;
[0141] In this embodiment, the communication protocol of the autonomous driving application service is standardized and constrained. Exemplarily, this embodiment provides a decorator to decorate the processing function (hereinafter referred to as the Action method) and the controller method (hereinafter referred to as the Method) and the corresponding routing information (URL path and HTTP method). The decorated Action method is managed by the dependency device, and the communication route is processed by dependency injection. There is no need for developers to manage and analyze the routes. Exemplarily, an Action method corresponds to the request processing flow of a task, and the Method corresponds to the function or method that performs this task or operation.
[0142] Optionally, a series of Action methods are defined according to business logic and functional requirements. Each Action method is divided into specific Method methods by actions or behaviors. That is, each Action method can contain multiple Methods to implement it. These Methods correspond to different HTTP methods. For example, these Methods include GET, POST, PUT, DELETE, HEAD, TRACE, OPTIONS, and CONNECT.
[0143] All Action methods are decorated with corresponding decorators. The backend framework provides decorators, and developers can configure the routing information corresponding to each decorator according to business needs. For example, the decorator reflects that when the client sends a request that matches the routing information, the marked Action method is used to process the request.
[0144] In this step, when the autonomous driving application service is started, all decorated Action methods and Methods are scanned, and the routing initialization is completed by creating a mapping relationship between the Action method, Method and routing information.
[0145] S603, obtaining routing information of the processing function and the controller method according to the decorator that decorates the processing function and the controller method;
[0146] In this step, based on the marking of the Action method and Method in the decorator, when the developer configures the corresponding routing information for the decorator, the routing information corresponding to the Action method and Method can be obtained through the decorator.
[0147] S604: Establish a mapping relationship table between processing functions, controller methods and routing information.
[0148] The mapping relationship table records the mapping relationship between all action methods and methods and routing information. The mapping relationship maps the URL path and HTTP method to specific action methods and methods.
[0149] Through the above method, the mapping relationship table between Action method, Method and routing information is established.
[0150] Based on the initialized backend framework, when communicating with the front-end of the autonomous driving application, after receiving the business request from the front-end, the backend framework determines the target routing information corresponding to the business request based on the business request, searches the mapping relationship table for the Action method and Method that match the target routing information, and directly calls the Action method and Method to process the business request, thereby realizing routing distribution based on the backend framework.
[0151] In an optional embodiment, if Figure 7 As shown, the backend framework provides a context object to save request information, such as request parameters, user information, session status, etc. The request information is used as data for Action and Method execution when Action and Method execute business requests.
[0152] For example, when a client sends a request, the routing management module of the backend framework parses the routing information of the request, finds the corresponding Action and Method in the mapping table, creates a context object, and fills the parameters in the request (including the Body parameter) into the context object.
[0153] When Action and Method are executed, they obtain the required parameters and other information through the context object. The Body parameter object is created and filled as part of the context object, so Action and Method can directly access these parameters without complex request parsing or parameter matching.
[0154] Optionally, this embodiment creates a back-end service of an autonomous driving application graphical developer in a Node.Js runtime environment (Web development environment) in an application development environment, and performs dependency injection on communication routing (routing management), so that this embodiment has the same characteristics as a Web environment, such as the context object can operate on the window, eliminating the complex protocols and logic of window recognition.
[0155] Optionally, in this embodiment, the back-end framework also provides a dependency injection device, which encapsulates the communication Action into a decorator and injects it into the dependency device, so that the back-end framework can clearly understand the dependency relationship of each Action and automatically inject these dependencies when needed. The dependency device works in conjunction with the back-end framework to automatically create the route of the communication Action according to the decorator and method specified by the developer, so that there is no need to manually write the route configuration code, which improves the development efficiency. The dependency device implements the idea of control inversion, and the creation and dependency management of the object are handed over to the external container (i.e., the dependency device) for processing, so that the developer can focus more on the implementation of the business logic without having to worry about the creation of the object and the maintenance of the dependency relationship. When the front end sends an HTTP request to the back end according to the business logic and user interaction, based on the information such as the URL path, HTTP method, and request parameters contained in the request, when the back end receives the HTTP request, it will find the corresponding Action method and Method in the mapping relationship table according to the URL path and HTTP method of the request, and call them to process the request. In this process, developers do not need to manually manage or maintain routing information. They only need to define Action and Method according to the decorator specifications provided by the framework to achieve route distribution and request processing. For complex autonomous driving application scenarios, routes can be distributed and requests can be processed quickly to meet the needs of the scenario.
[0156] Figure 8 Schematic diagram of the backend development method of the autonomous driving application graphical developer provided in this application Figure 3 ,like Figure 8 As shown, in this embodiment, based on all the above embodiments, the method further includes:
[0157] S801, in response to the start operation, in the Node.Js running environment in the application development environment, obtaining a configuration file based on an abstract read interface;
[0158] The implementation principle and method of step S801 are the same as those in the above embodiment and will not be described in detail here.
[0159] S802, obtaining extended middleware configuration information in the configuration file;
[0160] The configuration file obtained above also includes extended middleware configuration information. That is, in this embodiment, extended middleware is also provided, and the extended middleware configuration information is abstracted to generate a configuration file, through which developers can configure the extended middleware.
[0161] During initialization, the extended middleware configuration information can be obtained by reading the configuration file.
[0162] S803, obtaining the intermediate function and the extended middleware type of the extended middleware according to the configuration information;
[0163] According to the configuration information, the intermediate function of the extended middleware is loaded, and the extended middleware type is determined. Among them, the extended middleware type includes the front-end extended middleware and the rear-end extended middleware. The front-end extended middleware is used to pre-process the request. For example, the service request sent by the client is first sent to the front-end extended middleware for pre-processing, and then forwarded to the server by the front-end extended middleware. The rear-end extended middleware is used to post-process the response. For example, the server sends the response to the rear-end extended middleware first, and then the rear-end extended middleware sends the response to the client. Therefore, the front-end extended middleware is executed before processing the request, and the rear-end extended middleware is executed after processing the request.
[0164] S804, determining a registration location of the extended middleware according to the extended middleware type, where the registration location includes a pipeline before request processing and a pipeline after request processing;
[0165] S805, register the middleware function and the extended middleware to the corresponding registration location.
[0166] Determine the registration location according to the extension middleware type. For example, the front extension middleware needs to be registered in the pipeline before request processing to pre-process the request; the post extension middleware needs to be registered in the pipeline after request processing to post-process the response.
[0167] In this embodiment, extended middleware is provided to implement request preprocessing and response postprocessing, thereby improving the intervention processing of the entire process from request to response. The common logic of executing the request is performed by the extended middleware before the request is executed; the response of the server is uniformly formatted. For example, if the response includes text format and image format, the text format and image format are unified and sent to the client.
[0168] In this embodiment, the injection and use of the middleware can be done by the user independently importing the extended middleware configuration information, and the extended middleware can be automatically registered on the backend framework according to the configuration information. Optionally, the middleware provides request and response objects, and the state modified by each middleware can be passed back.
[0169] In the embodiments of the present application, communication support and enhanced functions are provided by extending the middleware so that the front-end and back-end of the autonomous driving application can effectively interact and communicate. Combined with the application of the above embodiments, the construction requirements of the autonomous driving application can be met in the Node.Js operating environment.
[0170] Fig. 9A schematic diagram of the structure of the back-end development device of the autonomous driving application graphical developer provided in this application, such as Fig. 9 As shown, the backend development device 90 provided in this embodiment includes:
[0171] An acquisition module 901 is used for, in response to a startup operation, acquiring a configuration file based on an abstract read interface in a Node.Js runtime environment in an application development environment, wherein the configuration file is generated after abstract processing of a configuration for starting an autonomous driving application service, and configuration information of a backend service of the autonomous driving application may be input in the configuration file;
[0172] A parsing module 902 is used to parse the configuration file to obtain configuration information of the backend service of the autonomous driving application;
[0173] Processing module 903 is used to establish the backend service of the autonomous driving application according to the configuration information.
[0174] The back-end development device of the autonomous driving application graphical developer provided in this embodiment can execute the method provided in the above method embodiment. Its implementation principle and technical effects are similar, and are not described in detail in this embodiment.
[0175] Fig.10 This is a schematic diagram of the structure of the electronic device provided in this application. Fig.10 As shown, the electronic device 100 provided in this embodiment includes: at least one processor 1001 and a memory 1002. Optionally, the device 100 further includes a communication component 1003. The processor 1001, the memory 1002 and the communication component 1003 are connected via a bus 1004.
[0176] In a specific implementation process, at least one processor 1001 executes the computer-executable instructions stored in the memory 1002, so that at least one processor 1001 executes the above method.
[0177] The specific implementation process of the processor 1001 can be found in the above method embodiment, and its implementation principle and technical effect are similar, so this embodiment will not be repeated here.
[0178] In the above embodiments, it should be understood that the processor may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), etc. A general-purpose processor may be a microprocessor or any conventional processor. The steps of the method disclosed in the invention may be directly implemented as being executed by a hardware processor, or may be executed by a combination of hardware and software modules in the processor.
[0179] The memory may include a high-speed memory (Random Access Memory, RAM), and may also include a non-volatile memory (Non-volatile Memory, NVM), such as at least one disk memory.
[0180] The bus may be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus, etc. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, the bus in the drawings of the present application is not limited to only one bus or one type of bus.
[0181] The present application also provides a computer program product, including a computer program, which implements the above method when executed by a processor.
[0182] The present application also provides a computer-readable storage medium, in which computer-executable instructions are stored. When a processor executes the computer-executable instructions, the above method is implemented.
[0183] The above-mentioned readable storage medium 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. The readable storage medium can be any available medium that can be accessed by a general or special-purpose computer.
[0184] An exemplary readable storage medium is coupled to a processor so that the processor can read information from the readable storage medium and write information to the readable storage medium. Of course, the readable storage medium can also be a component of the processor. The processor and the readable storage medium can be located in an application specific integrated circuit (Application Specific Integrated Circuits, referred to as: ASIC). Of course, the processor and the readable storage medium can also exist in the device as discrete components.
[0185] The division of units is only a logical function division, and there may be other divisions in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interface, device or unit, which can be electrical, mechanical or other forms.
[0186] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0187] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
[0188] If the function is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium, including a number of instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods of each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk and other media that can store program codes.
[0189] Those skilled in the art can understand that all or part of the steps of implementing the above-mentioned method embodiments can be completed by hardware related to program instructions. The aforementioned program can be stored in a computer-readable storage medium. When the program is executed, the steps of the above-mentioned method embodiments are executed; and the aforementioned storage medium includes: ROM, RAM, disk or optical disk and other media that can store program codes.
[0190] Finally, it should be noted that those skilled in the art will readily conceive of other embodiments of the present invention after considering the specification and practicing the invention disclosed herein. The present invention is intended to cover any variations, uses or adaptations of the present invention, which follow the general principles of the present invention and include common knowledge or customary technical means in the art not disclosed by the present invention, are not limited to the precise structure described above and shown in the drawings, and may be modified and changed in various ways without departing from the scope thereof. The scope of the present invention is limited only by the appended claims.
Claims
1. A back-end development method for an autonomous driving application graphical developer, characterized in that: include: In response to the start operation, in the Node.Js running environment in the application development environment, a configuration file is obtained based on an abstract read interface, wherein the configuration file is generated after abstract processing of a configuration for starting the autonomous driving application service, and configuration information of a backend service of the autonomous driving application may be input in the configuration file; Parsing the configuration file to obtain configuration information of the backend service of the autonomous driving application; Establish a backend service for the autonomous driving application based on the configuration information.
2. The method according to claim 1, characterized in that The backend service of establishing the autonomous driving application according to the configuration information includes at least one of the following: Creating a window according to the window configuration parameters, wherein the window is used to load a front-end page of the autonomous driving application, and the configuration information includes the window configuration parameters; Establishing a communication service for communicating with a front-end of the autonomous driving application according to the communication configuration parameters, wherein the configuration information includes the communication configuration parameters; A database service for an autonomous driving application is established according to database configuration parameters, wherein the configuration information includes the database configuration parameters.
3. The method according to claim 2, characterized in that The establishing of a communication service for communicating with a front-end of the autonomous driving application according to the communication configuration parameters includes: According to the communication configuration parameters, communication supporting http protocol and websocket protocol is established.
4. The method according to claim 3, characterized in that After establishing the communication supporting the http protocol and the websocket protocol according to the communication configuration parameters, the method further includes: In response to the websocket connection request, obtaining target routing information of the websocket connection request; When a websocket processing function is found according to the target routing information, a websocket communication object is created; The websocket communication object is encapsulated into a context environment corresponding to the target routing information, so that the websocket processing function accesses the websocket communication object in the context environment.
5. The method according to claim 4, characterized in that After encapsulating the websocket communication object into the context environment corresponding to the target routing information, the method further includes: Responding to a modeling and simulation instruction, wherein the modeling and simulation instruction is received when running a modeling and simulation test on a graphical interface of a graphical developer; Based on the websocket processing function, in the context environment, access the websocket communication object to obtain the data generated in the modeling simulation test process sent by the server; The data is sent to the graphical developer.
6. The method according to any one of claims 2 to 5, characterized in that The database service of the autonomous driving application is established according to the database configuration parameters, wherein the configuration information includes the database configuration parameters, including: The process of establishing a database service for an autonomous driving application is executed based on an ORM component, wherein the process of establishing a database service includes: obtaining an entity class marked by a decorator, and associating a corresponding API interface according to the attributes of the entity class; and generating SQL statements for the entity class and the database according to the database configuration parameters and the mapping relationship between the marked entity class and the database.
7. The method according to any one of claims 1 to 5, characterized in that In response to the start operation, after obtaining the configuration file based on the abstract read interface in the Node.Js runtime environment in the application development environment, the method further includes: Scanning the decorated processing function and controller method, wherein the processing function and the controller method are used to process the communication request; Obtaining routing information of the processing function and the controller method according to the decorator that decorates the processing function, wherein the decorator marks the routing information of the processing function; A mapping relationship table of the processing function, controller method and routing information is established.
8. The method according to any one of claims 1 to 5, characterized in that In response to the start operation, after obtaining the configuration file based on the abstract read interface in the Node.Js runtime environment in the application development environment, the method further includes: Acquire the extended middleware configuration information in the configuration file, wherein the configuration file also includes the extended middleware configuration information; According to the configuration information, an intermediate function and an extended middleware type of the extended middleware are obtained; Determining a registration location of the extended middleware according to the extended middleware type, wherein the registration location includes a pipeline before request processing and a pipeline after request processing; Register the middleware function and the extended middleware to corresponding registration locations.
9. A back-end development device for an autonomous driving application graphical developer, characterized in that: include: an acquisition module, configured to, in response to a startup operation, acquire a configuration file based on an abstract read interface in a Node.Js runtime environment in an application development environment, wherein the configuration file is generated after abstract processing of a configuration for starting an autonomous driving application service, and configuration information of a backend service of the autonomous driving application may be input into the configuration file; A parsing module, used to parse the configuration file to obtain configuration information of the backend service of the autonomous driving application; A processing module is used to establish a backend service for the autonomous driving application according to the configuration information.
10. A device, characterized in that: include: Memory, processor; The memory stores computer-executable instructions; The processor executes the computer-executable instructions stored in the memory, so that the processor performs the method according to any one of claims 1 to 8.