Sensor control method, device, medium, product and vehicle of vehicle
Through the resource management layer and bus conversion layer methods, unified management and control of sensors with different communication protocols in intelligent connected vehicles are achieved, solving the problems of high sensor management costs and asynchronous data transmission, improving development efficiency and data synchronization, and supporting multi-operating system compatibility.
Patent Information
- Application Number
- CN202510094006.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-21
- Publication Date
- 2025-10-10
- Estimated Expiration
- 2045-01-21
AI Technical Summary
In intelligent connected vehicles, the diverse communication protocols of sensors lead to inefficient upper-layer application development and high sensor management costs. In addition, differences in sensor management under different communication protocols lead to asynchronous data transmission.
By adopting the resource management layer and bus conversion layer method, unified management and control of sensors with different communication protocols are achieved through conversion between a unified preset communication protocol and the target communication protocol, including generating control instructions and converting them into the communication protocol adapted to the target sensor through the bus conversion layer.
It improves the efficiency of upper-layer application development, reduces sensor management costs, achieves data transmission synchronization of sensors with different communication protocols, supports compatibility with different operating systems, and reduces redundant data occupation and sensor resource consumption.
Smart Images

Figure CN119922213B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of automotive technology, and in particular to a vehicle sensor control method, device, medium, product and 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 upper-level application development time, 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 manage and 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 vehicle's sensor management cost. 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 objectives, the technical solutions adopted in this application are as follows:
[0005] A vehicle sensor control method is applied to a control device of the vehicle, the control device including a resource management layer and a bus conversion layer, the method comprising: the resource management layer, in response to receiving a sensor control request, 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 the session identifier and the resource information, the 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 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, thereby enabling unified calling of sensors with different communication protocols 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. The bus conversion layer converts the unified preset communication protocol into the target communication protocol adapted to the target sensor, thereby enabling management of sensors with different communication protocols. On the one hand, applying this method in the upper-layer application development stage can reduce the work of upper-layer application developers in adapting to different communication protocols during application development, thereby improving the application development efficiency of upper-layer application developers. On the other hand, applying this method in a vehicle can enable unified management of sensors with different communication protocols through this method, thereby reducing the management cost of the vehicle for sensors. In addition, the unified management method can also improve the synchronization of data transmission of sensors under different communication protocols, thereby solving the problem of asynchronous sensor data transmission 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 the 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; and 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 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 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 that can be recognized 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.
[0009] Furthermore, 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 the 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 the 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 second control information adapted to the target communication protocol based on the third control information.
[0012] According to the above-mentioned technical means, 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 that can be recognized 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 that can be recognized by the target communication protocol. Through this conversion of control information, a second control instruction is generated to realize the 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 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 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 approach, 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, thereby enabling unified connection of sensors using different communication protocols through the preset communication protocol. Finally, the bus conversion layer converts the unified preset communication protocol into a target communication protocol adapted for the target sensor, thereby enabling connection of sensors using different communication protocols. Furthermore, the target session identifier generated by the sensor connection request is used as an input parameter of the sensor control request to associate the target sensor with the target session identifier, enabling the vehicle control device to complete control operations on the target sensor.
[0015] Furthermore, the method also includes: in response to the successful establishment of the target session channel, the bus conversion layer stores the target session identifier and the first resource information mapping in the second mapping information set, and sends the target session identifier to the resource management layer; the resource management layer stores the target session identifier and the first resource information mapping 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 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 of 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 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 technical means, when the sensor control request is a write request, the resource management layer parses the write request and obtains the first storage address and the first data length. In this way, the first instruction configuration information can be determined based on the first storage address and the first data length. In this way, 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] Furthermore, 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 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. In this way, 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] Furthermore, 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 a response information of the read request based on the corresponding storage information and sends it to the sender of the read request. In this way, 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.
[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 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-layer 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] Furthermore, the sensor control request includes a disconnection request, and the method also includes: the bus conversion layer, in response to receiving a first response information of the disconnection request sent by the target sensor, clears the mapping information between the target session identifier and the first resource information, generates 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; 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 disconnection request, and returns the third response information of the disconnection request to the sender of the 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 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, 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 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 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.
[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 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, the preset communication protocol is used to generate a third control instruction, so that the preset communication protocol can be used to call analog sensors of different communication protocols in a unified manner; 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 when the processor executes the program, some or all of the steps in the above method are implemented.
[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, which implement some or all of the steps in the above method when executed by a processor.
[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, the 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 that can be recognized 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, and realizing the 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 the 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 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.
[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 This is a schematic diagram of the implementation of a vehicle sensor management software framework proposed in this application Figure 1 ;
[0046] Figure 3 This is a schematic diagram of the implementation of a vehicle sensor management software framework proposed in this application Figure 2 ;
[0047] Figure 4 This is a schematic diagram of the implementation of a vehicle sensor management software framework proposed in this application Figure 3 ;
[0048] Figure 5 This is a schematic diagram of the implementation of a vehicle sensor management software framework proposed in this application Figure 4 ;
[0049] Figure 6 This is a schematic diagram of the implementation of a vehicle sensor management software framework proposed in this application Figure 5 ;
[0050] Figure 7 This is a hardware entity diagram of a computer device proposed in this application. DETAILED DESCRIPTION
[0051] The following will describe the embodiments of the present application with reference to the accompanying drawings and preferred embodiments. Those skilled in the art can easily understand the 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 embodiments, 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 the purpose of illustrating the present application and are not intended to limit 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. Therefore, the illustrations only show components related to the present application and are not drawn according to the number, shape and size of components in actual implementation. In actual implementation, the type, quantity and proportion of each component can be changed at will, and the component layout type 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. The 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, 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;
[0055] Here, the resource management layer manages all sensors based on a unified protocol. A sensor control request is a message that sends control instructions or data to a sensor through a specific interface. A sensor is a device that converts non-electrical parameters into measurable electrical signals.
[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 sensor data is stored; the interface status code is: 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 a 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 data length; the response parameters are: interface status code: 0 indicates success, and all other 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] Take the disconnect request as an example. The interface address is VsClose. The interface function is to disconnect the sensor. The request parameter is session, which indicates the session identifier. The response parameter is the interface status code: 0 indicates success, and all other values indicate failure.
[0061] In some implementations, the sensor control request carries the target session identifier and the first control information, so that the resource management layer can parse the sensor control request after receiving the sensor control request to 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 embodiments, the sensor control request comprises a write request, and the first control information comprises first instruction configuration information, the first instruction configuration information being used to indicate information corresponding to command and size parameters in the write request.
[0064] Step S102: The resource management layer determines first resource information corresponding to the target session identifier from the first mapping information set between session identifiers and resource information.
[0065] In some embodiments, the resource information comprises 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 the resource identifier of the sensor based on the communication protocol of the sensor.
[0066] In some embodiments, the resource information comprises target state data of the sensor, the resource management layer generates and sends a first resource query instruction of 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 of the target sensor based on the first resource query instruction of the target sensor; the target sensor sends the target state data of the target sensor to the bus conversion layer after receiving the second resource query instruction; and the bus conversion layer sends the target state data of the target sensor to the resource management layer.
[0067] In some embodiments, the first mapping information set can be implemented in the form of key-value pairs, in the form of a mapping table, or in the form of a dictionary.
[0068] In some embodiments, the target session identifier can be queried in the first mapping information set, so that the first resource information associated with the target session identifier can be found in the first mapping information set.
[0069] Step S103: The resource management layer generates a first control instruction using a preset communication protocol based on the first resource information and the first control information, 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 a communication protocol unified by the bus conversion layer from different communication protocols.
[0071] In some embodiments, the first control instruction can be determined based on SCPI (Standard Commands for Programmable Instruments) instructions, and the preset communication protocol can be a communication protocol capable of transmitting 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, such that, after receiving the 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 the second control instruction according to the target communication protocol corresponding to the target sensor based on the first control information.
[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, the first control instruction is generated based on the first resource information corresponding to the target session identifier and the first control information using the preset communication protocol, so that the unified manner 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 the second control instruction based on the target communication protocol adapted to the target sensor, and converts the unified preset communication protocol through the bus conversion layer into the target communication protocol adapted to the target sensor, so that the management of sensors of different communication protocols can be realized. On the one hand, this method can be applied in the upper application development stage, so that the developers of the upper application can reduce the work of adapting different communication protocols of sensors during the application development process, and the application development efficiency of the developers of the upper application is improved. On the other hand, this method can be applied in a vehicle, so that the vehicle can realize the unified management of sensors of different communication protocols, and the management cost of the vehicle for the sensors is reduced. In addition, through the unified management manner, the synchronization of data transmission of sensors under different communication protocols can be improved, and the problem of asynchronous data transmission of sensors caused by different calling manners of sensors corresponding to different communication protocols is solved.
[0075] In some embodiments, 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.
[0076] Step S1041: 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.
[0077] In some embodiments, the bus conversion layer parses the first control instruction according to the rules of the 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 between 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 translation layer determines second control information adapted to the target communication protocol based on the first control information;
[0082] In some embodiments, 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 of the first control information, maps and converts the first control information, and generates 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 translation layer generates the second control instruction based on the second control information according to rules 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 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 that can be recognized by the target communication protocol. In this way, by converting the control instructions from the 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 key-value pairs, 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, a session channel refers to a 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 translation layer determines, based on the first control information, second control information adapted to the target communication protocol, which may include steps S10431 to S10433, wherein:
[0094] Step S10431: The bus conversion layer determines the target operating system installed in the vehicle's 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 identifier of the target operating system may be written into the vehicle control system when the vehicle control system is installed on the target operating system.
[0097] In some embodiments, the instruction information of the target operating system can be obtained based on the interaction information between the target operating system and the bus conversion layer, and then the identification information of the target operating system can be determined based on the instruction information of the target operating system and a preset mapping set between the operating system and the instruction.
[0098] Step S10432: The bus translation layer determines third control information adapted to the target operating system based on the first control information;
[0099] In some embodiments, the bus conversion layer stores a mapping set of instructions recognizable by the target operating system and the first control information; the bus sensor determines the instructions recognizable by the target operating system based on the content of 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 embodiments, the bus conversion layer stores a mapping set of instructions recognizable by the target communication protocol and the third control information; the bus sensor determines the instructions recognizable by the target communication protocol based on the content of the third control information, maps and converts the third control information, and generates the 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 vehicle's control device is compatible with different operating systems, 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 realize the 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 obtained.
[0109] In some embodiments, the interface address of the sensor connection request is: Vsopen; the interface function is: opening sensor device resources and communicating with the sensor; the request parameters are: rsrc_name: indicating sensor resource information, access_mode: indicating the sensor resource access lock mode; timeout: indicating the expected timeout value of the connection operation, session identifier; the response parameter is: session: indicating the session identifier; the interface status code is: 0 indicates success, and all other values indicate 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 simultaneously, but when the resource is locked, the tasks are not allowed to perform write operations on the sensor.
[0110] Step S106: The resource management layer generates a first connection instruction based on the first resource information 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 rules 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 the 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 the different communication protocols used by the sensor in a preset communication protocol. In this way, after receiving the 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, the resource management layer first 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, thereby enabling unified connection of sensors using different communication protocols through the preset communication protocol. Finally, the bus conversion layer converts the unified preset communication protocol into a target communication protocol compatible with the target sensor, thereby enabling connection of sensors using different communication protocols. Furthermore, the target session identifier generated by the sensor connection request is used as an input parameter in the sensor control request to associate the target sensor with the target session identifier, allowing the vehicle control device to complete control operations on the target sensor.
[0115] In some embodiments, after step S107, the following steps S108 to S110 may be further 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 the mapping in the 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 to the sensor connection request includes a target session identifier and an interface status code, where 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 of 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. Determining the first control information corresponding to the target sensor based on the sensor control request may include the following steps S1011 and S1012, wherein:
[0123] Step S1011: 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.
[0124] Here, the write request is used to implement parameter configuration of the sensor by writing data to the sensor.
[0125] Taking VsWrite as an example, the first storage address is a value corresponding to command in the request parameter, and the first data length is a value corresponding to size in the request parameter.
[0126] In some embodiments, 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 the first instruction configuration information from the storage space based on the first storage address and the first data length.
[0128] In some embodiments, first, the storage space corresponding to the first storage address is determined, and then instruction data of the first data length is read in the storage space. The read instruction data is the first instruction configuration information.
[0129] In some embodiments, after reading the instruction data of the first data length in the storage space corresponding to the first address information, the read instruction data is converted according to a preset communication protocol. The converted instruction data is the first instruction configuration information.
[0130] In this embodiment, in the case where 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. In this way, the first instruction configuration information can be determined based on the first storage address and the first data length. By writing the first instruction configuration information to the target sensor through the second control instruction, parameter configuration of the target sensor is realized.
[0131] In some embodiments, the sensor control request includes a write request, and the first control information includes the first instruction configuration information. Based on the sensor control request, the first control information corresponding to the target sensor can include the following steps S1013 and S1014, wherein:
[0132] Step S1013: The resource management layer determines second instruction configuration information carried by a write request of the target sensor.
[0133] In some embodiments, 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. In this way, 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 collected by the target sensor to the resource management layer in response to receiving the target sensing data 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 target sensing data collected by the target sensor, generates first response information of the read request based on the target sensing data, and sends the first response information 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 embodiments, after the application interface layer obtains the first response information of the read request, it obtains the address information and the second data length of the target area, 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, where the value of the interface status code is 0.
[0148] Taking VsReadAsync as an example, the response information of the read request includes the interface status code and the 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 a response information of the read request based on the corresponding storage information and sends it to the sender of the read request. In this way, the sender of the read request can obtain the target sensing 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 sensing 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 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 code without waiting for the read operation to complete. When the read operation is completed, the read result of the read operation task is obtained through some mechanism (such as a callback function or event). 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 code without waiting for the write operation to complete. When the write operation is completed, the write result of the write operation task is obtained through some mechanism (such as a callback function or event).
[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 embodiments, the interface address for a write task status query request is VsWriteStatus; the interface function is to obtain the status of a write operation task; the request parameters are: job_id, which represents the task identifier, and session, which represents the session identifier; the response parameter is: job_status, which represents the task status; the interface status code is 0, which represents success; all other values represent failure. When the write operation task is a synchronous task, job_id is a fixed value; when the write operation task 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, and is a variable value.
[0156] In some embodiments, the interface address for a read task status query request is VsReadStatus; the interface function is to obtain the status of a read operation task; the request parameters are: job_id, which represents the task identifier, and session, which represents the session identifier; the response parameter is: job_status, which represents the task status; the interface status code is 0, which represents success; all other values represent failure. When the read operation task is a synchronous task, job_id is a fixed value; when the read operation task 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, and 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 according to a preset communication protocol, and sends the first query instruction to the bus conversion layer.
[0159] In some embodiments, the resource management layer generates the first query instruction based on the first resource information and the target task identifier according to a rule of the preset communication protocol.
[0160] Step S116: The bus conversion layer generates a second query instruction based on the first query instruction according to 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 the preset communication protocol, so that after receiving the 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 generates the second query instruction according to the target communication protocol corresponding to the target sensor based on the target task identifier.
[0162] In this embodiment, first, the resource management layer parses the received task state query request to determine the first resource information of the target sensor; then, the resource management layer generates a first query instruction based on the first resource information and the target task identifier according to a preset communication protocol, so that the task state query of sensors with different communication protocols can be realized 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 according to the target communication protocol adapted to the target sensor, so that the task state query of sensors with different communication protocols can be realized.
[0163] In some embodiments, after step S116, the following steps S117 and S118 can be included, wherein:
[0164] Step S117: The bus conversion layer sends the target task state corresponding to the target task identifier 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.
[0165] In some embodiments, after obtaining the target task identifier, the target sensor finds the target task state of the target task corresponding to the target task identifier, and sends the target task state to the resource management layer.
[0166] Step S118: The resource management layer generates response information of the task state query request based on the target task state, and returns the response information of the task state query request to the sender of the task state query request.
[0167] In some implementations, the response information to the task status query request includes the status of the operation task and an interface status code, where 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. 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 translation layer clears the mapping information between the target session identifier and the first resource information, generates a 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 translation layer and the target sensor;
[0171] Here, the disconnection request is used to close the session channel and clear 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, where the session information may include a session channel for storing the bus conversion layer and the target sensor, and a temporary storage space associated with 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, and the operating efficiency of the vehicle's control device can be improved.
[0177] In some embodiments, after generating the first mapping information set, the method for controlling a vehicle sensor 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 for the newly added sensor.
[0182] In some embodiments, when the sensor update event is characterized by 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 for 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 at least one sensor includes the resource information of the target sensor.
[0187] In some embodiments, when the resource information of at least one sensor includes the resource identifier of the 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 for 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 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.
[0190] In some embodiments, after acquiring the target state data of the target sensor, the method for controlling the vehicle sensor may further include the following steps S124 to S126, wherein:
[0191] Step S124: In response to receiving the simulated sensor request, the resource management layer determines, based on the simulated sensor request, fourth control information corresponding to the simulated sensor and second resource information of the simulated sensor; the simulated sensor is generated based on the target state data of the target sensor;
[0192] Here, a simulated sensor request refers to a request message that sends a control instruction or data request to a simulated sensor through a specific interface. A simulated sensor is an abstract representation of a real physical sensor. It can be used to simulate various types of real sensors, enabling control and operation based on virtual sensor information.
[0193] In some embodiments, after obtaining the target state data, the resource management layer, in response to the triggering of the analog sensor generation task, divides the storage area of the bus conversion layer into a storage space that can be used to store the target state data, and virtualizes the storage space into an analog sensor, while generating 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 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 return 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 the 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: In response to receiving the third response information of the sensor abnormality clearing request sent by the target sensor, the bus conversion layer sends a fourth response information of the sensor abnormality clearing request to the resource management layer based on the third response information;
[0201] Here, the sensor abnormality clearing request is used to clear target state data and / or target sensing data of the target sensor that cause the target sensor to be abnormal.
[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 of the sensor abnormality clearing request, and returns the fifth response information of the sensor abnormality clearing request to the sender of the sensor abnormality clearing 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 status data and / or target sensing data in the target sensor based on the sensor abnormality clearing request, so that the target sensor can return to a normal state. 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 status 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 equipment.
[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 of the target sensor 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 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 to the status query request based on the corresponding storage information and sends it to the sender of the status query request. In this way, 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 implement 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 of the target sensor 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. In this way, 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-layer application or vehicle corresponding to the sender of the device information query request can realize 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 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 target sensing data of the target sensor based on the seventh response information, generates an eighth response information of the clear sensor request, and sends a 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 sixth response information of the device reset request, generates the seventh response information, 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: In response to receiving the resource information request, the resource management layer determines to generate a target session identifier of the target sensor to be controlled based on 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 for resource information request is: VsFindRsrc; the interface function is: querying resources whose resource identifiers match the expression and determining the resource location; the request parameters are: session: representing the session identifier; the response parameters are: expr: representing the expression for generating the resource identifier; access_link: representing the resource identification information of the sensor based on the unified expression; the interface status code: 0 indicates success, and all other values indicate failure.
[0225] Step S136: The resource management layer determines a first resource identifier corresponding to the target session identifier from the first mapping information set between the session identifier and the 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 expressions for generating resource identifiers for sensors with different protocols in the resource management layer are different. Therefore, resource identifiers generated based on the same expression have the same identifiable communication protocol for the corresponding sensors. This allows for obtaining resource identifier information for sensors on the vehicle that share the same communication protocol as the target sensor.
[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 a 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 realize the statistics of 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 universal 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, the system comprises 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 on-board sensors within the Standard Instruction Set for Programmable Instruments (SIPS) using data protocols. This allows control logic, common sensor operations, and data transmission for sensors operating under different protocols to be implemented using unified SCPI instructions (i.e., instructions generated using the preset communication protocol). Vehicle-mounted sensors connect to the bus conversion layer via bus protocols, including Ethernet, RS485, UART, RS422, LIN, CAN, FlexRay, and MOST. The resource management layer 2 manages all on-board sensors based on SCPI instructions. This includes configuring sensors, performing sensor diagnostics and running test interface boards, checking sensor connection status, and installing driver versions. It also allows the creation of virtual tasks to construct virtual sensors based on raw sensor data. The application interface layer 3 provides a unified programming interface, including opening and configuring sensor device resources, writing to and reading from sensor devices, closing sensor device resources, and handling potential sensor device errors.
[0234] Below, each module of the vehicle-mounted sensor general management framework is described in detail.
[0235] 1. Bus Translation Layer
[0236] The bus switching layer includes a merge operation bus 11.
[0237] like Figure 3 As shown, the merged operation bus 11 combines 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 instruction control of all vehicle-mounted sensors. The specific implementation steps are as follows:
[0238] 1. Design the functional operations 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. Therefore, according to the bus type, the configuration parameter type, write data type, read data parsing format, etc. of the sensor under each protocol are determined.
[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 then encapsulated by combining 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 sensor status, including resource managers.
[0245] The resource manager defines the resources of all on-board 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] A resource manager, similar to the concept of a class in object-oriented design, is an abstract description of sensor features and functions. It defines specialized terms for precisely describing sensor resources, including attribute sets, event sets, and operation sets. Therefore, when creating a new node in the device tree within the resource management layer, each sensor corresponding to the node must inherit these three sensor resource description terms: attribute set, event set, and operation set. For example, when reading sensor resources, the attribute set includes end strings, timeout values, and protocols. The event set includes user exit events. The operation set defines a unified programming interface for the application interface layer, which includes operations such as reading sensors, opening sensors, closing sensors, writing data to sensors, and obtaining the status of sensor write operations.
[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 the data type of each attribute information, including the basic data type shown in Table 3 and the complex data type shown in Table 4. The attribute information may include the sensor number, sensor performance parameters, and sensor configurable information.
[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 conversation channel type VsRsrcList Resource identifier 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 the occurrence 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: Detects sensor events and connects to 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. Among them, 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 operating 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 referred to;
[0266] 7. Implementation requirements: Some conditions and remarks 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 following is a detailed description of the functions of the resource management layer:
[0269] 1. Device identification: First, the sensor's plug-in and unplug-out status is obtained using an interrupt trigger, which can 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 based on the device tree management. A resource name (i.e., resource identifier) can be generated and updated into the connected device management list. Finally, the corresponding SCPI command (i.e., the first control command) is used to query the sensor driver type, sensor number, and other information using the corresponding resource name.
[0270] 2. Configuration parameter: configure parameters according to the selected resource name, first configure parameters through SCPI instructions, then query the configuration parameters using SCPI instructions, and confirm whether the configuration is effective.
[0271] Here, the corresponding SCPI instruction set can be generated through the above table 4 operation instruction set, and is issued to the bus conversion layer, so as to convert the SCPI instruction into an instruction recognizable by the sensor through the bus conversion layer, and issue it to the sensor.
[0272] 3. Execute diagnosis: diagnose whether the sensor corresponding to the selected resource name is normal through SCPI instruction.
[0273] Here, after obtaining the state data of the sensor, the state data of the sensor is analyzed to determine whether the sensor is running normally.
[0274] 4. Test panel: refers to the function test of the sensor, which can construct a test task according to the selected resource name, automatically obtain the SCPI instruction set for collecting and collecting default configuration sensor data, and perform sensor smoke test.
[0275] 5. Create virtual sensor (i.e. analog sensor): create a virtual sensor resource name, and specify the local sensor raw data of the corresponding bus type for analysis. The upper application can be developed and debugged based on the resource name of the virtual sensor. The raw data of the sensor is read.
[0276] Here, the sensor raw data refers to the data of the physical sensor.
[0277] It should be noted that the device tree maintained by the resource management layer includes physical sensor nodes and virtual sensor nodes. After successfully creating a virtual sensor, 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. Therefore, after creating the node of the virtual sensor, the device format of the corresponding bus type can be configured, and the original data is transmitted by default according to the properties.
[0278] III. Application interface layer
[0279] The application interface layer can be designed to use a unified programming interface to operate different forms of 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 a resource 31 may be implemented using a VsOpen instruction provided in the application interface layer. Configuring parameters 32 and writing instructions 33 may be implemented using a VsWrite instruction or a VsWriteAsync instruction. Receiving data 34 may be implemented using a VsRead instruction or a VsReadAsync instruction. Closing a resource may be implemented using a VsClose instruction. Error checking 36 may be implemented using 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-layer 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 embodiments, the upper-level application developer can first open the resource through the VsOpen instruction provided in the application interface layer, and then after establishing a channel with the sensor, trigger the task of obtaining the sensing data collected by the sensor through the VsRead instruction or the VsReadAsync instruction. When the data reading of the sensor is completed, the VsReadStatus instruction can be used to determine the execution result of the sensor data task. Finally, after completing all operations on the sensor, the dialogue channel with the sensor is closed through the VsClose instruction, and related resources are released.
[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 the sensor;
[0287] Parameter Description:
[0288] Session: Enter the unique identifier of the conversation channel for the VsSession resource operation. A new session will be generated each time a conversation 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, other values mean failure;
[0292] Description: This operation is used to query resources whose names match an 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 specific sensor resource, create a dialogue channel, and generate a session;
[0299] access_mode: Input VsAccessMode resource access lock mode, 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, other values mean failure;
[0303] Description: This operation is used to open a conversation channel for a specific resource. The returned conversation channel unique identifier can be used as a software handle for subsequent operations.
[0304] Related items: See VsClose();
[0305] Implementation requirements: None;
[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, other values mean failure;
[0311] Description: This operation is used to close the conversation 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 actual number of instruction data bytes transmitted;
[0321] Return value: 0 means success, other values mean failure;
[0322] Description: This operation writes the data in commond to the device. Only one synchronous write operation can be logged on any write resource channel.
[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, 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: 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 as the job identifier for the write operation.
[0341] job_status: outputs VsPJobStatus write operation status;
[0342] Return value: 0 means success, other values mean failure;
[0343] Description: When the operation is synchronous, the identifier is uniquely determined as 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: Enter the number of bytes of data to be read in VsUInt32;
[0352] ret_size: outputs the number of bytes of data actually obtained by VsUInt32;
[0353] Return value: 0 means success, other values mean failure;
[0354] Description: This operation puts the value read from the device into buf. Only one synchronous read operation can be logged on any read resource channel.
[0355] Related items: See VsWrite();
[0356] Implementation requirements: A read operation is considered complete when one or more of the following three conditions are met: 1. The end marker is read; 2. The specific terminator is read; 3. 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: Enter the number of bytes of data to be read in VsUInt32;
[0363] job_id: Output VsPJobId asynchronous read operation job identifier;
[0364] Return value: 0 means success, other values mean failure;
[0365] Description: This operation puts the value read from the device into buf. Any read resource channel can log multiple simultaneous 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 (i.e., the target task identifier).
[0373] job_status: outputs the VsPJobStatus read operation status;
[0374] Return value: 0 means success, other values mean failure;
[0375] Description: When the read operation is synchronous, the identifier is uniquely determined as 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 this application provides a unified set of control functions. On the one hand, for the design of simple tasks, this 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, this 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. When the processor executes the program, some or all of the steps in the above method are implemented.
[0381] The present application also provides a computer-readable storage medium having a computer program stored thereon, which implements some or all of the steps in the above method when the computer program is executed by a processor. The computer-readable storage medium can be transient or non-transient.
[0382] An embodiment of the present application further proposes a computer program, comprising 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 provides 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 in hardware, software, or a combination thereof. In some embodiments, the computer program product is embodied as a computer storage medium. In other embodiments, the computer program product is embodied as a software product, such as a software development kit (SDK).
[0384] An embodiment of the present application also provides a vehicle, comprising the above-mentioned electronic device.
[0385] It should be noted that the descriptions of the various embodiments above tend to emphasize the differences between the various embodiments, and their similarities or similarities can be referenced to each other. The descriptions of the above device, storage medium, computer program, and computer program product embodiments are similar to the descriptions of the above method embodiments and have similar beneficial effects as the method embodiments. 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 embodiments 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 that generally controls the overall operation of the electronic device 700. A communication interface 702 enables the electronic device to communicate with other terminals or servers via 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 (RAM). Data transmission between the processor 701, the communication interface 702, and the memory 703 can be carried out through a bus 704.
[0387] It should be understood that "one embodiment" or "an embodiment" mentioned throughout the specification means that the 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 the various embodiments of the present application, the size of the serial numbers of the above-mentioned steps / processes 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 embodiments of the present application. The above-mentioned serial numbers of the embodiments of the present application are for description only and do not represent the advantages and disadvantages of the embodiments.
[0388] It should be noted that, in this document, the terms "comprises," "includes," or any other variations thereof are intended to encompass non-exclusive inclusion, such that a process, method, article, or apparatus comprising a series of elements includes not only those elements but also other elements not explicitly listed, or elements inherent to such process, method, article, or apparatus. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of other identical elements in the process, method, article, or apparatus comprising the element.
[0389] In the several embodiments provided in this application, it should be understood that the disclosed devices and methods can be implemented in other ways. The device embodiments described above are merely schematic. For example, the division of units is merely a logical function division. In actual implementation, there may be other division methods, 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 separate, and the components displayed as units may or may not be physical units; they may be located in one place or distributed across 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 various embodiments of the present application may all be 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-mentioned integrated units may be implemented in the form of hardware or in the form of hardware plus software functional units.
[0391] Those skilled in the art will understand that all or part of the steps of implementing the above-mentioned 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-mentioned method embodiment; and the aforementioned storage medium includes: mobile storage devices, read-only memories (ROM), magnetic disks or optical disks, and other 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 be embodied in the form of a software product that contributes to the relevant technology. The computer software product is stored in a storage medium and includes several instructions for enabling a computer device (which can be a personal computer, server, or 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 substitutions or modifications made by those skilled in the art based on the present application are within the protection scope of the present application.
Claims
1. A vehicle sensor control method, 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 translation 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: 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; The resource management layer generates a first connection instruction based on the first resource information 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 the target session identifier and the first resource information and stores the mapping 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.
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 the 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, in response to receiving the task status query request, determines, based on the task status query request, a target session identifier and a target task identifier of the target sensor to be queried; 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: In response to receiving the target task state of the target task corresponding to the target task identifier sent by the target sensor, the bus conversion layer sends the target task state to the resource management layer; 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 a 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; 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.
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 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; The resource management layer generates a third control instruction based on the second resource information and the fourth control information 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 return 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, wherein: When the processor executes the program, the steps of 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 instructions are executed by a processor, the steps of 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