CN111283680B - System and method for wireless remote control robot - Google Patents

System and method for wireless remote control robot Download PDF

Info

Publication number
CN111283680B
CN111283680B CN202010127044.6A CN202010127044A CN111283680B CN 111283680 B CN111283680 B CN 111283680B CN 202010127044 A CN202010127044 A CN 202010127044A CN 111283680 B CN111283680 B CN 111283680B
Authority
CN
China
Prior art keywords
data
robot
client
control instruction
communication
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.)
Active
Application number
CN202010127044.6A
Other languages
Chinese (zh)
Other versions
CN111283680A (en
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.)
South China University of Technology SCUT
Original Assignee
South China University of Technology SCUT
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 South China University of Technology SCUT filed Critical South China University of Technology SCUT
Priority to CN202010127044.6A priority Critical patent/CN111283680B/en
Publication of CN111283680A publication Critical patent/CN111283680A/en
Application granted granted Critical
Publication of CN111283680B publication Critical patent/CN111283680B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • BPERFORMING OPERATIONS; TRANSPORTING
    • B25HAND TOOLS; PORTABLE POWER-DRIVEN TOOLS; MANIPULATORS
    • B25JMANIPULATORS; CHAMBERS PROVIDED WITH MANIPULATION DEVICES
    • B25J9/00Programme-controlled manipulators
    • B25J9/16Programme controls
    • B25J9/1602Programme controls characterised by the control system, structure, architecture
    • BPERFORMING OPERATIONS; TRANSPORTING
    • B25HAND TOOLS; PORTABLE POWER-DRIVEN TOOLS; MANIPULATORS
    • B25JMANIPULATORS; CHAMBERS PROVIDED WITH MANIPULATION DEVICES
    • B25J9/00Programme-controlled manipulators
    • B25J9/16Programme controls
    • B25J9/1656Programme controls characterised by programming, planning systems for manipulators
    • B25J9/1664Programme controls characterised by programming, planning systems for manipulators characterised by motion, path, trajectory planning
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02PCLIMATE CHANGE MITIGATION TECHNOLOGIES IN THE PRODUCTION OR PROCESSING OF GOODS
    • Y02P90/00Enabling technologies with a potential contribution to greenhouse gas [GHG] emissions mitigation
    • Y02P90/02Total factory control, e.g. smart factories, flexible manufacturing systems [FMS] or integrated manufacturing systems [IMS]

Landscapes

  • Engineering & Computer Science (AREA)
  • Robotics (AREA)
  • Mechanical Engineering (AREA)
  • Automation & Control Theory (AREA)
  • Manipulator (AREA)

Abstract

The invention relates to a system for wireless remote control of a robot, comprising: the system comprises an upper computer client, a server comprising a communication module and a robot entity; the remote communication is carried out between the client of the upper computer and the communication module by adopting a Socket network protocol, and communication data is packaged by adopting a self-defined Json data format; and the robot entity and the communication module are in wireless communication by adopting WIFI, and communication data are packaged by adopting a self-defined serial data format. The invention adopts the server end containing the communication module as the middleware of the upper computer client and the robot to forward the control command and the data message, and the communication module adopts a mode of processing tasks simultaneously by multithreading, so that the functions of establishing connection, sending the control command, receiving the feedback data and the like are mutually independent and do not interfere with each other, and the real-time performance of controlling the robot is improved.

Description

一种无线远程遥控机器人的系统和方法System and method for wireless remote control robot

技术领域technical field

本发明涉及机器人控制技术领域,特别是涉及一种无线远程遥控机器人的系统和方法。The invention relates to the technical field of robot control, in particular to a system and method for a wireless remote control robot.

背景技术Background technique

OpenCV是一个基于BSD许可(开源)发行的跨平台计算机视觉库,可以运行在Linux、Windows、Android和Mac OS操作系统上。它轻量级而且高效——由一系列C函数和少量C++类构成,同时提供了Python、Ruby、MATLAB等语言的接口,实现了图像处理和计算机视觉方面的很多通用算法。OpenCV is a cross-platform computer vision library released under the BSD license (open source), which can run on Linux, Windows, Android and Mac OS operating systems. It is lightweight and efficient-consisting of a series of C functions and a small number of C++ classes, while providing interfaces for languages such as Python, Ruby, and MATLAB, and implementing many general-purpose algorithms in image processing and computer vision.

