CN112738170A - Cross-platform network communication method and system based on ROS - Google Patents

Cross-platform network communication method and system based on ROS Download PDF

Info

Publication number
CN112738170A
CN112738170A CN202011528541.3A CN202011528541A CN112738170A CN 112738170 A CN112738170 A CN 112738170A CN 202011528541 A CN202011528541 A CN 202011528541A CN 112738170 A CN112738170 A CN 112738170A
Authority
CN
China
Prior art keywords
message
ros
sent
command
scada
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
CN202011528541.3A
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.)
Beijing Cnten Zhihui Technology Co ltd
Original Assignee
Beijing Cnten Zhihui 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 Beijing Cnten Zhihui Technology Co ltd filed Critical Beijing Cnten Zhihui Technology Co ltd
Priority to CN202011528541.3A priority Critical patent/CN112738170A/en
Publication of CN112738170A publication Critical patent/CN112738170A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/14Session management
    • H04L67/141Setup of application sessions
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/02Protocols based on web technology, e.g. hypertext transfer protocol [HTTP]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/02Protocols based on web technology, e.g. hypertext transfer protocol [HTTP]
    • H04L67/025Protocols based on web technology, e.g. hypertext transfer protocol [HTTP] for remote control or remote monitoring of applications
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/12Protocols specially adapted for proprietary or special-purpose networking environments, e.g. medical networks, sensor networks, networks in vehicles or remote metering networks
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/56Provisioning of proxy services
    • H04L67/565Conversion or adaptation of application format or content
    • 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/16Implementation or adaptation of Internet protocol [IP], of transmission control protocol [TCP] or of user datagram protocol [UDP]
    • H04L69/161Implementation details of TCP/IP or UDP/IP stack architecture; Specification of modified or new header fields
    • H04L69/162Implementation details of TCP/IP or UDP/IP stack architecture; Specification of modified or new header fields involving adaptations of sockets based mechanisms

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Computer Security & Cryptography (AREA)
  • Health & Medical Sciences (AREA)
  • Computing Systems (AREA)
  • General Health & Medical Sciences (AREA)
  • Medical Informatics (AREA)
  • Computer And Data Communications (AREA)

Abstract

The invention provides a cross-platform network communication method and a system based on ROS, wherein the method comprises the following steps: establishing network connection between the ROS and the SCADA; the ROS stores the command name of the message to be sent and the data contained in the command in a key value pair mode, converts the command name of the message to be sent and the value of the data type contained in the data contained in the command into a character string, and converts the stored key value pair into a preset message format; the ROS sends the message to be sent to the SCADA through the network according to the network byte order; the SCADA receives a message to be sent, converts a preset message format into a key value pair, converts character strings in the message to be sent into values of different data types, and obtains a command name of the message to be sent and data contained in the command.

Description

