CN112165420A - Message processing method, message processing device, robot system and CAN (controller area network) equipment - Google Patents

Message processing method, message processing device, robot system and CAN (controller area network) equipment Download PDF

Info

Publication number
CN112165420A
CN112165420A CN202010879888.6A CN202010879888A CN112165420A CN 112165420 A CN112165420 A CN 112165420A CN 202010879888 A CN202010879888 A CN 202010879888A CN 112165420 A CN112165420 A CN 112165420A
Authority
CN
China
Prior art keywords
data
message
equipment
identifier
emergency
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202010879888.6A
Other languages
Chinese (zh)
Inventor
何围
熊友军
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shenzhen Ubtech Technology Co ltd
Original Assignee
Shenzhen Ubtech Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shenzhen Ubtech Technology Co ltd filed Critical Shenzhen Ubtech Technology Co ltd
Priority to CN202010879888.6A priority Critical patent/CN112165420A/en
Publication of CN112165420A publication Critical patent/CN112165420A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L12/00Data switching networks
    • H04L12/28Data switching networks characterised by path configuration, e.g. LAN [Local Area Networks] or WAN [Wide Area Networks]
    • H04L12/40Bus networks
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L69/00Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
    • H04L69/22Parsing or analysis of headers
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L12/00Data switching networks
    • H04L12/28Data switching networks characterised by path configuration, e.g. LAN [Local Area Networks] or WAN [Wide Area Networks]
    • H04L12/40Bus networks
    • H04L2012/40208Bus networks characterized by the use of a particular bus standard
    • H04L2012/40215Controller Area Network CAN

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Computer Security & Cryptography (AREA)
  • Small-Scale Networks (AREA)

Abstract

The application is applicable to the technical field of communication, and discloses a message processing method, a message processing device, a robot system, CAN equipment and a computer readable storage medium. The message processing method comprises the following steps: acquiring the emergency degree of data to be processed; adjusting an emergency state bit in an identifier according to the emergency degree of the data to be processed, wherein the emergency state bit occupies the highest bit of the identifier, and when the emergency state bit occupies more than 2 data bits in the identifier, the more than 2 data bits are continuous data bits, and other data bits except the emergency state bit in the identifier are used for indicating the identity of the CAN equipment; generating a message according to the adjusted identifier and the data to be processed; and transmitting the message to the target CAN equipment through the CAN bus. By the scheme, the CAN equipment CAN dynamically set the priority of the message according to the emergency degree of the data to be processed.

Description