Socket是应用层与TCP/IP协议族通信的中间软件抽象层,它是一组接口。在设计模式中,Socket其实就是一个门面模式,它把复杂的TCP/IP协议族隐藏在Socket接口后面,对用户来说,一组简单的接口就是全部,让Socket去组织数据,以符合指定的协议。所以,开发者无需深入理解tcp/udp协议,socket已经为用户封装好了,用户只需要遵循socket的规定去编程,编写出的程序自然就是遵循tcp/udp标准的。Socket is an intermediate software abstraction layer for communication between the application layer and the TCP/IP protocol family, and it is a set of interfaces. In the design mode, Socket is actually a facade mode, which hides the complex TCP/IP protocol family behind the Socket interface. For users, a set of simple interfaces is all, and Socket organizes data to meet the specified protocol. Therefore, developers do not need to deeply understand the tcp/udp protocol, the socket has been packaged for the user, and the user only needs to follow the socket regulations to program, and the written program naturally follows the tcp/udp standard.

随着科技技术的进步,机器人技术的发展也进入到了新的阶段,大量机器人都被应用到不同的领域之中,特别是人类难以探索或者对人身安全容易造成危害的环境中,都需要不同种类的机器人来代替人类完成实际工作。现有的机器人大多都是有线连接的控制,而机器人在这些场景中工作时,基于有线连接的控制方式对移动机器人的局限非常大,他们的探索范围就会受到限制。因此行业内急需研发一种稳定的能够支持远距离通信的无线控制移动机器人的系统或者方法。With the advancement of science and technology, the development of robot technology has also entered a new stage. A large number of robots have been applied to different fields, especially in environments where it is difficult for humans to explore or is likely to cause harm to personal safety, different types of robots are required. robots to replace humans in real work. Most of the existing robots are controlled by wired connections. When robots work in these scenarios, the control method based on wired connections has great limitations on mobile robots, and their exploration range will be limited. Therefore, there is an urgent need in the industry to develop a stable system or method for wirelessly controlling a mobile robot that can support long-distance communication.

发明内容Contents of the invention

针对现有技术存在的现有的机器人大多都是有线连接的控制的缺点,本发明设计了一种无线远程遥控机器人的系统和方法。Aiming at the disadvantage that most existing robots in the prior art are controlled by wired connections, the present invention designs a system and method for wireless remote control of robots.

本申请的具体方案如下:The specific scheme of this application is as follows:

一种无线远程遥控机器人的系统,包括:上位机客户端、包含通信模块的服务器端和机器人实体;所述上位机客户端,用于发送机器人控制指令实现对机器人实体的运动控制,接收来自机器人实体的数据,并进行数据分析;所述服务器端,用于机器人控制指令进行处理,并输出控制指令至机器人实体;所述机器人实体,用于根据控制指令进行运动;所述上位机客户端与通信模块之间采用Socket网络协议进行远距离通信,通信数据采用自定义的Json数据格式进行封装;所述机器人实体和通信模块之间采用WIFI进行无线通信,通信数据采用自定义的串口数据格式进行封装。A system for wireless remote control of a robot, comprising: a host computer client, a server including a communication module, and a robot entity; The data of the entity, and perform data analysis; the server end is used to process the robot control instructions, and output the control instructions to the robot entity; the robot entity is used to move according to the control instructions; the host computer client and The communication modules use the Socket network protocol for long-distance communication, and the communication data is encapsulated in a custom Json data format; the robot entity and the communication module use WIFI for wireless communication, and the communication data uses a custom serial port data format. encapsulation.

优选地,所述机器人实体为多关节串联机器人,所述机器人实体包括主控制器、WIFI模块、摄像头、总线、M个驱动舵机和供电单元;所述驱动舵机通过总线与主控制器相连;所述驱动舵机根据主控制器输出的控制指令进行运动;所述供电单元用于供电。Preferably, the robot entity is a multi-joint series robot, and the robot entity includes a main controller, a WIFI module, a camera, a bus, M driving steering gears and a power supply unit; the driving steering gears are connected to the main controller through the bus ; The driving steering gear moves according to the control command output by the main controller; the power supply unit is used for power supply.

优选地,所述服务器端与上位机客户端处一个局域网内,且所述服务器端包括与机器人实体的WIFI模块连接的无线网卡驱动。Preferably, the server end and the host computer client are located in a local area network, and the server end includes a wireless network card driver connected to the WIFI module of the robot entity.

优选地,所述上位机客户端为N个,1024≥N≥1。Preferably, there are N number of host computer clients, 1024≥N≥1.

一种无线远程遥控机器人的方法,包括:A method for a wireless remote control robot, comprising:

S1,作为网络通信的服务器端进行socket网络连接的初始化,并监听来自上位机客户端的连接;S1, as the server side of network communication, initializes the socket network connection, and monitors the connection from the host computer client;

S2,服务器端接收上位机客户端发送的网络连接请求,建立服务器端与上位机客户端的Socket网络连接;S2, the server end receives the network connection request sent by the host computer client, and establishes a Socket network connection between the server end and the host computer client;