Cross-platform network communication method and system based on ROS
Technical Field
The invention relates to the technical field of communication, in particular to a cross-platform network communication method and system based on ROS.
Background
ROS (Robot Operating System, Robot software platform) is now the most widespread Robot Operating System, and provides a functional package ROSBridge for interactive communication between non-ROS systems and ROS systems. The protocol part provides specific formats of non-ROS system and ROS system communication, and the specific formats comprise topic subscription, message publishing, service calling, parameter setting and obtaining, picture information transmission and the like, and are character strings in a JSON format. ROSBridge provides that WebSocket Server can be connected, and the non-ROS system realizes the butt joint with the ROS system through a WebSocket protocol, thereby realizing the monitoring and control of the robot.
An SCADA (Supervisory Control And Data Acquisition, Data Acquisition And monitoring Control system) is an automatic monitoring system, And communication in the system includes internal communication, communication with I/O devices And external communication. The SCADA communicates with the outside world, typically through the OPC protocol. However, how to communicate with the ROS system, the SCADA needs to establish a communication mode based on the WebSocket protocol, and establish a communication specification between two systems.
Disclosure of Invention
The present invention aims to provide a ROS-based cross-platform network communication method and system that overcomes or at least partially solves the above mentioned problems.
In order to achieve the purpose, the technical scheme of the invention is realized as follows:
one aspect of the present invention provides a cross-platform network communication method based on ROS, including: establishing network connection between the ROS and the SCADA; the ROS stores the command name of the message to be sent and the data contained in the command in a key value pair mode, converts the command name of the message to be sent and the value of the data type contained in the data contained in the command into a character string, and converts the stored key value pair into a preset message format; the ROS sends the message to be sent to the SCADA through the network according to the network byte order; the SCADA receives a message to be sent, converts a preset message format into a key value pair, converts character strings in the message to be sent into values of different data types, and obtains a command name of the message to be sent and data contained in the command.
Wherein the key-value pair comprises: point location coding and corresponding data values.
The method is characterized in that a WebSocket interface is used between the ROS and the SCADA to send and receive messages and interactive commands.
Wherein the character string is in JSON format.
Data types include, but are not limited to, boolean types and character types, among others.
Another aspect of the present invention provides a cross-platform network communication system based on ROS, comprising: ROS and SCADA; the ROS is used for establishing network connection between the ROS and the SCADA; storing the command name of the message to be sent and the data contained in the command in a key value pair form, converting the command name of the message to be sent and the value of the data type contained in the data contained in the command into a character string, and converting the stored key value pair into a preset message format; sending the message to be sent to an SCADA (supervisory control and data acquisition) system through a network according to a network byte order; and the SCADA is used for receiving the message to be sent, converting a preset message format into a key value pair, converting character strings included in the message to be sent into values of different data types, and obtaining a command name of the message to be sent and data included in the command.
Wherein the key-value pair comprises: point location coding and corresponding data values.
And the ROS and the SCADA send and receive messages and interactive commands by using a WebSocket interface.
Wherein the character string is in JSON format.
Data types include, but are not limited to, boolean types and character types, among others.
Therefore, the ROS-based cross-platform network communication method and the ROS-based cross-platform network communication system provided by the invention combine the application of the ROS and the SCADA, and a common protocol standard is built in the two systems, so that the monitoring and the control of the robot are realized at the SCADA end.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings needed to be used in the description of the embodiments are briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art to obtain other drawings based on the drawings without creative efforts.
FIG. 1 is a flow chart of a ROS-based cross-platform network communication method provided by an embodiment of the present invention;
FIG. 2 is a flow chart of message encoding by the ROS according to the embodiment of the present invention;
fig. 3 is a schematic structural diagram of an ROS-based cross-platform network communication system according to an embodiment of the present invention.
Detailed Description
Exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. While exemplary embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure may be embodied in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the disclosure to those skilled in the art.
Fig. 1 shows a flowchart of an ROS-based cross-platform network communication method according to an embodiment of the present invention, and referring to fig. 1, the ROS-based cross-platform network communication method according to an embodiment of the present invention includes:
and S1, establishing network connection between the ROS and the SCADA.
Specifically, a transmission channel between the platforms is formed by establishing a network connection between the ROS and the SCADA, and is used for sending and receiving messages and interactive commands of different platforms.
As an optional implementation manner of the embodiment of the invention, a WebSocket interface is utilized between the ROS and the SCADA to transmit and receive messages and interactive commands. Namely, the WebSocket interface is adopted among different platforms to send and receive messages and interactive commands.
And S2, the ROS stores the command name of the message to be sent and the data contained in the command in a key-value pair mode, converts the value of the data type contained in the command name of the message to be sent and the data contained in the command into a character string, and converts the stored key-value pair into a preset message format.
Specifically, the step is a step of coding the message by the ROS platform. In specific implementation, the encoding may be performed with reference to the flow shown in fig. 2.
As an optional implementation of the embodiment of the present invention, the key-value pair includes: point location coding and corresponding data values.
S201, storing a command name to be sent and data contained in the command in a key value pair mode, wherein the meaning represented by the point location code is a key value and a corresponding data value; the key value is uniformly expressed by using a character string, the key value can be appointed as dy001, but the key value is not limited to dy001, and the stored content examples are as follows:
Figure BDA0002851398440000031
s202, converting the value of the included data type into a character string:
{"dy001":"48"}
s203, converting the stored key value pair into a fixed message format; for the character string type in the converted result, the fixed message format is as follows:
{
"op":"publish",
"topic":"/status",
"msg":{"data":"{"dy001":"48"}"}
}
s3, the ROS sends the message to be sent to the SCADA through the network according to the network byte order;
s4, the SCADA receives the message to be sent, converts the preset message format into the key value pair, converts the character string included in the message to be sent into the values of different data types, and obtains the command name of the message to be sent and the data included in the command.
Specifically, the step is a step of performing message parsing by the SCADA platform. And the SCADA platform analyzes the received information by adopting a conversion rule which is the same as the message code, and restores a command name and command content.
The method specifically comprises the following steps:
s401, converting the fixed message format into a key value pair;
s402, converting the character strings contained in the key value pair into values of different data types.
As an optional implementation manner of the embodiment of the present invention, the character string is a character string in JSON format.
As an alternative to the embodiments of the present invention, the data types include, but are not limited to, Boolean types and character types.
Therefore, through the ROS-based cross-platform network communication method provided by the embodiment of the invention, message interaction among different platforms is defined as a fixed command format, and the data communication is specifically realized by adopting a standard WebSocket interface, so that the real-time problem of cross-platform network communication is solved; and the data types of different platforms are converted into character string representation, and the JSON data format is uniformly used, so that the problems of lengths, byte sequences and the like of various data types of different platforms and languages are solved.
Fig. 3 is a schematic structural diagram of an ROS-based cross-platform network communication system according to an embodiment of the present invention, in which the above method is applied to the ROS-based cross-platform network communication system, and the following only briefly describes the structure of the ROS-based cross-platform network communication system, and please refer to the related description in the above ROS-based cross-platform network communication method for other reasons, referring to fig. 3, the ROS-based cross-platform network communication system according to an embodiment of the present invention includes: ROS and SCADA;
the ROS is used for establishing network connection between the ROS and the SCADA; storing the command name of the message to be sent and the data contained in the command in a key value pair form, converting the command name of the message to be sent and the value of the data type contained in the data contained in the command into a character string, and converting the stored key value pair into a preset message format; sending the message to be sent to an SCADA (supervisory control and data acquisition) system through a network according to a network byte order;
and the SCADA is used for receiving the message to be sent, converting a preset message format into a key value pair, converting character strings included in the message to be sent into values of different data types, and obtaining a command name of the message to be sent and data included in the command.
As an optional implementation of the embodiment of the present invention, the key-value pair includes: point location coding and corresponding data values.
As an optional implementation manner of the embodiment of the invention, a WebSocket interface is utilized between the ROS and the SCADA to transmit and receive messages and interactive commands.
As an optional implementation manner of the embodiment of the present invention, the character string is a character string in JSON format.
As an alternative to the embodiments of the present invention, the data types include, but are not limited to, Boolean types and character types.
Therefore, through the ROS-based cross-platform network communication system provided by the embodiment of the invention, the message interaction among different platforms is defined as a fixed command format, and the data communication is specifically realized by adopting a standard WebSocket interface, so that the real-time problem of cross-platform network communication is solved; and the data types of different platforms are converted into character string representation, and the JSON data format is uniformly used, so that the problems of lengths, byte sequences and the like of various data types of different platforms and languages are solved.
The above are merely examples of the present application and are not intended to limit the present application. Various modifications and changes may occur to those skilled in the art. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the scope of the claims of the present application.