Message processing method, message processing device, robot system and CAN (controller area network) equipment
Technical Field
The present application belongs to the field of communication technologies, and in particular, to a message processing method, a message processing apparatus, a robot system, a CAN device, and a computer-readable storage medium.
Background
In an existing Controller Area Network (CAN) communication mode, if a plurality of CAN devices need to send data at the same time, a CAN bus is sequenced according to preset priorities, that is, the devices with high priorities CAN continue to send data after arbitration, the devices with low priorities stop sending, wait for the devices with high priorities to send data, and then arbitrate again, and the devices with the highest priorities send data. At present, the priority of each CAN device is preset, which will cause the low-priority CAN device not to report the emergency data in time.
Disclosure of Invention
The application provides a message processing method, a message processing device, a robot system, a CAN device and a computer readable storage medium, which CAN enable the CAN device to dynamically set the priority of a message according to the emergency degree of data to be processed.
In a first aspect, the present application provides a message processing method, applied to a CAN device, including:
acquiring the emergency degree of data to be processed;
adjusting an emergency state bit in an identifier according to the emergency degree of the data to be processed, wherein the emergency state bit occupies the highest bit of the identifier, and when the emergency state bit occupies more than 2 bits of the identifier, the more than 2 bits of the data are continuous data bits, and other data bits except the emergency state bit in the identifier are used for indicating the identity of the CAN equipment;
generating a message according to the adjusted identifier and the data to be processed;
and transmitting the message to the target CAN equipment through the CAN bus.
In a second aspect, the present application provides a message processing method, which is applied to a CAN device, and includes:
when a message is received through a CAN bus, the message is analyzed to obtain an identifier carried by the message;
and eliminating the emergency state bit in the identifier to obtain the identity of the source CAN equipment, wherein the source CAN equipment is the CAN equipment for sending the message.
In a third aspect, the present application provides a packet processing apparatus, which is applied to a CAN device, and includes:
the device comprises an acquisition unit, a processing unit and a processing unit, wherein the acquisition unit is used for acquiring the emergency degree of data to be processed;
an adjusting unit, configured to adjust an emergency status bit in an identifier according to an emergency degree of the to-be-processed data, where the emergency status bit occupies a highest bit of the identifier, and when the emergency status bit occupies more than 2 bits of the identifier, the more than 2 bits are consecutive data bits, and other data bits of the identifier except the emergency status bit are used to indicate an identity of the CAN device;
a generating unit, configured to generate a message according to the adjusted identifier and the to-be-processed data;
and the transmission unit is used for transmitting the message to the target CAN equipment through the CAN bus.
In a fourth aspect, the present application provides a packet processing apparatus, which is applied to a CAN device, and includes:
the analysis unit is used for analyzing the message when the message is received through the CAN bus to obtain the identifier carried by the message;
and the rejecting unit is used for rejecting the emergency state bit in the identifier so as to obtain the identity of the source CAN equipment, and the source CAN equipment is the CAN equipment for sending the message.
In a fifth aspect, the application provides a robot system, which includes a CAN device master control and a CAN device peripheral, where the CAN device peripheral includes a steering engine, a sensor and/or a motor; or, the CAN device peripheral implements the steps of the method according to the first aspect, and the CAN device master implements the steps of the method according to the second aspect.
In a sixth aspect, the present application provides a CAN device, where the CAN device includes a memory, a processor, and a computer program stored in the memory and executable on the processor, and the processor implements the steps of the method according to the first aspect when executing the computer program; and/or the processor when executing the computer program performs the steps of the method according to the second aspect.
In a seventh aspect, the present application provides a computer-readable storage medium storing a computer program which, when executed by a processor, performs the steps of the method of the first aspect; and/or the computer program as described above, when being executed by a processor, performs the steps of the method as described above in the second aspect.
In an eighth aspect, the present application provides a computer program product comprising a computer program which, when executed by one or more processors, performs the steps of the method as described in the first aspect above; and/or the computer program as described above, when executed by one or more processors, performs the steps of the method as described above in the second aspect.
Compared with the prior art, the application has the beneficial effects that: the method comprises the steps of improving an identifier of CAN equipment, detaching an emergency state bit from the highest position of the identifier to represent the emergency degree of a message, and adjusting the value on the emergency state bit according to the emergency degree of the message; the rest data bits in the identifier still follow the CAN protocol and are used for representing the identity of the CAN equipment generating the message; after the improvement is completed, the CAN equipment CAN dynamically set the priority of the message according to the emergency degree of the data to be processed on the premise that the CAN bus and the CAN protocol do not need to be changed. It is understood that the beneficial effects of the second aspect to the eighth aspect can be referred to the related description of the first aspect, and are not described herein again.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed to be used in the embodiments or the prior art descriptions will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present application, and it is obvious for those skilled in the art to obtain other drawings without creative efforts.
Fig. 1 is a schematic diagram of a message data frame sent by two different CAN devices when performing bus contention according to an embodiment of the present application;
fig. 2 is a flowchart of an implementation of a message processing method according to an embodiment of the present application;
fig. 3 is a flowchart of an implementation of another message processing method according to an embodiment of the present application;
fig. 4 is a flowchart of data interaction between two CAN devices in the application packet processing method according to the embodiment of the present application;
fig. 5 is a diagram illustrating an architecture of a CAN device under a robot system according to an embodiment of the present disclosure;
fig. 6 is a block diagram of a structure of a message processing apparatus according to an embodiment of the present application;
fig. 7 is a block diagram of another message processing apparatus according to an embodiment of the present application;
fig. 8 is a schematic structural diagram of a CAN device provided in an embodiment of the present application.
Detailed Description
In the following description, for purposes of explanation and not limitation, specific details are set forth, such as particular system structures, techniques, etc. in order to provide a thorough understanding of the embodiments of the present application. It will be apparent, however, to one skilled in the art that the present application may be practiced in other embodiments that depart from these specific details. In other instances, detailed descriptions of well-known systems, devices, circuits, and methods are omitted so as not to obscure the description of the present application with unnecessary detail.
To facilitate understanding of the message processing method provided in the embodiment of the present application, an arbitration function of the CAN bus is first introduced as follows: any CAN equipment has the opportunity to acquire the control right of the CAN bus and send messages outwards. If more than 2 CAN devices all request to send messages at the same time, bus conflicts are generated, and the CAN buses CAN detect the conflicts in real time and arbitrate the conflicts, so that the messages with high priority CAN be transmitted without any damage.
When the CAN bus is in an idle state, a recessive level will be present. Any CAN device connected to the CAN bus CAN now send a dominant level to the CAN bus as the start of a message. If more than 2 CAN devices send messages simultaneously, competition CAN occur. The identifier in the message is at the forefront of the message, so the identifier is transmitted to the CAN bus first, and the CAN bus CAN arbitrate the identifier of each message according to bits, specifically: each CAN device reads the level on the bus while transmitting the level to the bus, and compares the level with the level transmitted by the CAN device; if the level is the same, continuing to send the next bit; if the levels are different, the CAN equipment with the transmitted level being the low level takes priority, and the CAN equipment with the transmitted level being the high level stops transmitting the level and quits bus competition; and the rest CAN devices continue the process until the bus is only left with the level sent by 1 CAN device, the bus competition is finished, and the CAN device with the highest priority obtains the control right of the bus.
To understand the above arbitration process, please refer to fig. 1, where fig. 1 shows an illustration of a message data frame sent by two different CAN devices during bus contention. Assuming that two CAN devices follow the CAN protocol, an 11-bit standard frame identifier is used; that is, in the messages sent by the two CAN devices, the identifiers are Bit10 to Bit 0. As CAN be seen from fig. 1, Bit10, Bit9, and Bit8 from CAN device a and CAN device B are the same; the value of Bit7 sent by the CAN device A is 0, the value of Bit7 sent by the CAN device B is 1, at the moment, the two are different, and the arbitration CAN know that the value sent by the CAN device A is smaller than the value sent by the CAN device B, so that the CAN device A has higher priority than the CAN device B, and the CAN device A occupies a CAN bus to send a message; the CAN equipment B is converted into monitoring the CAN bus and stops sending the message; that is, the CAN device a successfully sends the arbitration bit to obtain the control right of the CAN bus, and then sends all messages; the CAN equipment B does not start to send the message again until the CAN bus is free; if other CAN equipment starts to send messages at the same time, the arbitration process is repeated.
A message processing method provided in the embodiment of the present application is described below. The message processing method is applied to CAN equipment needing to send messages; namely, the method is applied to a sending end in the message transmission process. Referring to fig. 2, the message processing method in the embodiment of the present application includes:
step 201, acquiring the emergency degree of data to be processed;
in this embodiment of the present application, the urgency level of data to be transmitted by a transmitting end, that is, the urgency level of data to be processed, may be obtained first. The data emergency degree judgment strategy CAN be configured in the CAN equipment in advance, and the CAN equipment CAN judge the data to be processed through the data emergency degree judgment strategy so as to determine the emergency degree of the data to be processed. The data urgency degree judgment strategy CAN be configured according to the segmentation result of the data values, for example, at least two data intervals CAN be divided according to the type of the CAN equipment, and each data interval is associated with the urgency degree of data; the CAN device may detect a data interval in which the data to be processed falls after determining the data to be processed, and determine the urgency level associated with the data interval as the urgency level of the data to be processed.
For example, it is assumed that the CAN device is a distance sensor of a robot, and is used for providing a basis for obstacle avoidance operation of the robot. If the value of the acquisition value of the sensor is recorded as value (the unit is meter), the following four different data intervals and the corresponding emergency degree of each data interval can be divided:
the value is more than or equal to 2 meters, the emergency degree is the lowest, and the value is used for representing non-emergency data;
value is more than or equal to 1 meter and less than 2 meters, and the urgency degree is second lowest and is used for representing more urgent data;
value is more than or equal to 0.5 m and less than 1 m, the emergency degree is second highest and is used for representing emergency data;
value <0.5 m, with the highest urgency, is used to indicate very urgent data.
In the above example, the urgency level of the data may also be represented by an urgency level value. For example, the highest degree of urgency is represented by an urgency value of "0", and the data is more urgent when the urgency value is lower, and the data is less urgent when the urgency value is higher. Of course, the corresponding relationship between the emergency degree value and the emergency degree may be set by other methods, and is not limited herein.
It should be noted that the division of the data interval is only an example. Different CAN devices may have different data interval division modes, and are not limited herein.
Step 202, adjusting the emergency status bit in the identifier according to the emergency degree of the data to be processed;
in the embodiment of the present application, it is specified in the CAN protocol that the identifier in the standard format is 11 bits, and the identifier in the extended format is 29 bits. In the embodiment of the application, the emergency bit is divided from the identifier, and the CAN bus arbitration is considered to start from the highest bit of the identifier, so that the emergency bit needs to occupy the highest bit of the identifier, and the number of bits of data occupied by the emergency bit is not limited here. When the emergency state bit occupies only one data bit in the identifier, the emergency state bit is the highest bit of the identifier, and when the emergency state bit occupies more than 2 data bits in the identifier, the more than 2 data bits need to be consecutive data bits. For example only, in the standard format, if the emergency status Bit is set to occupy three data bits, the three data bits will necessarily occupy the highest Bit 10; and considering that the emergency state bits occupy consecutive data bits, the remaining two of the three data bits are Bit9 and Bit8, respectively.
Typically, the emergency status bit occupies two bits of data. The following gives the definition of the identifier of the emergency status bit divided into two bits of data:
under the standard format, the identifier is defined as:
Bit0--Bit8 Bit9--Bit10
original ID Position of emergency
In the extended format, the identifier is defined as:
Bit0--Bit26 Bit27--Bit28
original ID Position of emergency
Wherein, the original ID follows a standard CAN protocol and is used for indicating the identity of CAN equipment; and also used to represent the original priority (i.e., static priority) of the CAN device; and the data status bit CAN be adjusted according to the urgency of the data to be processed and CAN be used for representing the dynamic priority of the CAN equipment. In the default state, the emergency state bit of each CAN device is the same and is the maximum value. For example, for an emergency state bit that occupies two bits of data, the default state value is "11".
In some embodiments, the CAN device is preconfigured with an urgency-value lookup table. For example, for an emergency status bit occupying two bits of data, the emergency-value lookup table may be as follows:
Figure BDA0002653792900000071
generally, in the urgency-value comparison table, the urgency and the matching value usually have a negative correlation. The CAN equipment CAN find out a numerical value matched with the emergency degree of the data to be processed in the emergency degree-numerical value comparison table, and endow the numerical value with the emergency state bit so as to realize the adjustment of the emergency state bit.
It should be noted that the original IDs of different CAN devices connected to the same bus are necessarily different; and the emergency status bits of different CAN devices connected to the same bus will vary depending on the respective urgency of the data to be processed.
Step 203, generating a message according to the adjusted identifier and the data to be processed;
and step 204, transmitting the message to the target CAN equipment through the CAN bus.
In the embodiment of the application, the CAN device transmits a message generated according to the adjusted identifier and the data to be processed to the target CAN device through the CAN bus. The CAN bus arbitrates the messages at the same time according to the CAN protocol, and the arbitration result CAN refer to the above, which is not limited here. Thus, the priority of the message can be dynamically adjusted through the emergency bit: when the adjusted emergency state bit is a small value, the message is preferentially sent during bus competition; when the adjusted emergency state bit is a large value, the message is delayed to be sent during bus contention.
Therefore, through the embodiment of the application, the identifier of the CAN equipment is improved, the emergency state bit is detached from the highest position of the identifier to represent the emergency degree of the message, and the numerical value on the emergency state bit CAN be adjusted according to the emergency degree to be transmitted; the rest data bits in the identifier still follow the CAN protocol and are used for representing the identity of the CAN equipment generating the message; after the improvement is completed, the CAN equipment CAN dynamically set the priority of the message according to the emergency degree of the data to be processed on the premise that the CAN bus and the CAN protocol do not need to be changed.
Another message processing method provided in the embodiment of the present application is described below. The message processing method is applied to CAN equipment needing to receive messages; namely, the method is applied to a receiving end in the message transmission process. Referring to fig. 3, the message processing method in the embodiment of the present application includes:
step 301, when a message is received through a CAN bus, the message is analyzed to obtain an identifier carried by the message;
step 302, removing the emergency status bit in the identifier to obtain the identity of the source CAN device.
In the embodiment of the application, when the CAN device receives a message through the CAN bus, the message is firstly analyzed to obtain the identifier carried by the message. Considering that a plurality of bits occupying the highest bits are actually split from the identifier as emergency state bits, the emergency state bits are used for indicating the emergency degree of data to be processed carried by the message, and are only used as a judgment basis for the priority of the message in the process of arbitration of the CAN bus, but do not have other meanings, so that the emergency state bits need to be removed from the analyzed identifier first, and the original ID carried by the identifier and used for indicating the identity of the source CAN device CAN be obtained, wherein the source CAN device is the CAN device which sends the message. The CAN equipment CAN process the data to be processed carried by the message, obtain feedback based on the data to be processed, and send the feedback to the source CAN equipment. The above description of the emergency status bit can be referred to the previous embodiment, and is not repeated herein.
Therefore, according to the embodiment of the application, when the receiving end acquires the message sent by other CAN equipment, the emergency state bit in the identifier is removed to obtain the identity of the source CAN equipment of the message, and subsequent data processing and feedback are performed based on the identity so as to avoid the situation of data confusion.
For the convenience of understanding the data transmission method proposed in the embodiments of the present application, please refer to fig. 4. Fig. 4 shows a data interaction flow between a CAN device (i.e., a first CAN device) at a transmitting end and a CAN device (i.e., a second CAN device) at a receiving end, which is detailed as follows:
step 401, a first CAN device acquires the emergency degree of data to be processed;
step 402, the first CAN device adjusts an emergency status bit in the identifier according to the emergency degree of the data to be processed, and an original ID (that is, other data bits except the emergency status bit in the identifier) in the identifier is generated according to a standard CAN protocol and is used for representing the identity of the first CAN device;
step 403, the first CAN device generates a message according to the adjusted identifier and the data to be processed;
step 404, the first CAN device transmits the message to the second CAN device through the CAN bus;
step 405, the second CAN device receives the message through the CAN bus;
step 406, the second CAN device parses the message to obtain the identifier carried by the message;
step 407, the second CAN device eliminates the emergency status bit in the identifier to obtain the original ID carried by the identifier, where the original ID is used to indicate that the message is sent by the first CAN device.
It should be noted that most of the CAN devices have a message sending function and a message receiving function; therefore, when the CAN equipment sends a message, the CAN equipment CAN be used as a sending end and applied to the scheme provided by the first method embodiment; when receiving the message, the method can be used as a receiving end to apply the scheme provided by the second method embodiment.
For the convenience of understanding the data transmission method proposed in the embodiments of the present application, please refer to fig. 5. Fig. 5 gives an architectural illustration of a CAN device under a robot system. The robot system consists of a CAN equipment master control device and a CAN equipment peripheral device, wherein the CAN equipment peripheral device comprises a CAN equipment steering engine, a CAN equipment motor and a CAN equipment sensor; these CAN devices communicate via the same CAN bus. In addition, the original IDs (original priorities, that is, static priorities) of the CAN devices are also shown in the figure, where the original ID of the CAN device steering engine 1 is the smallest, and the original priority (that is, static priority) is the highest; the raw ID of the CAN device sensor 4 is the largest and its raw priority (i.e., static priority) is the lowest. In the robot system, the CAN device peripheral may generally be used as a data sender, and the CAN device master may be used as a data receiver, and the following description is made with specific examples:
the CAN equipment master control receives messages of CAN equipment peripherals with all priorities (namely identifiers), and when each CAN equipment peripheral sends the message, the message is sent by taking the identifier as an original ID and an emergency state bit.
By default, the data status bit in the identifier of all CAN device peripherals is 11, i.e. non-urgent data. At this time, if all the CAN device peripherals transmit messages through the CAN bus at the same time, the CAN bus arbitrates according to the original ID of each message because the data status bits of the identifiers in each message are the same, that is, the CAN device peripherals with small original IDs transmit the messages preferentially. For the 8 CAN device peripherals shown in the figure, the priority ranking under the default condition is the original priority ranking, which is:
CAN equipment steering engine 1 > CAN equipment steering engine 2 > CAN equipment motor 1 > CAN equipment motor 2 > CAN equipment sensor 1 > CAN equipment sensor 2 > CAN equipment sensor 3 > CAN equipment sensor 4.
When a CAN device peripheral (for example, CAN device sensor 4) with a low priority needs to send a message, the message may not be sent for a long time because of the arbitration mode of the CAN bus. By adopting the scheme of the embodiment of the application, the sensor 4 of the CAN device CAN adjust the emergency state bit in the identifier according to the emergency degree of the data to be processed:
for example, when the urgency level of the data to be processed is high, the urgency status bit of the identifier may be adjusted to 00, at this time, if all the data to be processed of the other CAN device peripherals are non-urgent data, the identifier will be the smallest (since the highest bit thereof is adjusted to 00 from the default 11), and the message of the CAN device sensor 4 CAN obtain the highest priority, the priority ranking will be:
CAN equipment sensor 4 > CAN equipment steering engine 1 > CAN equipment steering engine 2 > CAN equipment motor 1 > CAN equipment motor 2 > CAN equipment sensor 1 > CAN equipment sensor 2 > CAN equipment sensor 3.
Otherwise, when the urgency of the data to be processed is low, the emergency state bit of the identifier is still maintained at 11 (namely, the default state), and at this time, the message is automatically sent out by the CAN bus after the CAN bus is idle or the priority reaches the requirement.
Corresponding to the message processing method applied to the CAN equipment of the sending end, the embodiment of the application also provides a message processing device. Referring to fig. 6, a message processing apparatus 600 in the embodiment of the present application includes:
an obtaining unit 601, configured to obtain an urgency level of data to be processed;
an adjusting unit 602, configured to adjust an emergency status bit in an identifier according to an emergency degree of the to-be-processed data, where the emergency status bit occupies a highest bit of the identifier, and when the emergency status bit occupies more than 2 bits of the identifier, the more than 2 bits are consecutive data bits, and other data bits of the identifier except the emergency status bit are used to indicate an identity of the CAN device;
a generating unit 603, configured to generate a message according to the adjusted identifier and the to-be-processed data;
and a transmission unit 604, configured to transmit the message to a destination CAN device through a CAN bus.
Optionally, the adjusting unit 602 includes:
the searching subunit is used for searching a numerical value matched with the emergency degree of the data to be processed in a preset emergency degree-numerical value comparison table;
and the assignment subunit is used for assigning the value to the emergency state bit.
Optionally, the emergency state bit is a maximum value in a default state; in the urgency level-value comparison table, the urgency level is in a negative correlation with the matched value.
Optionally, the obtaining unit 601 includes:
an interval determining subunit, configured to determine a data interval in which the to-be-processed data falls;
and the degree determining subunit is used for determining the emergency degree associated with the data interval as the emergency degree of the data to be processed.
Therefore, through the embodiment of the application, the identifier of the CAN equipment is improved, the emergency state bit is detached from the highest position of the identifier to represent the emergency degree of the message, and the value on the emergency state bit CAN be adjusted according to the emergency degree of the message; the rest data bits in the identifier still follow the CAN protocol and are used for representing the identity of the CAN equipment generating the message; after the improvement is completed, the CAN equipment CAN dynamically set the priority of the message according to the emergency degree of the data to be processed on the premise that the CAN bus and the CAN protocol do not need to be changed.
The embodiment of the present application further provides a message processing apparatus corresponding to the message processing method of the CAN device at the application receiving end provided above. Referring to fig. 7, a message processing apparatus 700 in the embodiment of the present application includes:
an analyzing unit 701, configured to analyze, when a message is received through a CAN bus, the message, and obtain an identifier carried by the message;
and a removing unit 702, configured to remove the emergency bit in the identifier to obtain an identity of a source CAN device, where the source CAN device is a CAN device that sends the message.
Therefore, according to the embodiment of the application, when the receiving end acquires the message sent by other CAN equipment, the emergency state bit in the identifier is removed to obtain the identity of the source CAN equipment of the message, and subsequent data processing and feedback are performed based on the identity so as to avoid the situation of data confusion.
Corresponding to the message processing method provided above, an embodiment of the present application further provides a CAN device, and referring to fig. 8, a CAN device 8 in the embodiment of the present application includes: a memory 801, one or more processors 802 (only one shown in fig. 8), and computer programs stored on the memory 801 and executable on the processors. Wherein: the memory 801 is used for storing software programs and modules, and the processor 802 executes various functional applications and data processing by operating the software programs and units stored in the memory 801 to acquire resources corresponding to the preset events. Specifically, the processor 802 realizes the following steps by running the above-described computer program stored in the memory 801:
acquiring the emergency degree of data to be processed;
adjusting an emergency state bit in an identifier according to the emergency degree of the data to be processed, wherein the emergency state bit occupies the highest bit of the identifier, and when the emergency state bit occupies more than 2 bits of the identifier, the more than 2 bits of the data are continuous data bits, and other data bits except the emergency state bit in the identifier are used for indicating the identity of the CAN equipment;
generating a message according to the adjusted identifier and the data to be processed;
and transmitting the message to the target CAN equipment through the CAN bus.
Assuming that the foregoing is the first possible implementation manner, in a second possible implementation manner provided on the basis of the first possible implementation manner, the adjusting the emergency status bit in the identifier according to the emergency degree of the data to be processed includes:
searching a numerical value matched with the emergency degree of the data to be processed in a preset emergency degree-numerical value comparison table;
and assigning the value to the emergency state bit.
In a third possible embodiment provided on the basis of the second possible embodiment, the emergency state bit is a maximum value in a default state; in the urgency level-value comparison table, the urgency level is in a negative correlation with the matched value.
In a fourth possible implementation manner provided on the basis of the first possible implementation manner, the obtaining of the urgency level of the data to be processed includes:
determining a data interval in which the data to be processed falls;
and determining the emergency degree associated with the data interval as the emergency degree of the data to be processed.
And/or the processor 802, by running the above-mentioned computer program stored in the memory 801, further implements the following steps:
when a message is received through a CAN bus, the message is analyzed to obtain an identifier carried by the message;
and eliminating the emergency state bit in the identifier to obtain the identity of the source CAN equipment, wherein the source CAN equipment is the CAN equipment for sending the message.
It should be understood that in the embodiments of the present Application, the Processor 802 may be a Central Processing Unit (CPU), and the Processor may be other general purpose processors, Digital Signal Processors (DSPs), Application Specific Integrated Circuits (ASICs), Field Programmable Gate Arrays (FPGAs) or other Programmable logic devices, discrete Gate or transistor logic devices, discrete hardware components, etc. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
The memory 801 may include read-only memory and random access memory, and provides instructions and data to the processor 802. Some or all of memory 801 may also include non-volatile random access memory. For example, the memory 801 may also store device type information.
Therefore, through the embodiment of the application, the identifier of the CAN equipment is improved, the emergency state bit is detached from the highest position of the identifier to represent the emergency degree of the message, and the value on the emergency state bit CAN be adjusted according to the emergency degree of the message; the rest data bits in the identifier still follow the CAN protocol and are used for representing the identity of the CAN equipment generating the message; after the improvement is completed, the CAN equipment CAN dynamically set the priority of the message according to the emergency degree of the data to be processed on the premise that the CAN bus and the CAN protocol do not need to be changed.
It will be apparent to those skilled in the art that, for convenience and brevity of description, only the above-mentioned division of the functional units and modules is illustrated, and in practical applications, the above-mentioned functions may be distributed as different functional units and modules according to needs, that is, the internal structure of the apparatus may be divided into different functional units or modules to implement all or part of the above-mentioned functions. Each functional unit and module in the embodiments may be integrated in one processing unit, or each unit may exist alone physically, or two or more units are integrated in one unit, and the integrated unit may be implemented in a form of hardware, or in a form of software functional unit. In addition, specific names of the functional units and modules are only for convenience of distinguishing from each other, and are not used for limiting the protection scope of the present application. The specific working processes of the units and modules in the system may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
In the above embodiments, the descriptions of the respective embodiments have respective emphasis, and reference may be made to the related descriptions of other embodiments for parts that are not described or illustrated in a certain embodiment.
Those of ordinary skill in the art would appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware or combinations of external device software and electronic hardware. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present application.
In the embodiments provided in the present application, it should be understood that the disclosed apparatus and method may be implemented in other ways. For example, the above-described system embodiments are merely illustrative, and for example, the division of the above-described modules or units is only one logical functional division, and in actual implementation, there may be another division, for example, multiple units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
The integrated unit may be stored in a computer-readable storage medium if it is implemented in the form of a software functional unit and sold or used as a separate product. Based on such understanding, all or part of the flow in the method of the embodiments described above can be realized by a computer program, which can be stored in a computer-readable storage medium and can realize the steps of the embodiments of the methods described above when the computer program is executed by a processor. The computer program includes computer program code, and the computer program code may be in a source code form, an object code form, an executable file or some intermediate form. The computer-readable storage medium may include: any entity or device capable of carrying the above-described computer program code, recording medium, usb disk, removable hard disk, magnetic disk, optical disk, computer readable Memory, Read-Only Memory (ROM), Random Access Memory (RAM), electrical carrier wave signal, telecommunication signal, software distribution medium, etc. It should be noted that the computer readable storage medium may contain other contents which can be appropriately increased or decreased according to the requirements of the legislation and the patent practice in the jurisdiction, for example, in some jurisdictions, the computer readable storage medium does not include an electrical carrier signal and a telecommunication signal according to the legislation and the patent practice.
The above embodiments are only used to illustrate the technical solutions of the present application, and not to limit the same; although the present application has been described in detail with reference to the foregoing embodiments, it should be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; such modifications and substitutions do not substantially depart from the spirit and scope of the embodiments of the present application and are intended to be included within the scope of the present application.