S3,创建WIFI通信的子线程模块并运行,建立服务器端和机器人实体的WIFI模块的通信;S3, create and run the sub-thread module of WIFI communication, and establish the communication between the server end and the WIFI module of the robot entity;

S4,创建TCP通信的子线程模块并运行,服务器端接收客户端的控制指令,并对控制指令进行解析,根据解析结果,对机器人实体发出相应的控制指令;S4, create and run the sub-thread module of TCP communication, the server side receives the control command from the client, and analyzes the control command, and sends the corresponding control command to the robot entity according to the result of the analysis;

S5,机器人实体根据控制指令进行运动。S5, the robot entity moves according to the control instruction.

优选地,步骤S2包括:Preferably, step S2 includes:

S21,服务器端接收上位机的客户端发来网络连接请求时,处理该网络连接请求,并生成一个所述客户端对应的socket标识变量;S21, when the server side receives the network connection request from the client of the upper computer, process the network connection request, and generate a socket identification variable corresponding to the client;

S22,将所述的客户端socket标识变量保存到当前进程的FD集合中,所述FD集合用于保存所有与当前服务端建立了连接的上位机客户端socket,当有上位机与服务器端的当前通信模块断开连接时,其对应的socket也会从所述的FD集合中移除;S22. Save the client socket identification variable into the FD set of the current process, and the FD set is used to save all host computer client sockets that have established connections with the current server. When there is a current connection between the host computer and the server When the communication module is disconnected, its corresponding socket will also be removed from the FD collection;

S23,判断当前已建立连接的上位机客户端数量是否达到上限,若已达上限则等待其余上位机断开连接,若未达上限,则继续执行S21。S23 , judging whether the number of currently connected host computer clients reaches the upper limit, if it has reached the upper limit, wait for the rest of the host computers to disconnect, and if it has not reached the upper limit, continue to execute S21 .

优选地,步骤S3包括:Preferably, step S3 includes:

S31,服务器端循环监听来自WIFI模块的数据,所述数据包括视频数据、图片数据、音频数据、串口数据等;若所述数据为视频数据,则执行步骤S32;若所述数据为图片数据,则执行步骤S33;若所述数据为串口数据,则执行步骤S34;S31, the server side cyclically monitors the data from the WIFI module, the data includes video data, picture data, audio data, serial port data, etc.; if the data is video data, then perform step S32; if the data is picture data, Then execute step S33; if the data is serial data, then execute step S34;

S32,将视频数据逐帧进行处理,转换成BGR格式,然后通过opencv函数库将解析出来的视频帧数据逐帧显示,形成连续的视频图像;S32, process the video data frame by frame, convert it into BGR format, and then display the parsed video frame data frame by frame through the opencv function library to form continuous video images;

S33,通过opencv函数库将图片显示在程序窗口中;S33, displaying the picture in the program window through the opencv function library;

S34,按照自定义的串口数据格式进行解析,再重新根据自定义的Json数据格式进行封装成待发送信息,然后轮询获得FD集合中的可写的客户端socket,将所述待发送信息通过TCP通信写入可写的客户端socket,发送到对应的上位机中。S34, analyze according to the self-defined serial port data format, then repackage according to the self-defined Json data format into information to be sent, then poll to obtain writable client sockets in the FD collection, pass the information to be sent through The TCP communication is written into the writable client socket and sent to the corresponding host computer.

优选地,步骤S4包括:Preferably, step S4 includes:

S41:使用socket网络编程中的select函数定时轮询FD集合,检测是否有来自某个上位机客户端的控制指令;若有,则执行步骤S42;S41: Use the select function in socket network programming to regularly poll the FD set to detect whether there is a control command from a certain host computer client; if so, execute step S42;

S42:清空接收消息的临时缓冲区,把来自客户端的控制指令写入到所述接收消息的临时缓冲区,从缓冲区取出控制指令进行解析,根据解析结果,对机器人实体发出相应的控制指令;S42: Clear the temporary buffer of the received message, write the control command from the client into the temporary buffer of the received message, take out the control command from the buffer and analyze it, and send a corresponding control command to the robot entity according to the result of the analysis;

S43:机器人实体根据控制指令的执行结果给发送控制指令的客户端返回一个相应的状态码,并继续执行S41。S43: The robot entity returns a corresponding status code to the client sending the control instruction according to the execution result of the control instruction, and continues to execute S41.

与现有技术相比,本发明具有如下有益效果:Compared with the prior art, the present invention has the following beneficial effects:

本方案采用包含通信模块的服务器端作为上位机客户端和机器人的中间件,转发控制命令和数据消息,通信模块采取了多线程同时处理任务的方式,使得建立连接、发送控制命令和接收回传数据等功能相互独立,互不干扰,提高了对机器人控制的实时性。具体如下:In this solution, the server end including the communication module is used as the middleware between the host computer client and the robot, and forwards control commands and data messages. The communication module adopts a multi-threaded simultaneous task processing method to establish a connection, send control commands and receive feedback. Data and other functions are independent of each other and do not interfere with each other, which improves the real-time performance of robot control. details as follows:

(1)本发明采用了Socket网络通信的方法,解决了以往机器人控制中,一台上位机直接控制一个机器人的单对单通信问题,使得机器人能够接受来自多个上位机的控制命令,实现多机控制,且机器人反馈的各种数据信息,如角度信息,传感器信息,采集的图像数据等,也能同时回传给多个上位机进行处理;(1) The present invention adopts the method of Socket network communication, which solves the one-to-one communication problem in which a host computer directly controls a robot in the previous robot control, so that the robot can accept control commands from multiple host computers and realize multiple Machine control, and various data information fed back by the robot, such as angle information, sensor information, collected image data, etc., can also be sent back to multiple host computers for processing at the same time;

(2)本发明公开的无线远程遥控机器人的方法,通信模块采取了多线程同时处理任务的方式,使得建立连接、发送控制命令和接收回传数据等功能相互独立,互不干扰,提高了对机器人控制的实时性;(2) In the method for the wireless remote control robot disclosed by the present invention, the communication module adopts the mode of multithreading to process tasks simultaneously, so that functions such as establishing a connection, sending control commands and receiving return data are independent of each other and do not interfere with each other, which improves the efficiency of Real-time performance of robot control;

(3)本发明采用了局域网和WIFI相结合的通信方式,通信功能相较于蓝牙控制更加稳定,也扩展了对机器人控制的通信范围,同时也能打破有线控制的局限性,实现对机器人的远距离控制。(3) The present invention adopts the communication method combining LAN and WIFI, and the communication function is more stable than Bluetooth control, and also expands the communication range of robot control, and can also break the limitation of wired control at the same time, and realize the control of the robot. remote control.

附图说明Description of drawings

图1为一实施例的无线远程遥控机器人的系统的示意性结构图;Fig. 1 is a schematic structural diagram of a system of a wireless remote control robot of an embodiment;

图2为一实施例的无线远程遥控机器人的方法的示意性流程图;Fig. 2 is a schematic flowchart of a method for a wireless remote control robot according to an embodiment;

图3为一实施例的无线远程遥控机器人的方法的程序图。FIG. 3 is a flowchart of a method for wireless remote controlling a robot according to an embodiment.

具体实施方式Detailed ways

为使本发明实施例的目的、技术方案和优点更加清楚,下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments It is a part of embodiments of the present invention, but not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by persons of ordinary skill in the art without creative efforts fall within the protection scope of the present invention.

参见图1、一种无线远程遥控机器人的系统,包括:上位机客户端、包含通信模块的服务器端和机器人实体;所述上位机客户端,用于发送机器人控制指令实现对机器人实体的运动控制,接收来自机器人实体的数据,并进行数据分析;所述服务器端,用于机器人控制指令进行处理,并输出控制指令至机器人实体;所述机器人实体,用于根据控制指令进行运动;所述上位机客户端与通信模块之间采用Socket网络协议进行远距离通信,通信数据采用自定义的Json数据格式进行封装;所述机器人实体和通信模块之间采用WIFI进行无线通信,通信数据采用自定义的串口数据格式进行封装。Referring to Fig. 1, a system of a wireless remote control robot, comprising: a host computer client, a server end comprising a communication module and a robot entity; the host computer client is used to send robot control instructions to realize motion control of the robot entity , receiving data from the robot entity and performing data analysis; the server end is used for processing robot control instructions and outputting control instructions to the robot entity; the robot entity is used for moving according to the control instructions; the upper The Socket network protocol is used for long-distance communication between the machine client and the communication module, and the communication data is encapsulated in a custom Json data format; WIFI is used for wireless communication between the robot entity and the communication module, and the communication data is in a custom Serial port data format for encapsulation.

包含通信模块的服务器端采用通信模块程序作为上位机和机器人的中间件,转发控制命令和数据消息。其中,通信模块可以是一个软件程序,通过采用C++语言结合socket网络进行开发。The server side including the communication module uses the communication module program as the middleware between the upper computer and the robot, and forwards control commands and data messages. Wherein, the communication module may be a software program, which is developed by using C++ language combined with the socket network.

在本实施例,所述机器人实体为多关节串联机器人,所述机器人实体包括主控制器、WIFI模块、摄像头、总线、M个驱动舵机和供电单元;所述驱动舵机通过总线与主控制器相连;所述驱动舵机根据主控制器输出的控制指令进行运动;所述供电单元用于供电。In this embodiment, the robot entity is a multi-joint series robot, and the robot entity includes a main controller, a WIFI module, a camera, a bus, M driving servos and a power supply unit; connected with the controller; the driving steering gear moves according to the control command output by the main controller; the power supply unit is used for power supply.