Claims (10)

1. A cross-platform network communication method based on ROS is characterized by comprising the following steps:
establishing network connection between the ROS and the SCADA;
the ROS stores a command name of a message to be sent and data contained in the command in a key value pair form, converts a value of a data type contained in the command name of the message to be sent and the data contained in the command into a character string, and converts the stored key value pair into a preset message format;
the ROS sends the message to be sent to the SCADA through the network according to a network byte order;
and the SCADA receives the message to be sent, converts the preset message format into a key value pair, converts the character strings in the message to be sent into values of different data types, and obtains the command name of the message to be sent and the data contained in the command.
2. The method of claim 1, wherein the key-value pair comprises: point location coding and corresponding data values.
3. The method of claim 1, wherein the ROS sends and receives messages and interactive commands with a WebSocket interface with the SCADA.
4. The method of claim 1, wherein the string is a JSON formatted string.
5. The method of claim 1, wherein the data types include, but are not limited to, boolean types and character types.
6. A cross-platform network communication system based on ROS, comprising: ROS and SCADA;
the ROS is used for establishing network connection between the ROS and the SCADA; storing a command name of a message to be sent and data contained in the command in a key value pair form, converting the command name of the message to be sent and a value of a data type contained in the data contained in the command into a character string, and converting the stored key value pair into a preset message format; sending the message to be sent to the SCADA through the network according to a network byte order;
the SCADA is used for receiving the message to be sent, converting the preset message format into key value pairs, converting character strings included in the message to be sent into values of different data types, and obtaining a command name of the message to be sent and data included in the command.
7. The system of claim 6, wherein the key-value pair comprises: point location coding and corresponding data values.
8. The system of claim 6, wherein the ROS and the SCADA utilize a WebSocket interface for sending and receiving messages and interactive commands.
9. The system of claim 6, wherein the string is a JSON formatted string.
10. The system of claim 6, wherein the data types include, but are not limited to, boolean types and character types.
CN202011528541.3A 2020-12-22 2020-12-22 Cross-platform network communication method and system based on ROS Pending CN112738170A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011528541.3A CN112738170A (en) 2020-12-22 2020-12-22 Cross-platform network communication method and system based on ROS

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011528541.3A CN112738170A (en) 2020-12-22 2020-12-22 Cross-platform network communication method and system based on ROS