Claims (10)

1. A message processing method is applied to CAN equipment and comprises the following steps:
acquiring the emergency degree of data to be processed;
adjusting an emergency state bit in an identifier according to the emergency degree of the data to be processed, wherein the emergency state bit occupies the highest bit of the identifier, and when the emergency state bit occupies more than 2 data bits in the identifier, the more than 2 data bits are continuous data bits, and other data bits except the emergency state bit in the identifier are used for indicating the identity of the CAN equipment;
generating a message according to the adjusted identifier and the data to be processed;
and transmitting the message to the target CAN equipment through the CAN bus.
2. The message processing method according to claim 1, wherein the adjusting the emergency status bit in the identifier according to the urgency of the data to be processed comprises:
searching a numerical value matched with the emergency degree of the data to be processed in a preset emergency degree-numerical value comparison table;
assigning the value to the emergency status bit.
3. The message processing method according to claim 2, wherein the emergency state bit is a maximum value in a default state; in the emergency degree-value comparison table, the emergency degree and the matched value are in a negative correlation relationship.
4. The message processing method according to claim 1, wherein the obtaining the urgency level of the data to be processed comprises:
determining a data interval in which the data to be processed falls;
and determining the emergency degree associated with the data interval as the emergency degree of the data to be processed.
5. A message processing method is applied to CAN equipment and comprises the following steps:
when a message is received through a CAN bus, the message is analyzed to obtain an identifier carried by the message;
and eliminating the emergency state bit in the identifier to obtain the identity of the source CAN equipment, wherein the source CAN equipment is the CAN equipment for sending the message.
6. A message processing device is applied to CAN equipment and comprises:
the device comprises an acquisition unit, a processing unit and a processing unit, wherein the acquisition unit is used for acquiring the emergency degree of data to be processed;
an adjusting unit, configured to adjust an emergency status bit in an identifier according to an emergency degree of the data to be processed, where the emergency status bit occupies a highest bit of the identifier, and when the emergency status bit occupies more than 2 bits of the identifier, the more than 2 bits are consecutive data bits, and other data bits of the identifier except the emergency status bit are used to indicate an identity of the CAN device;
a generating unit, configured to generate a message according to the adjusted identifier and the to-be-processed data;
and the transmission unit is used for transmitting the message to the target CAN equipment through the CAN bus.
7. A message processing device is applied to CAN equipment and comprises:
the analysis unit is used for analyzing the message when the message is received through the CAN bus to obtain the identifier carried by the message;
and the removing unit is used for removing the emergency state bit in the identifier so as to obtain the identity of the source CAN equipment, wherein the source CAN equipment is the CAN equipment for sending the message.
8. A robot system is characterized by comprising a CAN equipment master control unit and a CAN equipment peripheral unit, wherein the CAN equipment peripheral unit comprises a steering engine, a sensor and/or a motor; the CAN device peripheral implements the method of any one of claims 1 to 4 and the CAN device master implements the method of claim 5.
9. A CAN device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, wherein the processor when executing the computer program implements the method of any one of claims 1 to 4; and/or the processor, when executing the computer program, implements the method of claim 5.
10. A computer-readable storage medium, in which a computer program is stored which, when being executed by a processor, carries out the method according to any one of claims 1 to 4; and/or which, when executed by a processor, implements the method of claim 5.
CN202010879888.6A 2020-08-27 2020-08-27 Message processing method, message processing device, robot system and CAN (controller area network) equipment Pending CN112165420A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010879888.6A CN112165420A (en) 2020-08-27 2020-08-27 Message processing method, message processing device, robot system and CAN (controller area network) equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010879888.6A CN112165420A (en) 2020-08-27 2020-08-27 Message processing method, message processing device, robot system and CAN (controller area network) equipment