在本实施例,所述服务器端与上位机客户端处一个局域网内,且所述服务器端包括与机器人实体的WIFI模块连接的无线网卡驱动。In this embodiment, the server end and the host computer client are in the same local area network, and the server end includes a wireless network card driver connected to the WIFI module of the robot entity.

在本实施例,所述上位机客户端为N个,1024≥N≥1。In this embodiment, there are N number of host computer clients, 1024≥N≥1.

参见图2-3、基于上述一种无线远程遥控机器人的系统的无线远程遥控机器人方法,包括:Referring to Fig. 2-3, the wireless remote control robot method based on the above-mentioned wireless remote control robot system includes:

S1,作为网络通信的服务器端进行socket网络连接的初始化,并监听来自上位机客户端的连接;具体地,步骤S1包括:以当前进程作为socket网络通信的服务器端,创建当前进程的服务器socket,采用TCP协议进行通信,并将该socket与进程所在计算机的IP地址绑定,并为其指定一个用于通信的计算机端口号;将所述服务器socket设置为非阻塞模式,并开启监听模式,等待上位机客户端的连接请求;S1, as the server end of network communication, initializes the socket network connection, and monitors the connection from the host computer client; specifically, step S1 includes: using the current process as the server end of socket network communication, creating the server socket of the current process, using The TCP protocol communicates, and this socket is bound with the IP address of the computer where the process is located, and a computer port number for communication is designated for it; the server socket is set to non-blocking mode, and the listening mode is turned on, waiting for the host The connection request of the machine client;

S2,服务器端接收上位机客户端发送的网络连接请求,建立服务器端与上位机客户端的Socket网络连接;步骤S2为程序运行的主线程,具体地,步骤S2包括:S2, the server end receives the network connection request sent by the host computer client, and establishes a Socket network connection between the server end and the host computer client; step S2 is the main thread of program operation, specifically, step S2 includes:

S21,服务器端接收上位机的客户端发来网络连接请求时,处理该网络连接请求,并生成一个所述客户端对应的socket标识变量,即获取上位机客户端socket标识变量和ip地址。S21. When the server receives a network connection request from the client of the upper computer, it processes the network connection request, and generates a socket identification variable corresponding to the client, that is, obtains the socket identification variable and the ip address of the upper computer client.

S22,将所述的客户端socket标识变量保存到当前进程的FD集合中,所述FD集合用于保存所有与当前服务端建立了连接的上位机客户端socket,当有上位机与服务器端的当前通信模块断开连接时,其对应的socket也会从所述的FD集合中移除;S22. Save the client socket identification variable into the FD set of the current process, and the FD set is used to save all host computer client sockets that have established connections with the current server. When there is a current connection between the host computer and the server When the communication module is disconnected, its corresponding socket will also be removed from the FD collection;

S23,判断当前已建立连接的上位机客户端数量是否达到上限,若已达上限则等待其余上位机断开连接,若未达上限,则继续执行S21。S23 , judging whether the number of currently connected host computer clients reaches the upper limit, if it has reached the upper limit, wait for the rest of the host computers to disconnect, and if it has not reached the upper limit, continue to execute S21 .

S3,创建WIFI通信的子线程模块并运行,建立服务器端和机器人实体的WIFI模块的通信;具体地,步骤S3包括:S3, create and run the sub-thread module of WIFI communication, establish the communication between the server end and the WIFI module of the robot entity; specifically, step S3 includes:

S31,服务器端循环监听来自WIFI模块的数据,所述数据包括视频数据、图片数据、音频数据、串口数据等;若所述数据为视频数据,则执行步骤S32;若所述数据为图片数据,则执行步骤S33;若所述数据为串口数据,则执行步骤S34;S31, the server side cyclically monitors the data from the WIFI module, the data includes video data, picture data, audio data, serial port data, etc.; if the data is video data, then perform step S32; if the data is picture data, Then execute step S33; if the data is serial data, then execute step S34;

S32,将视频数据逐帧进行处理,转换成BGR格式,然后通过opencv函数库将解析出来的视频帧数据逐帧显示,形成连续的视频图像;S32, process the video data frame by frame, convert it into BGR format, and then display the parsed video frame data frame by frame through the opencv function library to form continuous video images;

S33,通过opencv函数库将图片显示在程序窗口中;S33, displaying the picture in the program window through the opencv function library;

