# Construction of Robotics and Application of the Optical-Flow Algorithm in Determining Robot Motions
## 1 Introduction  
In recent years, the development of robotics for research and civil purposes has taken high attention [1, 2]. Robots have been developed and used for difficult tasks that people cannot reach, particularly in the reason of high toxicity. One of the important tasks for robots is to improve their vision for catching objects [3, 4]. In the initial process, the position and movement of the object should be caught as fast as possible with suitable accuracy. For this reason, using a laser should be expensive, while other techniques such as ultrasonic sensors can be not effective. The application of a camera with an effective data process should have a high advantage in determining the position and motion of the object. This method has been focused on by many current studies [5]. Generally, the laser is often used for the final state of determining an object. [PERSON] et al. [6], for example, applied the fusion method of laser and vision in a mobile robot for the detection of humans. Although the laser is highly effective, it is expensive and very prone to outdoor noise. [PERSON] et al. [6] also recommended use of both laser and vision with their algorithm to improve the measurement technique. Later, [PERSON] et al. [7] developed a technique that uses a fusion of laser and radar sensors to determine a human object. However, the robot design and the algorithm are sufficiently complicated, with radar, lidar, and 3D cameras. The laser-based technique was also used for the detection of people and to help robots avoid obstacles in hospitals, as presented by [PERSON] et al. [8]. [PERSON] et al. [9] developed a low-cost ultrasonics technique for object detection and collision avoidance. However, the algorithm worked well only for indoor and controlled environments. [PERSON] et al. [10] used a lidar point cloud technique for determination of an object. Recently, [PERSON] al. [11] used computer vision and the Internet of Things to map space for agricultural purposes. Those techniques can be divided into two classes: a local point measurement such as laser, radar, and other sensors, and global measurement using camera vision. With the development of computer vision, applying camera vision has become popular in the initial stage for the determination of an object. For catching objects, various other tasks using computational vision have been applied [12; 13; 14]. In the first step, the object should be detected and identified in the image taken from the camera. Previously, this task was mainly solved by traditional algorithms, such as cross-correlation and other mathematical models. [PERSON] et al. [2], who determined the vehicle speed in urban roadways by using a video-based system, showed that the average error of the speed is less than 0.5 km/h. Similarly, [PERSON] et al. [12] developed a mathematical model for improving the accuracy of the measurement. They stated that the average error of the speed by GPS is less than 2.17% of the vehicle at a high speed of 100 km/h. [PERSON] et al. [15] used a three-dimensional camera on an unmanned aerial system for the detection and tracking of animals in a large space. However, the algorithm in their study is sufficiently complicated. To improve the accuracy of the results, a sub-grid technique was also developed by [PERSON] and [PERSON] [16] by applying MATLAB (version 2020) software. However, this technique will increase the complication of the calculation, and it can only be used in a narrow space. In recent years, the artificial neural network has been developed and allows capture of the object in real time. Many applications, such as You Only Look Once (YOLO), have been developed and show a high accuracy in detecting the object and its motion [17]. After catching, the parameters of the motion, such as velocity and direction, can be found by the optical-flow algorithm or, again, the neutral networks.