Publications (1)

Publication Number Publication Date
CN112165420A true CN112165420A (en) 2021-01-01

Family

ID=73860309

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010879888.6A Pending CN112165420A (en) 2020-08-27 2020-08-27 Message processing method, message processing device, robot system and CAN (controller area network) equipment

Country Status (1)

Country Link
CN (1) CN112165420A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113452591A (en) * 2021-06-21 2021-09-28 合安科技技术有限公司 Loop control method and device based on CAN bus continuous data frame
CN117311300A (en) * 2023-11-29 2023-12-29 西安热工研究院有限公司 Method and device for dynamically adjusting sampling frequency of distributed control system and electronic equipment

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102340432A (en) * 2010-07-21 2012-02-01 浙江吉利汽车研究院有限公司 Identifier allocation strategy for vehicle-mounted CAN (Controller Area Network) bus
CN102932223A (en) * 2012-10-12 2013-02-13 山东科技大学 Method for distributing extended identifiers of CAN bus of storage battery management system
CN106797418A (en) * 2014-10-07 2017-05-31 洋马株式会社 Remote server
CN106875664A (en) * 2017-04-18 2017-06-20 连云港杰瑞深软科技有限公司 A kind of exclusive formula collecting method based on CAN
US20180210462A1 (en) * 2013-03-15 2018-07-26 Peloton Technology, Inc. System and method for implementing pre-cognition braking and/or avoiding or mitigation risks among platooning vehicles
CN110290231A (en) * 2019-06-24 2019-09-27 广东美的暖通设备有限公司 Distribution method, distributor, central air conditioner system and storage medium

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102340432A (en) * 2010-07-21 2012-02-01 浙江吉利汽车研究院有限公司 Identifier allocation strategy for vehicle-mounted CAN (Controller Area Network) bus
CN102932223A (en) * 2012-10-12 2013-02-13 山东科技大学 Method for distributing extended identifiers of CAN bus of storage battery management system
US20180210462A1 (en) * 2013-03-15 2018-07-26 Peloton Technology, Inc. System and method for implementing pre-cognition braking and/or avoiding or mitigation risks among platooning vehicles
CN106797418A (en) * 2014-10-07 2017-05-31 洋马株式会社 Remote server
CN106875664A (en) * 2017-04-18 2017-06-20 连云港杰瑞深软科技有限公司 A kind of exclusive formula collecting method based on CAN
CN110290231A (en) * 2019-06-24 2019-09-27 广东美的暖通设备有限公司 Distribution method, distributor, central air conditioner system and storage medium

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113452591A (en) * 2021-06-21 2021-09-28 合安科技技术有限公司 Loop control method and device based on CAN bus continuous data frame
CN117311300A (en) * 2023-11-29 2023-12-29 西安热工研究院有限公司 Method and device for dynamically adjusting sampling frequency of distributed control system and electronic equipment
CN117311300B (en) * 2023-11-29 2024-02-13 西安热工研究院有限公司 Method and device for dynamically adjusting sampling frequency of distributed control system and electronic equipment