S34,若接收到串口数据,则表示有来自于机器人的数据反馈,按照自定义的串口数据格式进行解析,再重新根据自定义的Json数据格式进行封装成待发送信息,然后轮询获得FD集合中的可写的客户端socket,将所述待发送信息通过TCP通信写入可写的客户端socket,将所述待发送信息通过TCP通信写入可写的客户端socket,发送到对应的上位机中,自定义的串口数据格式如下:S34, if the serial port data is received, it means that there is data feedback from the robot, analyze according to the custom serial port data format, and then repackage according to the custom Json data format into information to be sent, and then poll to obtain the FD set In the writable client socket, write the information to be sent into the writable client socket through TCP communication, write the information to be sent into the writable client socket through TCP communication, and send it to the corresponding host In the machine, the custom serial port data format is as follows:

报头masthead 命令类型IDcommand type ID 数据长度Data length 消息数据message data CRC校验位CRC check digit

所述格式中,报头长度为两个字节,是固定的两个字符,用于识别串口数据的起始位置;命令类型ID为枚举值,表示消息类型是发送给机器人的控制命令还是机器人反馈的消息数据;数据长度用于记录后面消息数据的长度,使程序正确读取消息数据内容;消息数据部分用于存放需要传输的数据、指令和参数等内容;CRC校验位用于判断数据传输结果是否正确。In the format, the length of the header is two bytes, which are fixed two characters, and are used to identify the starting position of the serial port data; the command type ID is an enumerated value, indicating whether the message type is a control command sent to the robot or a robot Feedback message data; the data length is used to record the length of the following message data, so that the program can read the content of the message data correctly; the message data part is used to store the data, instructions and parameters to be transmitted; the CRC check digit is used to judge the data Whether the transmission result is correct.

S4,创建TCP通信的子线程模块并运行,服务器端接收客户端的控制指令,并对控制指令进行解析,根据解析结果,对机器人实体发出相应的控制指令;具体地,步骤S4包括:S4, create and run the sub-thread module of TCP communication, the server receives the control instruction from the client, and analyzes the control instruction, and sends a corresponding control instruction to the robot entity according to the analysis result; specifically, step S4 includes:

S41:使用socket网络编程中的select函数定时轮询FD集合,检测是否有来自某个上位机客户端的控制指令;若有,则执行步骤S42;S41: Use the select function in socket network programming to regularly poll the FD set to detect whether there is a control command from a certain host computer client; if so, execute step S42;

S42:清空接收消息的临时缓冲区,把来自客户端的控制指令写入到所述接收消息的临时缓冲区,从缓冲区取出控制指令进行解析,根据解析结果,对机器人实体发出相应的控制指令;自定义的Json格式控制命令如下:S42: Clear the temporary buffer of the received message, write the control command from the client into the temporary buffer of the received message, take out the control command from the buffer and analyze it, and send a corresponding control command to the robot entity according to the result of the analysis; The custom Json format control commands are as follows:

MessageType字段用于存放一个枚举值,如0,1,2;0表示所发送的消息类型为顶层命令,即UpperLayerMessage字段有数据,1表示所发送的消息类型为底层数据,即LowerLayerMessage字段有数据;2表示所发送的消息类型为混合命令,即UpperLayerMessage字段和LowerLayerMessage字段均有数据;The MessageType field is used to store an enumerated value, such as 0, 1, 2; 0 indicates that the message type sent is a top-level command, that is, the UpperLayerMessage field has data, and 1 indicates that the message type sent is bottom-level data, that is, the LowerLayerMessage field has data ;2 indicates that the message type sent is a mixed command, that is, both the UpperLayerMessage field and the LowerLayerMessage field have data;

UpperLayerMessage字段用于存放顶层命令,同样是枚举值,命令包括:开启串口通信、开启摄像头、拍照等机器人功能;The UpperLayerMessage field is used to store top-level commands, which are also enumerated values. The commands include: open serial communication, open camera, take pictures and other robot functions;

LowerLayerMessage字段用于存放底层数据,格式为自定义的串口数据格式,控制指定舵机进行一定角度的旋转运动;The LowerLayerMessage field is used to store the underlying data, the format is a custom serial port data format, and controls the specified steering gear to rotate at a certain angle;

S43:机器人实体根据控制指令的执行结果给发送控制指令的客户端返回一个相应的状态码,并继续执行S41。S43: The robot entity returns a corresponding status code to the client sending the control instruction according to the execution result of the control instruction, and continues to execute S41.

S5,机器人实体根据控制指令进行运动。步骤S5之后还包括:若所述的通信模块程序被关闭,则该进程建立的所有socket网络连接均断开。S5, the robot entity moves according to the control instruction. After step S5, it also includes: if the communication module program is closed, all socket network connections established by the process are disconnected.