Publications (1)

Publication Number Publication Date
CN112738170A true CN112738170A (en) 2021-04-30

Family

ID=75605807

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011528541.3A Pending CN112738170A (en) 2020-12-22 2020-12-22 Cross-platform network communication method and system based on ROS

Country Status (1)

Country Link
CN (1) CN112738170A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113596035A (en) * 2021-07-30 2021-11-02 深圳元戎启行科技有限公司 ROS cross-platform communication method and system
CN114064799A (en) * 2021-10-20 2022-02-18 深圳元戎启行科技有限公司 Data synchronization method based on multiple vehicle-mounted terminals and computer equipment

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5339434A (en) * 1992-12-07 1994-08-16 Trw Inc. Heterogeneous data translation system
US20010021932A1 (en) * 1999-12-23 2001-09-13 Wilhelm Mild Access to server resources from heterogeneous platforms
CN103309660A (en) * 2013-05-27 2013-09-18 北京尚友通达信息技术有限公司 Mobile application cross-platform development method
CN103532959A (en) * 2013-10-21 2014-01-22 济南政和科技有限公司 Cross-platform network communication method
CN106648817A (en) * 2016-12-09 2017-05-10 北京酷我科技有限公司 Cross-platform data object transmission method
US20180232427A1 (en) * 2017-02-13 2018-08-16 Raytheon Company Data structure endian conversion system

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5339434A (en) * 1992-12-07 1994-08-16 Trw Inc. Heterogeneous data translation system
US20010021932A1 (en) * 1999-12-23 2001-09-13 Wilhelm Mild Access to server resources from heterogeneous platforms
CN103309660A (en) * 2013-05-27 2013-09-18 北京尚友通达信息技术有限公司 Mobile application cross-platform development method
CN103532959A (en) * 2013-10-21 2014-01-22 济南政和科技有限公司 Cross-platform network communication method
CN106648817A (en) * 2016-12-09 2017-05-10 北京酷我科技有限公司 Cross-platform data object transmission method
US20180232427A1 (en) * 2017-02-13 2018-08-16 Raytheon Company Data structure endian conversion system

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113596035A (en) * 2021-07-30 2021-11-02 深圳元戎启行科技有限公司 ROS cross-platform communication method and system
CN114064799A (en) * 2021-10-20 2022-02-18 深圳元戎启行科技有限公司 Data synchronization method based on multiple vehicle-mounted terminals and computer equipment

Similar Documents

Publication Publication Date Title
CN112738170A (en) Cross-platform network communication method and system based on ROS
CN109451032B (en) Message transmission system
CN111083161A (en) Data transmission processing method and device and Internet of things equipment
US20100115137A1 (en) Data compression method and data communication system utilizing the same
CN109217983B (en) Industrial Internet of things operation terminal communication protocol design method
WO2010081328A1 (en) Data transmission method, transmission system and data transmitter
CN103532959A (en) Cross-platform network communication method
CN113162931A (en) Method for transmitting Modbus RTU protocol in wide area network
CN114157537A (en) System and method for realizing multi-source heterogeneous data access by general equipment gateway
CN113704002A (en) RPC component realization method based on private protocol and RPC component
CN108040041B (en) Image difference transmission protocol design system and method based on service drive
CN104753804A (en) Data stream transmission control method, device and system
US10645184B2 (en) Information transmission method, gateway, and controller
US10649947B2 (en) Stack timing adjustment for serial communications
CN115314544B (en) TCP data unidirectional transmission method, device, equipment and medium
CN110417875B (en) Method, system, equipment and storage medium for docking between cloud servers
CN105024923B (en) The method and device that message category based on XMPP extension message is realized
CN116055472A (en) Multi-terminal unified service access system and method
CN115333943A (en) Deterministic network resource configuration system, method, device and storage medium
CN112491614B (en) Configuration information online automatic validation method and system for embedded equipment
CN112468513B (en) Terminal management communication method for enterprise network
US20140337522A1 (en) Method and Device for Filtering Network Traffic
CN107608679A (en) A kind of method by the efficient programming data of set top box of Socket
CN112769741B (en) Message communication method and electronic equipment
CN111626734A (en) Safe transparent transmission payment system

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

Application publication date: 20210430

RJ01 Rejection of invention patent application after publication