Vehicle sensor control method and device, medium, product and vehicle
By introducing resource management layer and bus conversion layer into the control equipment of intelligent connected vehicles, unified management and control of sensors of different communication protocols is achieved, and the problems of high sensor adaptation and management costs and asynchronous data transmission are solved, and development efficiency and data synchronization are improved.
Patent Information
- Application Number
- CN202510094006.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-21
- Publication Date
- 2025-05-02
- Estimated Expiration
- 2045-01-21
AI Technical Summary
In intelligent connected vehicles, sensors of multiple different communication protocols need to be adapted, which increases the development time of upper-level application and vehicle management costs, and also leads to asynchronous problems in sensor data transmission.
By introducing a resource management layer and a bus conversion layer into the vehicle's control device, a unified control instruction is generated using preset communication protocols, and converting them into a communication protocol adapted by the target sensor through the bus conversion layer, unified management and control of sensors of different communication protocols is realized.
It reduces the work of upper-level application developers to adapt sensor communication protocols and improves development efficiency; at the same time, it reduces the cost of sensor management for vehicles, and improves the synchronization of sensor data transmission under different communication protocols, solving the problem of asynchronous data transmission.
Smart Images

Figure CN119922213A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of automobile technology, and in particular to a sensor control method, device, medium, product and vehicle for a vehicle. Background Art
[0002] With the development of intelligent connected vehicles, the types of sensors carried by vehicles are increasing, and the communication protocols involved in the sensors are also gradually increasing. On the one hand, when developing upper-level applications based on sensor devices, in order to connect to sensors with multiple different communication protocols, it is necessary to adapt to each communication protocol, which increases the development time of upper-level applications, increases the workload of upper-level application developers, and reduces the application development efficiency of upper-level application developers; on the other hand, vehicles need to control the sensors they carry, but the management of sensors under different communication protocols is different, so the vehicle needs to manage the sensors under each communication protocol separately, which increases the management cost of the vehicle for the sensors. Summary of the invention
[0003] The present application provides a vehicle sensor control method, device, medium, product and vehicle.
[0004] In order to achieve the above purpose, the technical solution adopted in this application is as follows:
[0005] A vehicle sensor control method is applied to a control device of the vehicle, the control device includes a resource management layer and a bus conversion layer, and the method includes: the resource management layer determines, in response to receiving a sensor control request, a target session identifier of a target sensor to be controlled in the vehicle and first control information corresponding to the target sensor based on the sensor control request; the target session identifier is used to identify a target session channel corresponding to the target sensor; the target session channel is used for data transmission between the bus conversion layer and the target sensor; the resource management layer determines the first resource information corresponding to the target session identifier from a first mapping information set between the session identifier and the resource information; the resource management layer generates a first control instruction based on the first resource information and the first control information using a preset communication protocol, and sends the first control instruction to the bus conversion layer; the bus conversion layer generates a second control instruction based on the first control instruction using a target communication protocol adapted to the target sensor, and sends the second control instruction to the target sensor.
[0006] According to the above technical means, first, the resource management layer parses the received sensor control request to determine the target session identifier of the target sensor and the first control information corresponding to the target sensor; then, based on the first resource information and the first control information corresponding to the target session identifier, a first control instruction is generated using a preset communication protocol, so that the unified method of calling sensors of different communication protocols can be realized through the preset communication protocol; finally, the bus conversion layer converts the first control instruction into a second control instruction based on the target communication protocol adapted to the target sensor, and the unified preset communication protocol is converted into the target communication protocol adapted to the target sensor through the bus conversion layer, so that the management of sensors of different communication protocols can be realized. On the one hand, the method is applied in the upper application development stage, which can reduce the work of upper application developers to adapt different communication protocols of sensors during the application development process, and improve the application development efficiency of upper application developers. On the other hand, the method is applied in the vehicle, and the vehicle can realize the unified management of sensors of different communication protocols through the method, reducing the management cost of the vehicle to the sensor. In addition, the synchronization of data transmission of sensors under different communication protocols can be improved through a unified management method, solving the problem of asynchronous data transmission of sensors caused by different sensor calling methods corresponding to different communication protocols.
[0007] Furthermore, the bus conversion layer generates a second control instruction based on the first control instruction using a target communication protocol adapted to the target sensor, including: the bus conversion layer parses the first control instruction based on a preset communication protocol to determine first resource information and first control information; the bus conversion layer determines the target communication protocol adapted to the target sensor based on the first resource information; the bus conversion layer determines the second control information adapted to the target communication protocol based on the first control information; the bus conversion layer generates a second control instruction based on the second control information using the target communication protocol.
[0008] According to the above-mentioned technical means, first, the bus conversion layer parses the first control instruction according to the rules of the preset communication protocol to determine the first resource information and the first control information of the target sensor; then, based on the target communication protocol corresponding to the first resource information, the first control information can be converted into second control information recognizable by the target communication protocol, so that by converting the control instructions from a unified preset communication protocol to the target communication protocol, the control of sensors with different communication protocols is achieved through a unified communication protocol.
[0009] Further, the first resource information includes a first resource identifier, and sending a second control instruction to the target sensor includes: the bus conversion layer determines the target session identifier corresponding to the first resource identifier from a second mapping information set between the session identifier and the resource information; the bus conversion layer sends the second control instruction to the target sensor through a target session channel corresponding to the target session identifier.
[0010] According to the above technical means, the bus conversion layer determines the target session identifier corresponding to the first resource identifier from the second mapping information set, so that the second control instruction can be sent to the target sensor through the target session channel corresponding to the target session identifier, thereby realizing the transmission of the second control instruction.
[0011] Furthermore, the bus conversion layer determines second control information adapted to the target communication protocol based on the first control information, including: the bus conversion layer determines the target operating system carried by the vehicle's control device; the bus conversion layer determines third control information adapted to the target operating system based on the first control information; the bus conversion layer determines the second control information adapted to the target communication protocol based on the third control information.
[0012] According to the above-mentioned technical means, firstly, based on the target operating system carried by the vehicle's control device, the first control information can be converted into third control information recognizable by the target operating system. Through this conversion of control information, the compatibility of the vehicle's control device with different operating systems is achieved, so that the vehicle's control device can be installed on different operating systems without adapting the operating system; then, based on the target communication protocol, the third control information is converted into second control information recognizable by the target communication protocol. Through this conversion of control information, a second control instruction is generated to achieve control of sensors with different communication protocols under different operating systems.
[0013] Furthermore, the method also includes: the resource management layer determines first resource information of the target sensor to be connected based on the sensor connection request in response to receiving the sensor connection request; the resource management layer generates a first connection instruction based on the first resource information and using a preset communication protocol, and sends the first connection instruction to the bus conversion layer; the bus conversion layer generates a second connection instruction based on the first connection instruction and using a target communication protocol adapted to the target sensor, and sends the second connection instruction to the target sensor to establish a target session channel for data transmission with the target sensor.
[0014] According to the above technical means, the received sensor connection request is parsed at the resource management layer to determine the first resource information of the target sensor; then, based on the first resource information corresponding to the target session identifier, a first connection instruction is generated using a preset communication protocol, so that sensors with different communication protocols can be connected in a unified manner through the preset communication protocol; finally, the unified preset communication protocol is converted into a target communication protocol adapted by the target sensor through the bus conversion layer, so that sensors with different communication protocols can be connected. In addition, the target session identifier generated by the sensor connection request is used as an input parameter of the sensor control request to associate with the target sensor based on the target session identifier, so that the vehicle control device completes the control operation of the target sensor.
[0015] Furthermore, the method also includes: in response to the successful establishment of the target session channel, the bus conversion layer maps the target session identifier and the first resource information and stores it in the second mapping information set, and sends the target session identifier to the resource management layer; the resource management layer maps the target session identifier and the first resource information and stores it in the first mapping information set; the resource management layer generates response information of the sensor connection request based on the target session identifier, and returns the response information of the sensor connection request to the sender of the sensor connection request.
[0016] According to the above-mentioned technical means, when the target session is successfully established, the resource management layer obtains the target session identifier, so that the resource management layer can generate a response information of the sensor connection request based on the target session identifier and return it to the sender of the sensor connection request. In this way, the target session identifier can be obtained through the response information of the sensor connection request, and the target session identifier can be used as an input parameter of the sensor control request to complete the control operation on the target sensor.
[0017] Further, the sensor control request includes a write request, and the first control information includes first instruction configuration information; based on the sensor control request, the first control information corresponding to the target sensor is determined, including: the resource management layer determines the first storage address and the first data length corresponding to the first instruction configuration information based on the write request; the resource management layer obtains the first instruction configuration information from the storage space based on the first storage address and the first data length.
[0018] According to the above-mentioned technical means, when the sensor control request is a write request, the resource management layer parses the write request to obtain the first storage address and the first data length, so that the first instruction configuration information can be determined based on the first storage address and the first data length, and the first instruction configuration information is written to the target sensor through the second control instruction to realize the parameter configuration of the target sensor.
[0019] Further, the sensor control request includes a write request, and the first control information includes first instruction configuration information; based on the sensor control request, the first control information corresponding to the target sensor is determined, including: the resource management layer determines the second instruction configuration information carried by the write request of the target sensor; the resource management layer determines the first instruction configuration information based on the second instruction configuration information.
[0020] According to the above-mentioned technical means, when the sensor control request is a write request, the resource management layer first parses the write request to obtain the second instruction configuration information, and then determines the first instruction configuration information based on the second instruction configuration information, so that the first instruction configuration information is written to the target sensor based on the second control instruction to realize the parameter configuration of the target sensor.
[0021] Further, the sensor control request includes a read request; after sending a second control instruction to the target sensor, the method also includes: the bus conversion layer sends the target sensing data to the resource management layer in response to receiving the target sensing data collected by the target sensor and sent by the target sensor; the resource management layer stores the target sensing data into the target area, and generates response information of the read request based on the address information of the target area, and returns the response information of the read request to the sender of the read request.
[0022] According to the above technical means, first, the target sensor returns the target sensing data to the bus conversion layer based on the read request, and the bus conversion layer sends the target sensing data to the resource management layer; then, the resource management layer stores the target sensing data, and generates response information of the read request based on the corresponding storage information and sends it to the sender of the read request, so that the sender of the read request can obtain the target perception data based on the response information of the read request, so that the upper-level application or vehicle corresponding to the sender of the read request can realize the corresponding function based on the target perception data.
[0023] Further, the sensor control request includes a read request or a write request; after sending the second control instruction to the target sensor, the method also includes: the resource management layer responds to receiving the task status query request, and determines the target session identifier and target task identifier of the target sensor to be queried based on the task status query request; the target task identifier is used to identify the asynchronous read operation task generated by the target sensor based on the read request, or the asynchronous write operation task generated based on the write request; the resource management layer determines the first resource information from the first mapping information set; the resource management layer generates a first query instruction based on the first resource information and the target task identifier using a preset communication protocol, and sends the first query instruction to the bus conversion layer; the bus conversion layer generates a second query instruction based on the first query instruction using a target communication protocol adapted to the target sensor, and sends the second query instruction to the target sensor.
[0024] According to the above technical means, first, the resource management layer parses the received task status query request to determine the first resource information of the target sensor; then, based on the first resource information and the target task identifier, a first query instruction is generated using the preset communication protocol, so that the task status query of sensors with different communication protocols can be implemented in a unified manner through the preset communication protocol; finally, the bus conversion layer converts the first query instruction corresponding to the unified preset communication protocol into a second query instruction corresponding to the target communication protocol based on the target communication protocol adapted by the target sensor, so that the task status query of sensors with different communication protocols can be implemented.
[0025] Furthermore, the method also includes: the bus conversion layer sends the target task status to the resource management layer in response to receiving the target task status of the target task corresponding to the target task identifier sent by the target sensor; the resource management layer generates response information of the task status query request based on the target task status, and returns the response information of the task status query request to the sender of the task status query request.
[0026] According to the above-mentioned technical means, first, the target sensor returns the target task status to the bus conversion layer based on the task status query request, and the bus conversion layer sends the target task status to the resource management layer; then, the resource management layer sends the target task status to the sender of the task status query request, so that the sender of the task status query request can determine the current target task status of the target task, so that the upper-level application or vehicle corresponding to the sender of the task status query request can implement the corresponding function based on the target task status.
[0027] Further, the sensor control request includes a connection disconnection request, and the method also includes: the bus conversion layer clears the mapping information between the target session identifier and the first resource information in response to receiving the first response information of the connection disconnection request sent by the target sensor, generates second response information of the connection disconnection request, and sends the second response information of the connection disconnection request to the resource management layer; the first response information is used to indicate that the target sensor has disconnected the target session channel between the bus conversion layer; based on the second response information, the resource management layer clears the mapping information between the target session identifier and the first resource information, generates third response information of the connection disconnection request, and returns the third response information of the connection disconnection request to the sender of the connection disconnection request.
[0028] According to the above technical means, first, the bus management layer clears the data content associated with the target sensor in the second mapping set based on the first response information of the connection disconnection request, and then generates the second response information of the connection disconnection request and sends it to the resource management layer, and the resource management layer clears the data content associated with the target sensor in the first mapping set. In this way, by clearing the data related to the target session channel, the storage space occupied by redundant data can be reduced, and the operating efficiency of the vehicle's control device can be improved.
[0029] Furthermore, the method also includes: the resource management layer determines sensor update information associated with the sensor update event in response to the sensor update event; the resource management layer determines resource information of at least one sensor carried by the vehicle based on the sensor update information; and the resource management layer updates the first mapping information set when the resource information of at least one sensor includes resource information of the target sensor.
[0030] According to the above-mentioned technical means, first, the resource management layer responds to the sensor update event and determines the resource information of the sensor update event. Then, when it is determined that the resource information contains the resource information of the target sensor, the resource management layer updates the first mapping information set. In this way, real-time monitoring of at least one sensor carried by the vehicle can be achieved, and the monitoring results can be reflected to the resource management layer in real time, thereby achieving synchronous updating of the resource management layer data, reducing the occupation of storage space by redundant data, and improving the operating efficiency of the vehicle's control equipment.
[0031] Furthermore, the method also includes: the resource management layer determines, in response to receiving the analog sensor request, fourth control information corresponding to the analog sensor and second resource information of the analog sensor based on the analog sensor request; the analog sensor is generated based on the target state data of the target sensor; the resource management layer generates a third control instruction based on the second resource information and the fourth control information using a preset communication protocol, and sends the third control instruction to the bus conversion layer; the bus conversion layer determines response information of the third control instruction corresponding to the analog sensor, and sends the response information of the third control instruction to the resource management layer; the response information of the third control instruction is used by the resource management layer to generate response information of the analog sensor request, and returned to the sender of the analog sensor request.
[0032] According to the above technical means, first, the resource management layer parses the received analog sensor request to determine the third control information corresponding to the analog sensor and the second resource information of the analog sensor; then, based on the second resource information and the fourth control information, a third control instruction is generated using a preset communication protocol, so that the analog sensors of different communication protocols can be called in a unified manner through the preset communication protocol; finally, the bus conversion layer determines the response information of the third control instruction based on the third control instruction, and sends it to the resource management layer, so that the resource management layer can generate response information of the analog sensor request based on the response information of the third control instruction, and send it to the sender of the analog sensor request. Through this method, the upper-layer application can receive the response information through the sender of the analog sensor request without the need for a real sensor, thereby realizing the joint debugging of the functions between the upper-layer application and the sensor, reducing the consumption of sensor resources and saving the cost of application development.
[0033] An electronic device includes a memory and a processor, wherein the memory stores a computer program that can be run on the processor, and the processor implements part or all of the steps in the above method when executing the program.
[0034] A computer-readable storage medium stores a computer program, which implements part or all of the steps in the above method when executed by a processor.
[0035] A computer program product includes a computer program or instructions, and when the computer program or instructions are executed by a processor, some or all of the steps in the above method are implemented.
[0036] A vehicle comprises the above electronic device.
[0037] Beneficial effects of this application:
[0038] (1) By converting the control commands between the unified preset communication protocol and the target communication protocol, the management of sensors with different communication protocols can be realized. On the one hand, applying this method in the upper-level application development stage can reduce the work of upper-level application developers in adapting different communication protocols of sensors during the application development process, thereby improving the application development efficiency of upper-level application developers. On the other hand, applying this method in a vehicle can realize the unified management of sensors with different communication protocols through this method, thereby reducing the management cost of the vehicle for sensors. In addition, a unified management method can also improve the synchronization of data transmission of sensors under different communication protocols, thereby solving the problem of asynchronous data transmission of sensors caused by different sensor calling methods corresponding to different communication protocols.
[0039] (2) The first control information parsed by the bus conversion layer is converted into third control information recognizable by the target operating system, thereby achieving compatibility of the vehicle's control device with different operating systems, so that the vehicle's control device can be installed on different operating systems without adapting the operating system, thereby achieving control of sensors with different communication protocols under different operating systems.
[0040] (3) The target session identifier is obtained through the response information of the sensor connection request, and the target session identifier is used as an input parameter of the sensor control request to complete the control operation on the target sensor.
[0041] (4) The target perception data is obtained based on the response information of the sensor control request, so that the upper-layer application corresponding to the sender of the sensor control request can implement the corresponding function based on the target perception data.
[0042] (5) When the resource information associated with the sensor update event contains the resource information of the target sensor, the first mapping information set is updated. In this way, real-time monitoring of at least one sensor installed in the vehicle can be achieved, and the monitoring results can be reflected to the resource management layer in real time, thereby realizing the synchronous update of the resource management layer data, reducing the storage space occupied by redundant data and improving the operating efficiency of the vehicle's control equipment.
[0043] (6) The application method of the simulated sensor can enable the upper-layer application to receive response information determined based on the simulated sensor without the need for a real sensor, thereby realizing the functional coordination between the upper-layer application and the sensor, reducing the consumption of sensor resources and saving the cost of application development. BRIEF DESCRIPTION OF THE DRAWINGS
[0044] Figure 1 A schematic diagram of the implementation flow of a vehicle sensor control method proposed in this application;
[0045] Figure 2 Schematic diagram of the implementation of a vehicle sensor management software framework proposed in this application Figure 1 ;
[0046] Figure 3 Schematic diagram of the implementation of a vehicle sensor management software framework proposed in this application Figure 2 ;
[0047] Figure 4 Schematic diagram of the implementation of a vehicle sensor management software framework proposed in this application Figure 3 ;
[0048] Figure 5 Schematic diagram of the implementation of a vehicle sensor management software framework proposed in this application Figure 4 ;
[0049] Figure 6 Schematic diagram of the implementation of a vehicle sensor management software framework proposed in this application Figure 5 ;
[0050] Figure 7 A hardware entity schematic diagram of a computer device proposed in this application. DETAILED DESCRIPTION
[0051] The following will describe the implementation methods of the present application with reference to the accompanying drawings and preferred embodiments. Those skilled in the art can easily understand other advantages and effects of the present application from the contents disclosed in this specification. The present application can also be implemented or applied through other different specific implementation methods, and the details in this specification can also be modified or changed in various ways based on different viewpoints and applications without departing from the spirit of the present application. It should be understood that the preferred embodiments are only for illustrating the present application, not for limiting the scope of protection of the present application.
[0052] It should be noted that the illustrations provided in the following embodiments are only schematic illustrations of the basic concept of the present application, and thus the drawings only show components related to the present application rather than being drawn according to the number, shape and size of components in actual implementation. In actual implementation, the type, quantity and proportion of each component may be changed at will, and the component layout may also be more complicated.
[0053] This embodiment proposes a vehicle sensor control method, such as Figure 1 As shown, a control device applied to a vehicle includes a resource management layer and a bus conversion layer, and a sensor control method includes the following steps S101 to S104, wherein:
[0054] Step S101: In response to receiving a sensor control request, the resource management layer determines a target session identifier of a target sensor to be controlled in the vehicle and first control information corresponding to the target sensor based on the sensor control request; the target session identifier is used to identify a target session channel corresponding to the target sensor; the target session channel is used for data transmission between the bus conversion layer and the target sensor;
[0055] Here, the resource management layer is used to manage all sensors based on a unified protocol. Sensor control request refers to a request message that sends control instructions or data requests to sensors through a specific interface. A sensor is a device that converts non-electrical parameters into measurable electrical signal outputs.
[0056] In some implementations, the sensor control request may be one of a read request, a write request, and a disconnection request.
[0057] In some embodiments, the vehicle's control device includes an application interface layer, and the sensor control request can be generated and sent to the resource management layer through a unified programming interface provided by the application interface layer, wherein the application interface layer provides interface information for operating the sensor, wherein the interface information may include interface address, interface function, request parameters, and response parameters.
[0058] For example, taking a read request as an example, the interface address is: VsRead or VsReadAsync; the interface function is: reading data from the sensor; the request parameters are: size: indicating the expected data length, session: indicating the session identifier; the response parameters are: buf: indicating the address information of the target area where the data of the sensor is stored; the interface status code: 0 indicates success, and the rest of the values indicate failure; when the interface address is VsRead, the response parameters include ret_size: indicating the actual length of the data obtained; when the interface address is VsReadAsync, the response parameters include job_id, indicating the task identifier generated when performing an asynchronous read operation task.
[0059] Taking the write request as an example, the interface address is: VsWrite or VsWriteAsync; the interface function is: writing data to the sensor; the request parameters are: command: indicating the address information or parameter configuration data for obtaining parameter configuration data, session: indicating the session identifier, size: indicating the expected length of data to be obtained; the response parameters are: interface status code: 0 indicates success, and the rest of the values indicate failure; when the interface address is VsWrite, the response parameters include ret_size: indicating the actual length of data obtained; when the interface address is VsWriteAsync, the response parameters include job_id, indicating the task identifier generated when performing an asynchronous write operation task.
[0060] Taking the disconnect request as an example, the interface address is: VsClose; the interface function is: disconnect the sensor; the request parameter is: session: represents the session identifier; the response parameter is: interface status code: 0 represents success, and the rest represent failure.
[0061] In some implementations, the sensor control request carries the target session identifier and the first control information, so that after receiving the sensor control request, the resource management layer can parse the sensor control request and obtain the target session identifier and the first control information.
[0062] In some implementations, the sensor control request includes a read request, the first control information includes second instruction configuration information, and the second instruction configuration information is used to indicate information corresponding to a size parameter in the read request.
[0063] In some implementations, the sensor control request includes a write request, the first control information includes first instruction configuration information, and the first instruction configuration information is used to indicate information corresponding to command and size parameters in the write request.
[0064] Step S102: The resource management layer determines the first resource information corresponding to the target session identifier from the first mapping information set between the session identifier and the resource information;
[0065] In some implementations, the resource information includes a resource identifier of the sensor, and the resource management layer determines a communication protocol of the sensor associated with the device access event in response to the device access event of the sensor; and generates a resource identifier of the sensor based on the communication protocol of the sensor.
[0066] In some embodiments, the resource information includes target state data of the sensor. The resource management layer generates and sends a first resource query instruction for the target sensor to the bus conversion layer based on the resource identifier of the sensor. The bus conversion layer determines a second resource query instruction for the target sensor based on the first resource query instruction of the target sensor. After receiving the second resource query instruction, the target sensor sends the target state data of the target sensor to the bus conversion layer. The bus conversion layer sends the target state data of the target sensor to the resource management layer.
[0067] In some implementations, the first mapping information set may be implemented in the form of a key-value pair, in the form of a mapping table, or in the form of a dictionary.
[0068] In some implementations, the target session identifier may be queried in the first mapping information set, so that the first resource information associated with the target session identifier may be found in the first mapping information set.
[0069] Step S103: the resource management layer generates a first control instruction based on the first resource information and the first control information using a preset communication protocol, and sends the first control instruction to the bus conversion layer;
[0070] Here, the resource management layer is used to convert different communication protocols used by sensors into a unified communication protocol. The preset communication protocol refers to the communication protocol after the bus conversion layer unifies different communication protocols.
[0071] In some implementations, the first control instruction may be determined based on a SCPI (Standard Commands for Programmable Instruments) instruction, and the preset communication protocol may be a communication protocol that can transmit SCPI instructions.
[0072] Step S104: the bus conversion layer generates a second control instruction based on the first control instruction and using a target communication protocol adapted to the target sensor, and sends the second control instruction to the target sensor.
[0073] In some embodiments, the bus conversion layer encapsulates different communication protocols used by sensors in a preset communication protocol. In this way, after receiving a first control instruction, the bus conversion layer parses the first control instruction according to the preset communication protocol, obtains the first control information in the first control instruction, and generates a second control instruction based on the first control information according to the target communication protocol corresponding to the target sensor.
[0074] In this embodiment, first, the resource management layer parses the received sensor control request to determine the target session identifier of the target sensor and the first control information corresponding to the target sensor; then, based on the first resource information and the first control information corresponding to the target session identifier, a first control instruction is generated using a preset communication protocol, so that the unified method of calling sensors of different communication protocols can be realized through the preset communication protocol; finally, the bus conversion layer converts the first control instruction into a second control instruction based on the target communication protocol adapted to the target sensor, and the unified preset communication protocol is converted into the target communication protocol adapted to the target sensor through the bus conversion layer, so that the management of sensors of different communication protocols can be realized. On the one hand, the method is applied in the upper application development stage, which can reduce the work of upper application developers to adapt different communication protocols of sensors during the application development process, and improve the application development efficiency of upper application developers. On the other hand, the method is applied in the vehicle, and the vehicle can realize the unified management of sensors of different communication protocols through the method, reducing the management cost of the vehicle to the sensor. In addition, the synchronization of data transmission of sensors under different communication protocols can be improved through a unified management method, solving the problem of asynchronous data transmission of sensors caused by different sensor calling methods corresponding to different communication protocols.
[0075] In some embodiments, the bus conversion layer generates a second control instruction based on the first control instruction using a target communication protocol adapted to the target sensor, which may include the following steps S1041 to S1044, wherein:
[0076] Step S1041: the bus conversion layer parses the first control instruction based on a preset communication protocol to determine first resource information and first control information;
[0077] In some implementations, the bus conversion layer parses the first control instruction according to a rule of a preset communication protocol to obtain the first resource information and the first control information in the first control instruction.
[0078] Step S1042: The bus conversion layer determines a target communication protocol adapted to the target sensor based on the first resource information;
[0079] In some implementations, the bus conversion layer stores a mapping set of resource information and communication protocols. The bus conversion layer can search the mapping set based on the resource information to obtain the corresponding target communication protocol.
[0080] In some implementations, the first resource information includes a resource identifier, which is generated based on a communication protocol of the sensor. The bus conversion layer can identify a target communication protocol of a target sensor corresponding to the resource identifier based on the resource identifier.
[0081] Step S1043: The bus conversion layer determines second control information adapted to the target communication protocol based on the first control information;
[0082] In some implementations, the bus conversion layer stores a mapping set of instructions and control information recognizable by the communication protocol of each sensor; the bus sensor determines the instructions recognizable by the target communication protocol based on the content in the first control information, maps and converts the first control information, and generates the second control information.
[0083] Step S1044: The bus conversion layer generates a second control instruction based on the second control information and using the target communication protocol.
[0084] In some implementations, the bus conversion layer generates a second control instruction based on the second control information according to a rule of the target communication protocol.
[0085] In this embodiment, first, the bus conversion layer parses the first control instruction according to the rules of the preset communication protocol to determine the first resource information and the first control information of the target sensor; then, based on the target communication protocol corresponding to the first resource information, the first control information can be converted into second control information recognizable by the target communication protocol. In this way, by converting the control instructions from a unified preset communication protocol to the target communication protocol, the control of sensors with different communication protocols is achieved through a unified communication protocol.
[0086] In some embodiments, the first resource information includes a first resource identifier, and sending the second control instruction to the target sensor may include the following steps S1045 and S1046, wherein:
[0087] Step S1045: the bus conversion layer determines the target session identifier corresponding to the first resource identifier from the second mapping information set between the session identifier and the resource information;
[0088] In some implementations, the second mapping information set may be implemented in the form of a key-value pair, in the form of a mapping table, or in the form of a dictionary.
[0089] In some implementations, the first resource identifier may be queried in the second mapping information set, so that the target session identifier associated with the first resource identifier may be found in the second mapping information set.
[0090] Step S1046: the bus conversion layer sends the second control instruction to the target sensor through the target session channel corresponding to the target session identifier.
[0091] Here, the session channel refers to the channel used to establish and maintain a session during the communication process. It is mainly used to establish a session between two or more communication endpoints and transmit control commands.
[0092] In this embodiment, the bus conversion layer determines the target session identifier corresponding to the first resource identifier from the second mapping information set, so that the second control instruction can be sent to the target sensor through the target session channel corresponding to the target session identifier, thereby realizing the transmission of the second control instruction.
[0093] In some embodiments, the bus conversion layer determines the second control information adapted to the target communication protocol based on the first control information, which may include steps S10431 to S10433, wherein:
[0094] Step S10431: The bus conversion layer determines the target operating system installed in the vehicle control device;
[0095] Here, the operating system is the bridge between computer hardware and software. It controls and manages all hardware and software resources of the computer system, such as CPU, memory, disk, input and output devices, etc., and provides a unified and friendly interface for users and applications.
[0096] In some implementations, the identification of the target operating system may be written into the control system of the vehicle when the control system of the vehicle is installed on the target operating system.
[0097] In some implementations, instruction information of the target operating system may be obtained based on interaction information between the target operating system and the bus conversion layer, and then identification information of the target operating system may be determined based on the instruction information of the target operating system and a preset mapping set between operating systems and instructions.
[0098] Step S10432: The bus conversion layer determines third control information adapted to the target operating system based on the first control information;
[0099] In some implementations, a mapping set of instructions recognizable by the target operating system and the first control information is stored in the bus conversion layer; the bus sensor determines the instructions recognizable by the target operating system based on the content in the first control information, maps and converts the first control information, and generates third control information.
[0100] Step S10433: The bus conversion layer determines second control information adapted to the target communication protocol based on the third control information.
[0101] In some implementations, a mapping set of instructions recognizable by the target communication protocol and third control information is stored in the bus conversion layer; the bus sensor determines the instructions recognizable by the target communication protocol based on the content in the third control information, maps and converts the third control information, and generates second control information.
[0102] In some embodiments, the bus conversion layer determines a fourth control instruction adapted to the target operating system based on the third control information; the bus conversion layer obtains the third control information in the fourth control instruction, and determines second control information adapted to the target communication protocol based on the third control information.
[0103] In this embodiment, first, based on the target operating system carried by the vehicle's control device, the first control information can be converted into third control information recognizable by the target operating system. Through this conversion of control information, the compatibility of the vehicle's control device with different operating systems is achieved, so that the vehicle's control device can be installed on different operating systems without the need to adapt the operating system; then, based on the target communication protocol, the third control information is converted into second control information recognizable by the target communication protocol. Through this conversion of control information, a second control instruction is generated to achieve control of sensors with different communication protocols under different operating systems.
[0104] In some embodiments, before step S101, the sensor control method includes the following steps S105 to S107, wherein:
[0105] Step S105: In response to receiving the sensor connection request, the resource management layer determines first resource information of the target sensor to be connected based on the sensor connection request;
[0106] Here, the sensor connection request is used to establish a session channel between the target sensor and the bus conversion layer.
[0107] In some implementations, the resource manager parses the sensor connection request and obtains the first resource information in the sensor connection request.
[0108] In some implementations, after parsing the sensor connection request, first connection information in the sensor connection request may also be acquired.
[0109] In some embodiments, the interface address of the sensor connection request is: Vsopen; the interface function is: open the sensor device resources and communicate with the sensor; the request parameters are: rsrc_name: represents the resource information of the sensor, access_mode: represents the resource access lock mode of the sensor; timeout: represents the timeout value session identifier of the expected connection operation; the response parameters are: session: represents the session identifier; interface status code: 0 represents success, and the rest of the values represent failure. Among them, access_mode is one of VS_NO_LOCK (no lock), VS_EXCLUSIVE_LOCK (exclusive lock) and VS_NON_EXCLUSIVE_LOCK (shared lock). The lock-free mode means that access to the sensor does not require any form of locking mechanism to protect; the exclusive lock mode means that only one task is allowed to access the sensor; the shared lock mode means that multiple tasks can access the sensor at the same time, but when the resource is locked, the task is not allowed to write to the sensor.
[0110] Step S106: The resource management layer generates a first connection instruction based on the first resource information by using a preset communication protocol, and sends the first connection instruction to the bus conversion layer;
[0111] In some implementations, the resource management layer generates the first connection instruction based on the first resource information according to a rule of a preset communication protocol.
[0112] Step S107: The bus conversion layer generates a second connection instruction based on the first connection instruction and using a target communication protocol adapted to the target sensor, and sends the second connection instruction to the target sensor to establish a target session channel for data transmission with the target sensor.
[0113] In some embodiments, the bus conversion layer encapsulates different communication protocols used by sensors in a preset communication protocol. In this way, after receiving a first connection instruction, the bus conversion layer parses the first connection instruction according to the preset communication protocol, obtains the first connection information in the first connection instruction, and generates a second connection instruction based on the first connection information according to the target communication protocol corresponding to the target sensor.
[0114] In this embodiment, first, the resource management layer parses the received sensor connection request to determine the first resource information of the target sensor; then, based on the first resource information corresponding to the target session identifier, a first connection instruction is generated using a preset communication protocol, so that sensors with different communication protocols can be connected in a unified manner through the preset communication protocol; finally, the unified preset communication protocol is converted into a target communication protocol adapted by the target sensor through the bus conversion layer, so that sensors with different communication protocols can be connected. In addition, the target session identifier generated by the sensor connection request is used as an input parameter of the sensor control request to associate with the target sensor based on the target session identifier, so that the vehicle control device completes the control operation of the target sensor.
[0115] In some embodiments, after step S107, the following steps S108 to S110 may also be included, wherein:
[0116] Step S108: In response to the target session channel being successfully established, the bus conversion layer maps the target session identifier and the first resource information and stores them in the second mapping information set, and sends the target session identifier to the resource management layer;
[0117] Step S109: the resource management layer maps the target session identifier and the first resource information and stores them in a first mapping information set;
[0118] Step S110: the resource management layer generates response information of the sensor connection request based on the target session identifier, and returns the response information of the sensor connection request to the sender of the sensor connection request.
[0119] In some embodiments, the sender of the sensor connection request may be an application interface layer.
[0120] In some implementations, the response information of the sensor connection request includes a target session identifier and an interface status code, wherein the value of the interface status code is 0.
[0121] In this embodiment, when the target session is successfully established, the resource management layer obtains the target session identifier, so that the resource management layer can generate a response message of the sensor connection request based on the target session identifier and return it to the sender of the sensor connection request. In this way, the target session identifier can be obtained through the response message of the sensor connection request, and the target session identifier can be used as an input parameter of the sensor control request to complete the control operation on the target sensor.
[0122] In some embodiments, the sensor control request includes a write request, and the first control information includes first instruction configuration information; based on the sensor control request, determining the first control information corresponding to the target sensor may include the following steps S1011 and S1012, wherein:
[0123] Step S1011: the resource management layer determines a first storage address and a first data length corresponding to the first instruction configuration information based on the write request;
[0124] Here, the write request is used to configure the parameters of the sensor by writing data to the sensor.
[0125] Taking VsWrite as an example, the first storage address is the value corresponding to command in the request parameter, and the first data length is the value corresponding to size in the request parameter.
[0126] In some implementations, the resource management layer parses the write request to obtain the first storage address and the first data length carried in the write request.
[0127] Step S1012: the resource management layer obtains first instruction configuration information from the storage space based on the first storage address and the first data length.
[0128] In some implementations, a storage space corresponding to the first storage address is first determined, and then instruction data of a first data length is read from the storage space, and the read instruction data is the first instruction configuration information.
[0129] In some implementations, after first reading instruction data of a first data length in a storage space corresponding to the first address information, the read instruction data is converted according to a preset communication protocol, and the converted instruction data is the first instruction configuration information.
[0130] In this embodiment, when the sensor control request is a write request, the resource management layer parses the write request to obtain the first storage address and the first data length, so that the first instruction configuration information can be determined based on the first storage address and the first data length, and the first instruction configuration information is written to the target sensor through the second control instruction to realize the parameter configuration of the target sensor.
[0131] In some embodiments, the sensor control request includes a write request, and the first control information includes first instruction configuration information; based on the sensor control request, determining the first control information corresponding to the target sensor may include the following steps S1013 and S1014, wherein:
[0132] Step S1013: the resource management layer determines the second instruction configuration information carried by the write request of the target sensor;
[0133] In some implementations, the resource management layer parses the write request to obtain the second instruction configuration information carried in the write request.
[0134] Taking VsWrite as an example, the second instruction configuration information is the value corresponding to command in the request parameter.
[0135] Step S1014: the resource management layer determines the first instruction configuration information based on the second instruction configuration information.
[0136] In some implementations, when the second instruction configuration information is applicable to a preset communication protocol, the second instruction configuration information is determined as the first instruction configuration information.
[0137] In some implementations, the second instruction configuration information is converted using a preset communication protocol, and the converted second instruction configuration information is determined as the first instruction configuration information.
[0138] In this embodiment, when the sensor control request is a write request, the resource management layer first parses the write request to obtain the second instruction configuration information, and then determines the first instruction configuration information based on the second instruction configuration information, so that the first instruction configuration information is written to the target sensor based on the second control instruction to realize the parameter configuration of the target sensor.
[0139] In some embodiments, the sensor control request includes a read request; after sending the second control instruction to the target sensor, the following steps S111 and S112 may be included, wherein:
[0140] Step S111: the bus conversion layer sends the target sensing data to the resource management layer in response to receiving the target sensing data collected by the target sensor and sent by the target sensor;
[0141] Here, the read request is used to obtain the target sensing data collected by the sensor.
[0142] In some implementations, the target sensor operates based on the second control instruction, obtains the target sensing data collected by the target sensor, generates first response information of the read request based on the target sensing data, and sends it to the resource management layer.
[0143] Step S112: the resource management layer stores the target sensing data into the target area, generates response information of the read request based on the address information of the target area, and returns the response information of the read request to the sender of the read request.
[0144] In some implementations, the sender of the read request may be an application interface layer.
[0145] In some embodiments, after obtaining the first response information of the read request, the resource management layer parses the first response information of the read request, obtains the target sensing data in the first response information of the read request, stores the target sensing data in the target area, and simultaneously obtains the second data length of the target sensing data, and generates a response information of the read request based on the address information and the second data length of the target area, and sends it to the sender of the read request.
[0146] In some implementations, after the application interface layer obtains the first response information of the read request, the address information and the second data length of the target area are obtained, so that the sender of the read request can send a data read request to read the target sensing data in the target area of the resource management layer.
[0147] Taking VsRead as an example, the response information of the read request includes the interface status code and the actual length of the acquired data, wherein the value of the interface status code is 0.
[0148] Taking VsReadAsync as an example, the response information of the read request includes an interface status code and a task identifier corresponding to the read task, where the value of the interface status code is 0.
[0149] In this embodiment, first, the target sensor returns the target sensing data to the bus conversion layer based on the read request, and the bus conversion layer sends the target sensing data to the resource management layer; then, the resource management layer stores the target sensing data, and generates response information of the read request based on the corresponding storage information and sends it to the sender of the read request, so that the sender of the read request can obtain the target perception data based on the response information of the read request, so that the upper-layer application or vehicle corresponding to the sender of the read request can realize the corresponding function based on the target perception data.
[0150] In some embodiments, the sensor control request includes a read request or a write request; after sending the second control instruction to the target sensor, the following steps S113 to S116 may be included, wherein:
[0151] Step S113: In response to receiving the task status query request, the resource management layer determines the target session identifier and target task identifier of the target sensor to be queried based on the task status query request; the target task identifier is used to identify the asynchronous read operation task generated by the target sensor based on the read request, or the asynchronous write operation task generated based on the write request.
[0152] Here, the task status query request is used to query the task status of the read operation task or the task status of the write operation task in the target sensor. An asynchronous read operation task means that after the target sensor generates a read operation task based on a read request, it can continue to execute subsequent codes without waiting for the read operation to be completed. When the read operation is completed, the read result of the read operation task is obtained through a certain mechanism (such as a callback function, event, etc.). An asynchronous write operation task means that after the target sensor generates a write operation task based on a write request, it can continue to execute subsequent codes without waiting for the write operation to be completed. When the write operation is completed, the write result of the write operation task is obtained through a certain mechanism (such as a callback function, event, etc.).
[0153] In some implementations, the resource manager parses the task status query request and obtains the target session identifier and the target task identifier in the task status query request.
[0154] In some implementations, the task status query request may include a read task status query request and a write task status query request.
[0155] In some implementations, the interface address of the write task status query request is: VsWriteStatus; the interface function is: obtain the status of the write operation task; the request parameters are: job_id: indicates the identifier of the operation task, session: indicates the session identifier; the response parameters are: job_status: indicates the status of the operation task, the interface status code: 0 indicates success, and the rest of the values are failures. Among them, when the write operation task is a synchronous task, job_id is a fixed value, and when the write operation is an asynchronous task, job_id is the task identifier of the asynchronous write operation task generated by the target sensor based on the write request, which is a variable value.
[0156] In some implementations, the interface address of the read task status query request is: VsReadStatus; the interface function is: obtain the status of the read operation task; the request parameters are: job_id: indicates the identifier of the operation task, session: indicates the session identifier; the response parameters are: job_status: indicates the status of the operation task, the interface status code: 0 indicates success, and the rest of the values are failures. Among them, when the read operation task is a synchronous task, job_id is a fixed value, and when the read operation is an asynchronous task, job_id is the task identifier of the asynchronous read operation task generated by the target sensor based on the read request, which is a variable value.
[0157] Step S114: the resource management layer determines the first resource information from the first mapping information set;
[0158] Step S115: the resource management layer generates a first query instruction based on the first resource information and the target task identifier using a preset communication protocol, and sends the first query instruction to the bus conversion layer;
[0159] In some implementations, the resource management layer generates a first query instruction based on the first resource information and the target task identifier according to a rule of a preset communication protocol.
[0160] Step S116: The bus conversion layer generates a second query instruction based on the first query instruction and using a target communication protocol adapted to the target sensor, and sends the second query instruction to the target sensor.
[0161] In some embodiments, the bus conversion layer encapsulates different communication protocols used by sensors in a preset communication protocol. In this way, after receiving a first query instruction, the bus conversion layer parses the first query instruction according to the preset communication protocol, obtains the target task identifier in the first query instruction, and based on the target task identifier, generates a second query instruction according to the target communication protocol corresponding to the target sensor.
[0162] In this embodiment, first, the resource management layer parses the received task status query request to determine the first resource information of the target sensor; then, based on the first resource information and the target task identifier, a first query instruction is generated using the preset communication protocol, so that a unified task status query for sensors with different communication protocols can be implemented through the preset communication protocol; finally, the bus conversion layer converts the first query instruction corresponding to the unified preset communication protocol into a second query instruction corresponding to the target communication protocol based on the target communication protocol adapted by the target sensor, so that task status query for sensors with different communication protocols can be implemented.
[0163] In some embodiments, after step S116, the following steps S117 and S118 may be included, wherein:
[0164] Step S117: the bus conversion layer sends the target task status to the resource management layer in response to receiving the target task status of the target task corresponding to the target task identifier sent by the target sensor;
[0165] In some implementations, after acquiring the target task identifier, the target sensor searches for the target task status of the target task corresponding to the target task identifier, and sends the target task status to the resource management layer.
[0166] Step S118: the resource management layer generates response information of the task status query request based on the target task status, and returns the response information of the task status query request to the sender of the task status query request.
[0167] In some implementations, the response information of the task status query request includes the status of the operation task and an interface status code, wherein the value of the interface status code is 0.
[0168] In this embodiment, first, the target sensor returns the target task status to the bus conversion layer based on the task status query request, and the bus conversion layer sends the target task status to the resource management layer; then, the resource management layer sends the target task status to the sender of the task status query request, so that the sender of the task status query request can determine the current target task status of the target task, thereby enabling the upper-layer application or vehicle corresponding to the sender of the task status query request to implement corresponding functions based on the target task status.
[0169] In some embodiments, the sensor control request includes a disconnection request, and after step S110, the following steps S119 and S120 may be included, wherein:
[0170] Step S119: In response to receiving the first response information of the disconnection request sent by the target sensor, the bus conversion layer clears the mapping information between the target session identifier and the first resource information, generates the second response information of the disconnection request, and sends the second response information of the disconnection request to the resource management layer; the first response information is used to indicate that the target sensor has disconnected the target session channel between the bus conversion layer and the target sensor;
[0171] Here, the disconnection request is used to close the session channel and clear the related data associated with the session channel.
[0172] In some embodiments, after receiving the first response information of the connection disconnection request, the bus conversion layer may also clear the session information with the target sensor, wherein the session information may include a temporary storage space for storing the session channel between the bus conversion layer and the target sensor, and the session channel.
[0173] Step S120: the resource management layer clears the mapping information between the target session identifier and the first resource information based on the second response information, generates third response information for the disconnection request, and returns the third response information for the disconnection request to the sender of the disconnection request.
[0174] In some implementations, the sender of the disconnection request may be an application interface layer.
[0175] In some implementations, the third response information includes an interface status code, where the value of the interface status code is 0.
[0176] In this embodiment, first, the bus management layer clears the data content associated with the target sensor in the second mapping set based on the first response information of the connection disconnection request, and then generates a second response information of the connection disconnection request and sends it to the resource management layer. The resource management layer clears the data content associated with the target sensor in the first mapping set. In this way, by clearing the data related to the target session channel, the storage space occupied by redundant data can be reduced, thereby improving the operating efficiency of the vehicle's control device.
[0177] In some embodiments, after generating the first mapping information set, the method for controlling the sensor of the vehicle may further include the following steps S121 to S123, wherein:
[0178] Step S121: the resource management layer determines sensor update information associated with the sensor update event in response to the sensor update event;
[0179] Here, the sensor update event refers to a change in the number of sensors installed in the vehicle.
[0180] In some implementations, the bus management layer obtains sensor update information associated with the sensor update event in response to the sensor update event reported by the sensor, and sends the sensor update information to the resource management layer.
[0181] In some implementations, when the sensor update event represents a newly added sensor, the sensor update information may include a target communication protocol of the newly added sensor.
[0182] In some implementations, when the sensor update event is characterized as removal of a sensor, the sensor update information may include a resource identifier of the removed sensor.
[0183] Step S122: The resource management layer determines resource information of at least one sensor carried by the vehicle based on the sensor update information;
[0184] In some implementations, when the sensor update information includes a target communication protocol, the resource management layer generates a resource identifier of the newly added sensor according to the target communication protocol.
[0185] In some implementations, the resource information of the sensor includes a resource identifier, and the resource management layer obtains the resource identifier of the removed sensor.
[0186] Step S123: the resource management layer updates the first mapping information set when the resource information of the at least one sensor includes the resource information of the target sensor.
[0187] In some implementations, when the resource information of at least one sensor includes a resource identifier of a target sensor, the resource management layer clears the data related to the resource identifier of the target sensor in the first mapping set.
[0188] In some embodiments, after the resource management layer generates a resource identifier of a newly added sensor according to a target communication protocol, the resource management layer determines status data of the newly added sensor based on the resource identifier of the newly added sensor; when the status data of the newly added sensor indicates that the newly added sensor is normal, the resource management layer generates a test instruction for the newly added sensor based on the resource identifier of the newly added sensor; the test instruction is used to verify the function of the newly added sensor.
[0189] In this embodiment, first, the resource management layer responds to the sensor update event and determines the resource information of the sensor update event. Then, when it is determined that the resource information contains the resource information of the target sensor, the resource management layer updates the first mapping information set. In this way, real-time monitoring of at least one sensor carried by the vehicle can be achieved, and the monitoring results can be reflected to the resource management layer in real time, thereby achieving synchronous updating of the resource management layer data, reducing the storage space occupied by redundant data and improving the operating efficiency of the vehicle's control equipment.
[0190] In some embodiments, after acquiring the target state data of the target sensor, the control method of the sensor of the vehicle may further include the following steps S124 to S126, wherein:
[0191] Step S124: the resource management layer determines, in response to receiving the simulated sensor request, fourth control information corresponding to the simulated sensor and second resource information of the simulated sensor based on the simulated sensor request; the simulated sensor is generated based on the target state data of the target sensor;
[0192] Here, the simulated sensor request refers to sending a control instruction or request data request message to the simulated sensor through a specific interface. The simulated sensor is an abstract representation of a real physical sensor, through which various types of real sensors can be simulated to achieve control and operation based on virtual sensor information.
[0193] In some embodiments, after acquiring the target state data, the resource management layer, in response to the triggering of the analog sensor generation task, divides the storage area in the bus conversion layer into a storage space that can be used to store the target state data, virtualizes the storage space into an analog sensor, and generates a resource identifier for the analog sensor.
[0194] Step S125: the resource management layer generates a third control instruction based on the second resource information and the fourth control information by using a preset communication protocol, and sends the third control instruction to the bus conversion layer;
[0195] Step S126: The bus conversion layer determines the response information of the third control instruction corresponding to the analog sensor based on the third control instruction, and sends the response information of the third control instruction to the resource management layer; the response information of the third control instruction is used by the resource management layer to generate response information of the analog sensor request, and returns it to the sender of the analog sensor request.
[0196] In some implementations, the sender of the simulated sensor request may be an application interface layer.
[0197] In some embodiments, the bus conversion layer parses the third control instruction, obtains the fourth control information in the third control instruction, determines the execution result corresponding to the fourth control information, and generates response information of the third control instruction based on the execution result, and sends it to the resource management layer.
[0198] In this embodiment, first, the resource management layer parses the received analog sensor request to determine the third control information corresponding to the analog sensor and the second resource information of the analog sensor; then, based on the second resource information and the fourth control information, a third control instruction is generated using a preset communication protocol, so that the analog sensors of different communication protocols can be called in a unified manner through the preset communication protocol; finally, the bus conversion layer determines the response information of the third control instruction and sends it to the resource management layer, so that the resource management layer can generate response information of the analog sensor request based on the response information of the third control instruction, and send it to the sender of the analog sensor request. In this way, the upper-layer application can receive the response information through the sender of the analog sensor request without the need for a real sensor, thereby realizing the joint debugging of the functions between the upper-layer application and the sensor, reducing the consumption of sensor resources and saving the cost of application development.
[0199] In some embodiments, the sensor control request includes a sensor abnormality clearing request; after sending the second control instruction to the target sensor, the following steps S127 and S128 may be included, wherein:
[0200] Step S127: the bus conversion layer responds to receiving the third response information of the sensor abnormality clearing request sent by the target sensor, and based on the third response information, sends the fourth response information of the sensor abnormality clearing request to the resource management layer;
[0201] Here, the sensor abnormality clearing request is used to clear target state data in the target sensor that causes the target sensor to be abnormal and / or target sensing data of the target sensor.
[0202] Step S128: the resource management layer clears the target state data and / or target sensing data of the target sensor based on the fourth response information, generates fifth response information for clearing the sensor abnormality request, and returns the fifth response information for clearing the sensor abnormality request to the sender of the clearing the sensor abnormality request.
[0203] In some implementations, the sender of the clear sensor abnormality request may be an application interface layer.
[0204] In this embodiment, first, the target sensor clears the abnormal target state data and / or target sensing data in the target sensor based on the sensor abnormality clearing request, so that the target sensor can be restored to a normal state, and then the bus conversion layer generates a fourth response information based on the third response information of the sensor abnormality clearing request, and sends it to the resource management layer, so that the resource management layer can clear the stored abnormal target state data and / or target sensing data, which can reduce the storage space occupied by redundant data and improve the operating efficiency of the vehicle's control device.
[0205] In some embodiments, the sensor control request includes a status query request; after sending the second control instruction to the target sensor, the following steps S129 and S130 may be included, wherein:
[0206] Step S129: the bus conversion layer sends the target state data to the resource management layer in response to receiving the target state data of the target sensor sent by the target sensor;
[0207] Step S130: the resource management layer stores the target status data into the target storage area, generates response information of the status query request based on the address information of the target storage area, and sends the response information of the status query request to the sender of the status query request.
[0208] In some implementations, the sender of the status query request may be an application interface layer.
[0209] In this embodiment, first, the target sensor returns the target status data to the bus conversion layer based on the status query request, and the bus conversion layer sends the target status data to the resource management layer; then, the resource management layer stores the target status data, and generates response information of the status query request based on the corresponding storage information and sends it to the sender of the status query request, so that the sender of the status query request can obtain the target status data based on the response information of the status query request, so that the upper-layer application or vehicle corresponding to the sender of the status query request can realize the corresponding function based on the target status data.
[0210] In some embodiments, the sensor control request includes a device information query request; after sending the second control instruction to the target sensor, the following steps S131 and S132 may be included, wherein:
[0211] Step S131: the bus conversion layer sends the device information to the resource management layer in response to receiving the device information of the target sensor sent by the target sensor;
[0212] Step S132: the resource management layer stores the device information into the target information area, generates response information of the device information query request based on the address information of the target information area, and sends the response information of the device information query request to the sender of the device information query request.
[0213] In some implementations, the sender of the device information query request may be an application interface layer.
[0214] In this embodiment, first, the target sensor returns the device information to the bus conversion layer based on the device information query request, and the bus conversion layer sends the device information to the resource management layer; then, the resource management layer stores the device information, and generates response information of the device information query request based on the corresponding storage information and sends it to the sender of the device information query request, so that the sender of the device information query request can obtain the device information based on the response information of the device information query request, so that the upper-level application or vehicle corresponding to the sender of the device information query request can implement the corresponding function based on the device information.
[0215] In some embodiments, the sensor control request includes a device reset request. After sending the second control instruction to the target sensor, the following steps S133 and S134 may be included, wherein:
[0216] Step S133: In response to receiving the sixth response information of the device reset request, the bus conversion layer generates the seventh response information of the device reset request of the target sensor based on the first response information, and sends the seventh response information of the device reset request to the resource management layer;
[0217] Here, the device reset request is used to reset the target sensor to an initial state.
[0218] Step S134: the resource management layer clears the target state data and the target sensing data of the target sensor based on the seventh response information, generates the eighth response information of the clear sensor request, and sends the third response information of the clear sensor request to the sender of the clear sensor request.
[0219] In some implementations, the sender of the clear sensor request may be an application interface layer.
[0220] In this embodiment, first, the target sensor clears the target status data and target sensing data in the target sensor based on the device reset request, so that the target sensor can be restored to the initial state, and then the bus conversion layer generates the seventh response information of the sixth response request of the device reset request, and sends it to the resource management layer, so that the resource management layer can clear the stored target status data and target sensing data, which can reduce the storage space occupied by redundant data and improve the operating efficiency of the vehicle's control device.
[0221] In some embodiments, the resource information includes a resource identifier. After step S110, the sensor control method includes the following steps S135 to S138, wherein:
[0222] Step S135: the resource management layer determines to generate a target session identifier of a target sensor to be controlled based on the resource information request in response to receiving the resource information request;
[0223] Here, the resource information request is for acquiring information of a sensor mounted on the vehicle and having the same target communication protocol as the target sensor.
[0224] In some embodiments, the interface address of the resource information request is: VsFindRsrc; the interface function is: query the resources whose resource identifier matches the expression, and determine the resource location; the request parameter is: session: represents the session identifier; the response parameter is: expr: represents the expression for generating the resource identifier; access_link: represents the resource identification information of the sensor based on the unified expression; interface status code: 0 represents success, and all other values represent failure.
[0225] Step S136: The resource management layer determines a first resource identifier corresponding to the target session identifier from a first mapping information set between session identifiers and resource information;
[0226] Step S137: the resource management layer determines an expression for generating a first resource identifier, and a resource identifier set corresponding to the expression;
[0227] In some implementations, the corresponding expressions for generating resource identifiers of sensors with different protocols in the resource management layer are different, so the resource identifiers generated based on the same expression and the identifiable communication protocols of the sensors corresponding to the resource identifiers are the same. In this way, the resource identifier information of the sensors mounted on the vehicle with the same communication protocol as the target sensor can be obtained.
[0228] Step S138: The resource management layer generates response information of the resource information request based on the expression and the resource identification set, and sends it to the application interface layer.
[0229] In this embodiment, first, the resource management layer determines an expression for generating a resource identifier of a target sensor associated with the resource information request based on the resource information request, and then obtains the resource identifiers of all sensors generated based on the expression to form a resource identifier set, which is returned to the sender of the resource information request. This method can be used to count the number of sensors with the same communication protocol.
[0230] The following describes the application of the embodiments of the present application in actual scenarios.
[0231] With the development of intelligent connected vehicles, the types of sensors carried by vehicles are increasing, and the bus protocols involved in sensors are also gradually increasing. This application designs a universal vehicle-mounted sensor software management framework that can provide a unified programming interface to be compatible with and control vehicle-mounted sensors of multiple protocols.
[0232] The purpose of this application is to provide a general management framework for vehicle-mounted sensors that manages multiple bus interfaces, so as to realize the use of a unified method to call different sensors, reduce the work of upper-level application developers to individually adapt to different types of drivers for underlying sensors, and improve application development efficiency; in addition, the use of a unified sensor usage method improves the reusability of application layer code; at the same time, because the software management framework of this application is independent of the operating system, it can be compatible with different platforms.
[0233] This application solves the problem of complex management of different bus protocols for different sensors and provides a unified management framework. Figure 2 As shown, it includes a bus conversion layer 1, a resource management layer 2 and an application interface layer 3. The bus conversion layer 1 encapsulates the control logic of different vehicle-mounted sensors in the programmable instrument standard instruction set through a data protocol, so that the control logic of sensors under different protocols, the general operation of sensors and the data transmission of sensors can be implemented using a unified SCPI instruction (i.e., the instructions generated by the preset communication protocol mentioned above), and the sensors mounted on the vehicle are connected to the bus conversion layer through a bus protocol, wherein the bus protocol may include: Ethernet, RS485, UART, RS422, LIN, CAN, FlexRay and MOST. The resource management layer 2 is used to manage all vehicle-mounted sensors based on SCPI instructions, which may include: configuring sensors, performing sensor diagnosis and running the test interface board, checking the connection status of sensors and installing the driver version; in addition, virtual tasks may be created to build virtual sensors based on raw sensor data. The application interface layer 3 is used to provide a unified programming interface, which may include opening sensor device resources, configuring the sensor device resources, writing and reading sensor devices, closing sensor device resources, and handling possible errors of sensor devices.
[0234] Next, each module of the vehicle-mounted sensor general management framework is described in detail.
[0235] 1. Bus conversion layer
[0236] The bus switching layer includes a merge operation bus 11.
[0237] like Figure 3 As shown, the combined operation bus 11 combines the two elements of the sensor operation function set 111 and the SCPI instruction set 112, lists the operation functions of various sensors, and realizes the merging of the operation functions, thereby realizing unified protocol instructions to control all vehicle-mounted sensors. The specific implementation steps are as follows:
[0238] 1. Design the functional operation of sensors. The basic functions of all sensors include: configuration, diagnosis, writing, and reading.
[0239] Here, the basic functions of the sensor are encapsulated as polymorphic functions through functional operation functions, and the resource name of the sensor is bound to the bus type of the sensor, so as to determine the configuration parameter type, write data type, read data parsing format, etc. of the sensor under each protocol according to the bus type.
[0240] 2. The various sensor function operations in step 1 above are mapped to the SCPI instruction set. The mapping relationship is shown in Table 1. The function interface is encapsulated in combination with the SCPI instruction set and resource name.
[0241] Table 1 Operation instruction set mapping table
[0242]
[0243] 2. Resource Management Layer
[0244] The resource management layer is used to manage the sensor status, including the resource manager.
[0245] The resource manager defines the resources of all vehicle-mounted sensors to be managed, and is used to manage, control and allocate the operational functions of sensor resources, including: resource addressing, resource creation and deletion, reading and modifying resource attributes and parallel domain access control.
[0246] The resource manager is similar to the concept of class in object-oriented design method. It is an abstract description of sensor features and functions. It defines special terms for accurate description of sensor resources, including: attribute set, event set and operation set. In this way, when creating a new node on the device tree in the resource management layer, each sensor corresponding to the node needs to inherit the three sensor resource description terms of attribute set, event set and operation set. Taking reading sensor resources as an example, its attribute set includes end string, timeout value and protocol, etc., the event set includes user exit event, and the operation set is used to implement the definition of unified programming interface of application interface layer, which can include sensor reading operation, sensor opening operation, sensor closing operation, writing data to sensor and obtaining sensor writing operation status.
[0247] Among them, the attribute set is shown in Table 2, which lists all the attributes of the sensor resources in the attribute set and lists the data type of each attribute information, including the basic data type as shown in Table 3 and the complex data type as shown in Table 4, where the attribute information may include the sensor number, the performance parameters of the sensor, and the configurable information of the sensor.
[0248] Table 2 Resource attribute table
[0249]
[0250] Table 3 Basic data type mapping table
[0251]
[0252] Table 4 Complex data type mapping table
[0253] Complex Data Types Data Type Description Complex Data Types Data Type Description VsSession Resource Dialogue Channel Type VsRsrcList Resource ID column type VsAccessMode Control access mechanism type VsBuf Data block type VsStatus Return status value type VsPJobId VsJobId pointer type VsPStatus VsStatus pointer type VsJobStatus Operation request status type VsBuf Data block type VsPJobId VsJobId pointer type VsPBuf VsBuf pointer type VsJobStatus Operation request status type
[0254] The resource event associated with the event set (i.e., the sensor update event mentioned above) defines an operating mechanism for notifying the application of an action under certain conditions. The resource event consists of three parts, such as Figure 4 As shown, the basic execution process of resource events is shown:
[0255] 1. Event capture and notification 401: Sense the occurrence of sensor events and contact the dialogue channel;
[0256] 2. Event request and processing 402: According to the event processing mechanism, the upper layer application is informed of the occurrence of the event through the application interface layer, wherein the resource event processing mechanism includes two mechanisms: polling and callback.
[0257] 3. Event response 403: Respond to the event according to the protocol.
[0258] Among them, there are two types of resource event processing mechanisms. One is the polling method: the resource management layer opens a specific event processing mechanism, periodically queries whether a resource event has occurred, and closes the specific event processing mechanism after the event occurs to prevent resource overflow; the other is the callback method: by installing a callback handle to run the event processing mechanism in the program, and writing a corresponding interrupt subroutine, the event types processed by the callback method are mainly divided into: system service requests, hardware trigger signals, and bus terminal signals.
[0259] The operation set includes a series of operations for sensor resources, and each operation is divided into the following items:
[0260] 1. Name: A simple description of the operation function prototype;
[0261] 2. Purpose: briefly describe the corresponding operation function;
[0262] 3. Parameter description: Lists the relevant information of all parameters in the operation, including parameter name, input / output direction, parameter data type and parameter description;
[0263] 4. Return value: The only type of status value returned by resource operations is VsStatus, which includes completion code and error code.
[0264] 5. Description: Give a detailed description of the function of each function and the meaning of its key parameters;
[0265] 6. Related operation items: other related operations that can be referenced;
[0266] 7. Implementation requirements: some conditions and notes that should be met when operating events.
[0267] In this way, a unified programming interface of the application interface layer can be implemented by encapsulating the above operation set.
[0268] Based on the resource manager, you can achieve Figure 5 The functions shown include device identification 21, configuration parameters 22, performing diagnostics 23, testing panels 24, and creating virtual sensors 25. The functions of the resource management layer are described in detail below:
[0269] 1. Device identification: First, the sensor plug-in status is obtained by using interrupt triggering to automatically identify the sensor's connection status; then, the bus type (i.e., target communication protocol) to which the sensor is connected is determined by matching bus resources according to the device tree management, and a resource name (i.e., resource identifier) is generated and updated into the connected device management list; finally, the sensor driver type, sensor number, and other information are queried using the corresponding SCPI command (i.e., the first control command) through the corresponding resource name.
[0270] 2. Configure parameters: Configure parameters according to the selected resource name. First, configure the parameters through SCPI commands, and then use SCPI commands to query the configuration parameters to confirm whether the configuration is effective.
[0271] Here, the corresponding SCPI instruction can be generated by the operation instruction set corresponding to Table 4 above, and sent to the bus conversion layer, so that the SCPI instruction is converted into an instruction recognizable by the sensor through the bus conversion layer and sent to the sensor.
[0272] 3. Execute diagnosis: Use SCPI commands to diagnose whether the sensor corresponding to the selected resource name is normal.
[0273] Here, after obtaining the status data of the sensor, the status data of the sensor is analyzed to determine whether the sensor operates normally.
[0274] 4. Test panel: refers to the functional test of the sensor. According to the selected resource name, you can build a test task, automatically obtain the SCPI instruction set for collecting default configuration sensor data, and perform sensor smoke test.
[0275] 5. Create a virtual sensor (i.e. simulated sensor): Create a virtual sensor resource name and specify the local sensor raw data of the corresponding bus type for parsing. The upper-layer application can develop and debug based on the resource name of the virtual sensor. Read the raw data of the sensor.
[0276] Here, sensor raw data refers to the data of physical sensors.
[0277] It should be noted that the device tree maintained by the resource management layer includes physical sensor nodes and virtual sensor nodes. After the virtual sensor is successfully created, the node information of the virtual sensor will be added to the device tree maintained by the resource management layer, and the resource identifier of the virtual sensor will be generated. In this way, after the node of the virtual sensor is created, the device format of the corresponding bus type can be configured, and the data is sent according to the attributes of the original data by default.
[0278] 3. Application Interface Layer
[0279] The application interface layer is designed to be able to use a unified programming interface to operate different vehicle-mounted sensors, such as Figure 6 As shown, the functions that can be implemented by the application interface layer include: opening resources 31, configuring parameters 32, writing instructions 33, receiving data 34, closing resources 35, and error checking 36.
[0280] In some embodiments, opening resource 31 may be implemented by a VsOpen instruction provided in the application interface layer. Configuration parameters 32 and write instruction 33 may be implemented by a VsWrite instruction or a VsWriteAsync instruction. Receiving data 34 may be implemented by a VsRead instruction or a VsReadAsync instruction. Closing resource may be implemented by a VsClose instruction. Error checking 36 may be implemented by a VsRead instruction or a VsReadAsync instruction.
[0281] For example, the application scenarios of the above application interface layer may include the following:
[0282] In some embodiments, the upper-level application developer can first open the resource through the VsOpen instruction provided in the application interface layer, and then configure the parameters of the sensor after establishing a channel with the sensor. At this time, the parameter configuration task of the sensor can be triggered through the VsWrite instruction or the VsWriteAsync instruction to complete the parameter configuration of the sensor. After completing the parameter configuration of the sensor, the VsWriteStatus instruction can be used to determine whether the parameter configuration of the sensor is successful.
[0283] In some implementations, the upper-level application developer may first open resources through the VsOpen instruction provided in the application interface layer, and then, after establishing a channel with the sensor, trigger the task of acquiring the sensing data collected by the sensor through the VsRead instruction or the VsReadAsync instruction. When the sensor data reading is completed, the VsReadStatus instruction may be used to determine the execution result of the sensor data task. Finally, after completing all operations on the sensor, the VsClose instruction may be used to close the dialogue channel with the sensor and release related resources.
[0284] The following describes the interface instructions provided by the application interface layer:
[0285] 1. VsFindRsrc(session, expr, access_link)
[0286] Purpose: Open sensor device resources and communicate with sensors;
[0287] Parameter Description:
[0288] Session: Enter the unique identifier of the VsSession resource operation dialogue channel. A new session will be generated each time a dialogue channel is opened.
[0289] expr: Outputs the expression used by VsString to match resource names;
[0290] access_link: Outputs the VsRsrcList resource location list;
[0291] Return value: 0 means success, and other values mean failure;
[0292] Description: This operation is used to query resources whose names match the expression and determine the resource location;
[0293] Related items: See VsOpen();
[0294] Implementation requirements: The output parameter access_link should contain the number of all matching resources;
[0295] 2. VsOpen(rsrc_name, access_mode, timeout, session)
[0296] Purpose: Open specific sensor device resources and communicate with the sensor;
[0297] Parameter Description:
[0298] rsrc_name: Enter the unique symbolic name of the VsString resource, open the parameters corresponding to the resource of the specific sensor, create a dialogue channel, and generate a session;
[0299] access_mode: Input VsAccessMode resource access lock mode, the access lock modes include: VS_NO_LOCK, VS_EXCLUSIVE_LOCK and VS_NON_EXCLUSIVE_LOCK;
[0300] timeout: Enter the VsUInt32 operation timeout value;
[0301] session: Outputs the unique identifier of the VsPSession resource operation dialogue channel;
[0302] Return value: 0 means success, and other values mean failure;
[0303] Description: This operation is used to open a dialog channel for a specific resource. The returned dialog channel unique identifier can be used as a software handle for subsequent operations.
[0304] Related items: See VsClose();
[0305] Implementation requirements: No requirements;
[0306] 3. VsClose(session)
[0307] Purpose: Close the specified task;
[0308] Parameter Description:
[0309] session: Enter the unique identifier of the VsSession resource operation dialogue channel;
[0310] Return value: 0 means success, and other values mean failure;
[0311] Description: This operation is used to close the dialog channel associated with the sensor resource and release the memory;
[0312] Related items: See VsOpen();
[0313] Implementation requirements: When a conversation channel executes the VsClose() operation, it should not only close the channel, but also release the data of all channels;
[0314] 4. VsWrite(session, command, size, ret_size)
[0315] Purpose: write data to the sensor;
[0316] Parameter Description:
[0317] session: Enter the unique identifier of the VsSession operation dialogue channel;
[0318] command: input VsBuf to write data to the sensor SCPI command data block location;
[0319] size: Input VsUint32 input instruction data bytes;
[0320] ret_size: Output VsPUint32 the number of bytes of instruction data actually transmitted;
[0321] Return value: 0 means success, and other values mean failure;
[0322] Description: This operation writes the data in commond to the device. Any write resource channel can only log one synchronous write operation;
[0323] Related items: See VsRead();
[0324] Implementation requirements: None
[0325] 5. VsWriteAsync(session, command, size, job_id)
[0326] Purpose: Asynchronously write data to the sensor;
[0327] Parameter Description:
[0328] session: Enter the unique identifier of the VsSession operation dialogue channel;
[0329] command: input VsBuf to write data to the sensor SCPI command data block location;
[0330] size: Input VsUint32 input instruction data bytes;
[0331] job_id: Output VsPjobId asynchronous operation job identifier;
[0332] Return value: 0 means success, and other values mean failure;
[0333] Description: This operation writes the data in commond to the device. Any write resource channel can log multiple asynchronous write operations for queue processing.
[0334] Related items: See VsReadAsync();
[0335] Implementation requirements: None
[0336] 6. VsWriteStatus(session, job_id, job_status)
[0337] Purpose: Get the status of the write operation;
[0338] Parameter Description:
[0339] Session: Enter the unique identifier of the VsSession operation dialogue channel;
[0340] job_id: Enter VsJobId write operation job identifier;
[0341] job_status: outputs VsPJobStatus write operation status;
[0342] Return value: 0 means success, and other values mean failure;
[0343] Description: When the operation is synchronous, the identifier is uniquely determined, which is VS_SYNC; when the operation is asynchronous, the identifier is the output parameter of the operation;
[0344] Related items: See VsReadStatus();
[0345] Implementation requirements: None;
[0346] 7. VsRead (session, buf, size, ret_size)
[0347] Purpose: Read data from sensors;
[0348] Parameter Description:
[0349] session: Enter the unique identifier of the VsSession operation dialogue channel;
[0350] buf: Output VsBuf sensor data block location;
[0351] size: input VsUInt32 the number of bytes of data to be read;
[0352] ret_size: Output VsUInt32 the number of bytes of data actually obtained;
[0353] Return value: 0 means success, and other values mean failure;
[0354] Description: This operation puts the value read from the device into buf. Any read resource channel can only log one synchronous read operation.
[0355] Related items: See VsWrite();
[0356] Implementation requirements: The read operation is considered completed when one or more of the following three conditions are met: the end mark is read, the specific terminator is read, and the number of bytes read is the same as the required number of bytes;
[0357] 8. VsReadAsync(session, buf, size, job_id)
[0358] Purpose: Read data from sensors;
[0359] Parameter Description:
[0360] session: Enter the unique identifier of the VsSession operation dialogue channel;
[0361] buf: Output VsBuf to get the sensor data block location;
[0362] size: input VsUInt32 the number of bytes of data to be read;
[0363] job_id: Output VsPJobId asynchronous read operation job identifier;
[0364] Return value: 0 means success, and other values mean failure;
[0365] Description: This operation puts the value read from the device into buf. Any read resource channel can log multiple synchronous read operations for queue processing;
[0366] Related: See VsWriteAsync():
[0367] Implementation requirements: None;
[0368] 9. VsReadStatus(session, job_id, job_status)
[0369] Purpose: Get the read operation status;
[0370] Parameter Description:
[0371] session: Enter the unique identifier of the VsSession operation dialogue channel;
[0372] job_id: Enter VsJobId to read the job identifier of the operation (i.e. the target task identifier);
[0373] job_status: outputs the VsPJobStatus read operation status;
[0374] Return value: 0 means success, and other values mean failure;
[0375] Description: When the read operation is synchronous, the identifier is uniquely determined, which is VS_SYNC; when the read operation is asynchronous, the identifier is the output parameter of the read operation;
[0376] Related items: See VsWriteStatus();
[0377] Implementation requirements: None;
[0378] It should be noted that VsReadStatus and VsWriteStatus are implemented as the above-mentioned task status query request; VsOpen is implemented as the above-mentioned sensor connection request; VsClose(session) is implemented as the above-mentioned connection disconnection request; VsWrite and VsWriteAsync are implemented as the above-mentioned write request; VsRead and VsReadAsync are implemented as the above-mentioned read request; Session is implemented as the target channel identifier; job_id is implemented as the above-mentioned target task identifier; rsrc_name is implemented as the above-mentioned resource information.
[0379] The bottom-up structural model of the present application provides a unified control function set. On the one hand, for the design of simple tasks, the present application provides a simple and easy-to-use control function set, which is quite simple in application form. On the other hand, for the components of complex systems, the present application is compatible with the control functions and resource management functions of different sensors, and has the characteristics of ease of use, scalability, compatibility, etc.
[0380] An embodiment of the present application also proposes an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements some or all of the steps in the above method when executing the program.
[0381] The embodiment of the present application also proposes a computer-readable storage medium on which a computer program is stored, and when the computer program is executed by a processor, some or all of the steps in the above method are implemented. The computer-readable storage medium can be transient or non-transient.
[0382] The embodiment of the present application also proposes a computer program, including a computer-readable code. When the computer-readable code runs in an electronic device, a processor in the computer device executes some or all of the steps for implementing the above method.
[0383] The present application also proposes a computer program product, which includes a computer program or instructions. When the computer program or instructions are executed by a processor, some or all of the steps in the above method are implemented. The computer program product can be implemented specifically by hardware, software or a combination thereof. In some embodiments, the computer program product is specifically embodied as a computer storage medium, and in other embodiments, the computer program product is specifically embodied as a software product, such as a software development kit (SDK), etc.
[0384] An embodiment of the present application also proposes a vehicle, comprising the above-mentioned electronic device.
[0385] It should be noted here that the description of the various embodiments above tends to emphasize the differences between the various embodiments, and the same or similar aspects can be referenced to each other. The description of the above device, storage medium, computer program and computer program product embodiments is similar to the description of the above method embodiment, and has similar beneficial effects as the method embodiment. For technical details not disclosed in the embodiments of the device, storage medium, computer program and computer program product of this application, please refer to the description of the method embodiment of this application for understanding.
[0386] It should be noted that the embodiment of the present application provides a hardware entity of an electronic device, such as Figure 7As shown, the hardware entity of the electronic device 700 includes: a processor 701 generally controls the overall operation of the electronic device 700. A communication interface 702 can enable the electronic device to communicate with other terminals or servers through a network. The memory 703 is configured to store instructions and applications executable by the processor 701, and can also cache data to be processed or processed by the processor 701 and each module in the electronic device 700 (for example, image data, audio data, voice communication data, and video communication data), which can be implemented by flash memory (FLASH) or random access memory (Random Access Memory, RAM). Data transmission can be performed between the processor 701, the communication interface 702 and the memory 703 through a bus 704.
[0387] It should be understood that "one embodiment" or "an embodiment" mentioned throughout the specification means that specific features, structures or characteristics related to the embodiment are included in at least one embodiment of the present application. Therefore, "in one embodiment" or "in an embodiment" appearing throughout the specification does not necessarily refer to the same embodiment. In addition, these specific features, structures or characteristics can be combined in one or more embodiments in any suitable manner. It should be understood that in various embodiments of the present application, the size of the serial number of each step / process mentioned above does not mean the order of execution, and the execution order of each step / process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiment of the present application. The serial numbers of the embodiments of the present application mentioned above are for description only and do not represent the advantages and disadvantages of the embodiments.
[0388] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or device including the element.
[0389] In the several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. The device embodiments described above are only schematic. For example, the division of units is only a logical function division. There may be other division methods in actual implementation, such as: multiple units or components can be combined, or can be integrated into another system, or some features can be ignored or not executed. In addition, the coupling, direct coupling, or communication connection between the components shown or discussed can be through some interfaces, and the indirect coupling or communication connection of devices or units can be electrical, mechanical or other forms.
[0390] The units described above as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units; 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 scheme of this embodiment. In addition, the functional units in the embodiments of the present application may be all integrated into one processing unit, or each unit may be separately used as a unit, or two or more units may be integrated into one unit; the above integrated units may be implemented in the form of hardware or in the form of hardware plus software functional units.
[0391] A person skilled in the art can understand that all or part of the steps of implementing the above method embodiment can be completed by hardware related to program instructions, and the aforementioned program can be stored in a computer-readable storage medium. When the program is executed, it executes the steps of the above method embodiment; and the aforementioned storage medium includes: mobile storage devices, read-only memories (ROM), magnetic disks or optical disks, etc., various media that can store program codes.
[0392] Alternatively, if the above-mentioned integrated unit of the present application is implemented in the form of a software function module and sold or used as an independent product, it can also be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application can essentially or in other words, the part that contributes to the relevant technology can be embodied in the form of a software product, which is stored in a storage medium and includes a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the methods of each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as mobile storage devices, ROMs, magnetic disks, or optical disks.
[0393] The above embodiments are only preferred embodiments for fully illustrating the present application, and the protection scope of the present application is not limited thereto. Any equivalent substitution or change made by a person skilled in the art based on the present application is within the protection scope of the present application.
Claims
1. A sensor control method for a vehicle, characterized in that: A control device applied to the vehicle, the control device comprising a resource management layer and a bus conversion layer, the method comprising: In response to receiving the sensor control request, the resource management layer determines, based on the sensor control request, a target session identifier of a target sensor to be controlled in the vehicle and first control information corresponding to the target sensor; the target session identifier is used to identify a target session channel corresponding to the target sensor; the target session channel is used for data transmission between the bus conversion layer and the target sensor; The resource management layer determines, from a first mapping information set between session identifiers and resource information, first resource information corresponding to the target session identifier; The resource management layer generates a first control instruction based on the first resource information and the first control information using a preset communication protocol, and sends the first control instruction to the bus conversion layer; The bus conversion layer generates a second control instruction based on the first control instruction and using a target communication protocol adapted to the target sensor, and sends the second control instruction to the target sensor.
2. The method according to claim 1, characterized in that: The bus conversion layer generates a second control instruction based on the first control instruction and using a target communication protocol adapted to the target sensor, including: The bus conversion layer parses the first control instruction based on the preset communication protocol to determine the first resource information and the first control information; The bus conversion layer determines a target communication protocol adapted to the target sensor based on the first resource information; The bus conversion layer determines, based on the first control information, second control information adapted to the target communication protocol; The bus conversion layer generates a second control instruction based on the second control information and using the target communication protocol.
3. The method according to claim 2, characterized in that: The first resource information includes a first resource identifier, The sending the second control instruction to the target sensor includes: The bus conversion layer determines a target session identifier corresponding to the first resource identifier from a second mapping information set between session identifiers and resource information; The bus conversion layer sends the second control instruction to the target sensor through a target session channel corresponding to the target session identifier.
4. The method according to claim 2, characterized in that: The bus conversion layer determines, based on the first control information, second control information adapted to the target communication protocol, including: The bus conversion layer determines a target operating system carried by a control device of the vehicle; The bus conversion layer determines, based on the first control information, third control information adapted to the target operating system; The bus conversion layer determines second control information adapted to the target communication protocol based on the third control information.
5. The method according to claim 1, characterized in that: The method further comprises: The resource management layer determines, in response to receiving the sensor connection request, first resource information of the target sensor to be connected based on the sensor connection request; The resource management layer generates a first connection instruction based on the first resource information by using a preset communication protocol, and sends the first connection instruction to the bus conversion layer; The bus conversion layer generates a second connection instruction based on the first connection instruction and using a target communication protocol adapted to the target sensor, and sends the second connection instruction to the target sensor to establish the target session channel for data transmission with the target sensor.
6. The method according to claim 5, characterized in that: The method further comprises: In response to the target session channel being successfully established, the bus conversion layer maps the target session identifier and the first resource information and stores them in a second mapping information set, and sends the target session identifier to the resource management layer; The resource management layer maps and stores the target session identifier and the first resource information into the first mapping information set; The resource management layer generates response information of the sensor connection request based on the target session identifier, and returns the response information of the sensor connection request to the sender of the sensor connection request.
7. The method according to any one of claims 1 to 6, characterized in that: The sensor control request includes a write request, and the first control information includes first instruction configuration information; The determining, based on the sensor control request, first control information corresponding to the target sensor includes: The resource management layer determines, based on the write request, a first storage address and a first data length corresponding to the first instruction configuration information; The resource management layer obtains the first instruction configuration information from a storage space based on the first storage address and the first data length.
8. The method according to any one of claims 1 to 6, characterized in that: The sensor control request includes a write request, and the first control information includes first instruction configuration information; The determining, based on the sensor control request, first control information corresponding to the target sensor includes: The resource management layer determines second instruction configuration information carried by the write request of the target sensor; The resource management layer determines the first instruction configuration information based on the second instruction configuration information.
9. The method according to any one of claims 1 to 6, characterized in that: The sensor control request includes a read request; After sending the second control instruction to the target sensor, the method further includes: The bus conversion layer sends the target sensing data collected by the target sensor to the resource management layer in response to receiving the target sensing data sent by the target sensor; The resource management layer stores the target sensing data into a target area, generates response information of the read request based on address information of the target area, and returns the response information of the read request to a sender of the read request.
10. The method according to any one of claims 1 to 6, characterized in that: The sensor control request includes a read request or a write request; after sending the second control instruction to the target sensor, the method further includes: The resource management layer determines, in response to receiving the task status query request, a target session identifier and a target task identifier of the target sensor to be queried based on the task status query request; the target task identifier is used to identify an asynchronous read operation task generated by the target sensor based on the read request, or an asynchronous write operation task generated based on the write request; The resource management layer determines the first resource information from the first mapping information set; The resource management layer generates a first query instruction based on the first resource information and the target task identifier using a preset communication protocol, and sends the first query instruction to the bus conversion layer; The bus conversion layer generates a second query instruction based on the first query instruction and using a target communication protocol adapted to the target sensor, and sends the second query instruction to the target sensor.
11. The method according to claim 10, characterized in that: The method further comprises: The bus conversion layer sends the target task state to the resource management layer in response to receiving the target task state of the target task corresponding to the target task identifier sent by the target sensor; The resource management layer generates response information of the task status query request based on the target task status, and returns the response information of the task status query request to the sender of the task status query request.
12. The method according to any one of claims 1 to 6, characterized in that: The sensor control request includes a disconnection request, and the method further includes: In response to receiving the first response information of the disconnection request sent by the target sensor, the bus conversion layer clears the mapping information between the target session identifier and the first resource information, generates the second response information of the disconnection request, and sends the second response information of the disconnection request to the resource management layer; the first response information is used to indicate that the target sensor has disconnected the target session channel between the bus conversion layer and the target sensor; Based on the second response information, the resource management layer clears the mapping information between the target session identifier and the first resource information, generates third response information for the connection disconnection request, and returns the third response information for the connection disconnection request to the sender of the connection disconnection request.
13. The method according to any one of claims 1 to 6, characterized in that: The method further comprises: The resource management layer determines, in response to a sensor update event, sensor update information associated with the sensor update event; The resource management layer determines resource information of at least one sensor carried by the vehicle based on the sensor update information; The resource management layer updates the first mapping information set when the resource information of the at least one sensor includes the resource information of the target sensor.
14. The method according to any one of claims 1 to 6, characterized in that: The method further comprises: The resource management layer determines, in response to receiving a simulated sensor request, fourth control information corresponding to a simulated sensor and second resource information of the simulated sensor based on the simulated sensor request; the simulated sensor is generated based on target state data of the target sensor; The resource management layer generates a third control instruction based on the second resource information and the fourth control information by using the preset communication protocol, and sends the third control instruction to the bus conversion layer; Based on the third control instruction, the bus conversion layer determines the response information of the third control instruction corresponding to the analog sensor, and sends the response information of the third control instruction to the resource management layer; the response information of the third control instruction is used by the resource management layer to generate response information of the analog sensor request, and returns it to the sender of the analog sensor request.
15. An electronic device comprising a memory and a processor, wherein the memory stores a computer program that can be run on the processor, characterized in that: When the processor executes the program, the steps in the method according to any one of claims 1 to 14 are implemented.
16. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 14 are implemented.
17. A computer program product comprising a computer program or instructions, characterized in that When the computer program or instruction is executed by a processor, the steps in the method according to any one of claims 1 to 14 are implemented.
18. A vehicle, characterized in that: Comprising the electronic device as claimed in claim 15.
Citation Information
Patent Citations
Data exchange model based on IEC 61850 client side / server
CN104156448A
Heterogeneous equipment centralized management method, device and system, equipment and medium
CN109995720A
Communication protocol conversion device and method
CN112953880A
Software defined message processing method and device for protocol conversion
CN117119073A
Equipment access method and system based on protocol conversion
CN119094626A