以上所述实施例仅表达了本发明的几种实施方式,其描述较为具体和详细,但并不能因此而理解为对发明专利范围的限制。应当指出的是,对于本领域的普通技术人员来说,在不脱离本发明构思的前提下,还可以做出若干变形和改进,这些都属于本发明的保护范围。因此,本发明专利的保护范围应以所附权利要求为准。The above-mentioned embodiments only express several implementation modes of the present invention, and the descriptions thereof are relatively specific and detailed, but should not be construed as limiting the patent scope of the invention. It should be noted that, for those skilled in the art, several modifications and improvements can be made without departing from the concept of the present invention, and these all belong to the protection scope of the present invention. Therefore, the protection scope of the patent for the present invention should be based on the appended claims.

Claims (3)

1. A system for wireless remote control of a robot, comprising: the system comprises an upper computer client, a server comprising a communication module and a robot entity;
the upper computer client is used for sending a robot control instruction to realize motion control of a robot entity, receiving data from the robot entity and analyzing the data;
the server side is used for processing the robot control instruction and outputting the control instruction to the robot entity;
the robot entity is used for moving according to the control instruction;
the remote communication is carried out between the client of the upper computer and the communication module by adopting a Socket network protocol, and communication data is packaged by adopting a self-defined Json data format;
the robot entity and the communication module are in wireless communication by adopting WIFI, and communication data are packaged by adopting a self-defined serial data format;
the robot entity comprises a WIFI module;
the server end and the client end of the upper computer are in a local area network, and the server end comprises a wireless network card driver connected with a WIFI module of the robot entity;
the number of the upper computer clients is N, and N is more than or equal to 1024 and more than or equal to 1;
the method comprises the steps of using a select function in socket network programming to poll an FD set at regular time, and detecting whether a control instruction from a certain upper computer client exists or not; if so, the temporary buffer area of the received message is emptied, the control instruction from the client is written into the temporary buffer area of the received message, the control instruction is taken out from the buffer area for analysis, and the corresponding control instruction is sent to the robot entity according to the analysis result.
2. The system of wireless remote control robots of claim 1, wherein the robot entity is a multi-joint serial robot, the robot entity further comprising a master controller, a camera, a bus, M drive steering engines, and a power supply unit; the driving steering engine is connected with the main controller through a bus; the driving steering engine moves according to a control instruction output by the main controller; the power supply unit is used for supplying power.
3. A method of wirelessly remotely controlling a robot, comprising:
s1, initializing socket network connection as a server side of network communication, and monitoring connection from an upper computer client side;
s2, the server side receives a network connection request sent by the client side of the upper computer, and Socket network connection between the server side and the client side of the upper computer is established;
s3, creating and running a sub-thread module of WIFI communication, and establishing communication between a server side and the WIFI module of the robot entity;
s4, creating a sub-thread module of TCP communication and running, receiving a control instruction of a client by a server, analyzing the control instruction, and sending out a corresponding control instruction to a robot entity according to an analysis result;
s5, the robot entity moves according to the control instruction;
the server end and the client end of the upper computer are in a local area network, and the server end comprises a wireless network card driver connected with a WIFI module of the robot entity;
the step S2 comprises the following steps:
s21, when a server side receives a network connection request sent by a client side of an upper computer, the network connection request is processed, and a socket identification variable corresponding to the client side is generated;
s22, storing the client socket identification variable into an FD set of a current process, wherein the FD set is used for storing all the clients of the upper computer which are connected with a current server, and when the upper computer is disconnected with a current communication module of the server, the corresponding sockets are removed from the FD set;
s23, judging whether the number of the clients of the upper computer which are connected currently reaches an upper limit, if so, waiting for the rest upper computers to disconnect, and if not, continuing to execute S21;
the step S3 comprises the following steps:
s31, the server side circularly monitors data from the WIFI module, wherein the data comprise video data, picture data, audio data and serial port data; if the data is video data, executing step S32; if the data is picture data, executing step S33; if the data is serial data, executing step S34;
s32, processing the video data frame by frame, converting the processed video data into a BGR format, and then displaying the analyzed video frame data frame by frame through an opencv function library to form continuous video images;
s33, displaying the pictures in a program window through an opencv function library;
s34, analyzing according to a self-defined serial port data format, packaging again according to a self-defined Json data format to form information to be sent, then polling to obtain writable client sockets in the FD set, writing the information to be sent into the writable client sockets through TCP communication, and sending the information to be sent to a corresponding upper computer;
the step S4 includes:
s41: using a select function in socket network programming to poll the FD set regularly, and detecting whether a control instruction from a certain upper computer client exists; if yes, go to step S42;
s42: the temporary buffer area of the received message is emptied, a control instruction from a client is written into the temporary buffer area of the received message, the control instruction is taken out from the buffer area to be analyzed, and a corresponding control instruction is sent to a robot entity according to an analysis result;
s43: and the robot entity returns a corresponding state code to the client side sending the control instruction according to the execution result of the control instruction, and continues to execute S41.
CN202010127044.6A 2020-02-28 2020-02-28 System and method for wireless remote control robot Active CN111283680B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010127044.6A CN111283680B (en) 2020-02-28 2020-02-28 System and method for wireless remote control robot

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010127044.6A CN111283680B (en) 2020-02-28 2020-02-28 System and method for wireless remote control robot