Similar Documents

Publication Publication Date Title
US10120820B2 (en) Direct memory access transmission control method and apparatus
US20070070904A1 (en) Feedback mechanism for flexible load balancing in a flow-based processor affinity scheme
US7412556B2 (en) Method and system for master devices accessing slave devices
US10200290B2 (en) Station and method for serial data transmission using dynamic reprioritizing of data frames
CN112165420A (en) Message processing method, message processing device, robot system and CAN (controller area network) equipment
CN105119793A (en) Identifier distribution method of sensor network CAN bus frame format
WO2021017667A1 (en) Service data transmission method and device
US20180049210A9 (en) Access Method with Access Slots and Priority Resolution
US7043561B2 (en) System and method for prioritizing requests for server services
CN116150054B (en) Interrupt information processing method based on PCIE
CN115766860A (en) Data transmission method, TSN node and computer readable storage medium
US8855693B2 (en) Method and apparatus for controlling wireless devices
CN106875664B (en) Exclusive data acquisition method based on CAN bus
CN113938351A (en) Data acquisition method, system and computer readable storage medium
CN109639555B (en) Link layer message generation method, link layer message generation device and terminal equipment
CN112995056A (en) Traffic scheduling method, electronic device and storage medium
CN100345422C (en) Packet communicate terminal
CN113965977B (en) Data transmission method, device, system and medium in multilink system
CN111026699B (en) Multi-core network communication method, device and system based on ring bus
CN111984576B (en) Data communication system and method
CN112671512A (en) CAN message sending method, control unit, CAN node and network thereof
CN113438688A (en) Detection method and detection device for hidden node
CN113411352B (en) Signal anti-interference transmission method and system
JP3230339B2 (en) Communication control device
CN113691630B (en) DNS request processing method, device, system, electronic equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20210101