Publications (2)

Publication Number Publication Date
CN111283680A CN111283680A (en) 2020-06-16
CN111283680B true CN111283680B (en) 2023-07-18

Family

ID=71030847

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010127044.6A Active CN111283680B (en) 2020-02-28 2020-02-28 System and method for wireless remote control robot

Country Status (1)

Country Link
CN (1) CN111283680B (en)

Families Citing this family (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111917822A (en) * 2020-06-17 2020-11-10 王鹤淳 Mobile equipment remote control method and system based on mobile network module
CN112198840B (en) * 2020-08-11 2022-07-01 北京如影智能科技有限公司 Robot task scheduling method and device
CN112549023B (en) * 2020-11-25 2022-05-27 浙江同善人工智能技术有限公司 Industrial robot demonstrator mode and protocol control method based on TCP socket interface
CN113370211A (en) * 2021-06-25 2021-09-10 深圳市拓普智造科技有限公司 Robot and remote control method and system thereof
CN113608538A (en) * 2021-08-04 2021-11-05 联想新视界(南昌)人工智能工研院有限公司 Control service integration method of underwater robot based on 5G edge calculation
CN114401162B (en) * 2022-01-14 2022-11-08 中国科学院地理科学与资源研究所 Wireless control system and method based on hole robot
CN114338836B (en) * 2022-03-15 2022-06-17 佛山智能装备技术研究院 Man-machine command interaction method based on background agent
CN115026811B (en) * 2022-05-20 2024-11-26 北京理工大学 A multi-robot serial port to WIFI communication and coordinated motion control method
CN116192919A (en) * 2023-04-19 2023-05-30 天亿纵横智能科技(天津)有限公司 Remote operation control system of bullet train image acquisition robot
CN116506326B (en) * 2023-06-21 2023-11-24 季华实验室 Sub-thread data receiving method, data monitoring method, upper computer and robot

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103324178A (en) * 2013-06-14 2013-09-25 南昌大学 Wireless robot long-range control system based on WIFI
CN103862457B (en) * 2014-03-13 2017-02-08 湖南信息职业技术学院 Service robot with visual system
CN105208016B (en) * 2015-09-07 2018-06-05 山东大学 The a variety of data transmissions of agriculture Internet of Things and the method for processing
CN106060058A (en) * 2016-06-16 2016-10-26 华南理工大学 Internet-based industrial robot remote control method

Also Published As

Publication number Publication date
CN111283680A (en) 2020-06-16

Similar Documents

Publication Publication Date Title
CN111283680B (en) System and method for wireless remote control robot
WO2020259154A1 (en) Device control method, terminal, controlled device, electronic device, medium, and program
CN105665970B (en) For the path point automatic creation system and method for welding robot
US9594536B2 (en) Method and apparatus for electronic device communication
US10785296B1 (en) Dynamic exchange of data between processing units of a system
US10652284B2 (en) Method and apparatus for session control support for field of view virtual reality streaming
US20100010671A1 (en) Information processing system, information processing method, robot control system, robot control method, and computer program
CN104950695A (en) Universal UAV (unmanned aerial vehicle) vision simulation platform
US20130073091A1 (en) Robot control apparatus and robot system
CN110990478A (en) A data processing method, device, electronic device and storage medium
CN109992111B (en) Augmented reality extension method and electronic device
WO2018076778A1 (en) Robot, and data processing method and system applied thereto
KR20060040579A (en) System and method for instant communication of images via instant messaging tools
US20090153750A1 (en) Image display apparatus
CN110602462B (en) An AI-based industrial image detection device and method
CN113218383A (en) Cloud robot map construction method and system
CN116713992B (en) An electrical control system, method and device for a humanoid robot
CN108202329A (en) A kind of method that robot demonstrator is communicated with controller data with parsing
CN112157645A (en) Seven-degree-of-freedom cooperative robot intelligent controller
CN105068708B (en) Instruction obtaining and feedback method and device and cloud server
CN115712383A (en) Natural interaction method for mixed reality robot
CN107493437A (en) A kind of camera parameter control method and relevant device
Chivarov et al. Mixed reality server and remote interface communication for ROS Based Robotic System
JP6388035B2 (en) Information processing system, information processing method, information processing apparatus, communication terminal, and control program
US11941192B2 (en) Eye-tracker, system comprising eye-tracker and computer device and method for connection between eye-tracker and computer device

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
GR01 Patent grant
GR01 Patent grant