Professional Documents
Culture Documents
Peg in Hole
Peg in Hole
Peg in Hole
net/publication/318857014
CITATIONS READS
0 1,358
5 authors, including:
2 PUBLICATIONS 1 CITATION
Autonomous University of Nuevo León
2 PUBLICATIONS 7 CITATIONS
SEE PROFILE
SEE PROFILE
All content following this page was uploaded by Jesus Romero on 07 August 2017.
Abstract. This paper presents a computer vision guided peg hole inser-
tion task conducted by a robot. We mounted two cameras: one capturing
top view and the other capturing side view to calibrate the three dimen-
sional co-ordinates of the center position of the peg and hole found in
the image to the actual world co-ordinates so that the robot can grab
and insert the peg into the hole automatically. We exploit normalized
cross correlation based template matching and distortion model (grid)
calibration algorithm for our experiment. We exploit a linear equation
for the linear and rotational displacement of the arm and gripper of the
robot respectively for computing the pulse required for the encoder. We
utilize gantry robot to conduct the experiment. The implementation was
carried out in LabVIEW environment. We achieved significant amount
of accuracy with an experimental error of 5% for template matching and
±2.5 mm for calibration algorithm.
1 Introduction
c Springer International Publishing AG 2017
G. Sidorov and O. Herrera-Alcántara (Eds.): MICAI 2016, Part I, LNAI 10061, pp. 437–458, 2017.
DOI: 10.1007/978-3-319-62434-1 36
438 A. Sauceda Cienfuegos et al.
2 Literature Review
Existing automatic “peg-hole” insertion task algorithms can be categorized into
three groups: dynamic and static models, machine learning and computer vision
Vision Controlled Peg-Hole Insertaion Task 439
sensors. Dynamic and static models use mechanical contact model, machine
learning based algorithm exploits force sensor torques whereas vision sensor uses
camera to automate “peg-hole” insertion task. Details of these three groups are
given below.
First Group: Dynamic and Static Models
Automated assembly has a lot of problems with uncertainties in the environ-
ment. Dietrich et al. [6] analyzed the implementation of static contact models in
assembly situations using parallel robots.
Navarro et al. [18] introduced a multimodal assembly controller approach
to effectively increase the knowledge of industrial robots in multimodal robots
working in manufacturing. The performance of the operation increases with time,
as the robot learns more efficient ways of completing the task.
Because of the uncertainties in a robot assembly process, problems with col-
lision and small positional alignments often occur. To solve this, Xia et al. [27]
developed a compliant contact dynamic model to solve these problems. Using the
basis of the dynamic model, the no-jamming and no-wedging assembly strategies
can be obtained.
To realize a peg in hole insertion with a multi degree of freedom manipula-
tor, you would normally need the precise position of the hole, this is obtained
using cameras or with force/torque sensors. Park et al. [20] provided an intuitive
assembly strategy that does not use any of those; instead, it first pushes the peg
towards the hole, once it touches the hole, the peg is dragged in a pattern until
it matches the hole, and then, the peg is inserted into it. For this experiment, a
simulation was done to verify the procedure, after that, it was physically tested
with a Kitech Arm.
Tsuruoka et al. [26] presented contact analysis in a 3 dimensional space,
map regions of the contacts are presented for analysis. The simulations took in
consideration the orientation of the peg and how it makes contact in the hole.
Callegari et al. [2] described the architecture of the virtual prototyping envi-
ronments that can be presently set up to try to make the best from a concurrent
mechatronic design of mechanical devices and control systems. Integration of
different software modules can do the job.
Callegari and Suardi [3] proposed a new parallel kinematics machine for the
assembly task. The architecture of the system was explained and the dynamic
behavior was tested. A position/force controller was developed for the purpose.
The robot used was a 3-RCC parallel machine.
Reinhart and Radi [23] implemented a telepresence system to make an assem-
bly. The system is composed of three parts: the human operator side, the robot
side, and the communication between them. For this paper, a peg-and-hole
assembly is planned for the task. First the movements are fast, until the position
of the robot is close to the hole, in which the movements are changed to be slower
and more precise. Once the peg touches the hole, the user receives feedback from
the robot and controls the movements of the robot using a joystick to complete
the insertion. A KUKA industrial robot is used for this paper.
440 A. Sauceda Cienfuegos et al.
we first identify matches in the highest level, and then we search on a lower
level of the pyramid, performing the search again considering only the template
positions that scored high on the previous level. Grayscale-Based Matching uses
this pyramid search to allow for multi-angle matching by computing a set of
pyramids, one for each possible rotation of the template. During the search, the
algorithm identifies both, position and orientation.
Edge-Based Matching. Edge-based Matching enhances grayscale-based
matching using one crucial observation, that the shape of any object is defined
mainly by the shape of its edges. Therefore, instead of matching the whole
template, we could extract its edges and match only the nearby pixels, thus
avoiding some unnecessary computations. In common applications, the achieved
speed up is usually significant. In edge-based matching, the gradient direc-
tion of the edge pixels is what is matched, not their intensity, as this would
cause a match anywhere wherever there is a large enough blob of the appro-
priate color. There are two important properties associated with the gradi-
ent: (1) the vector G|f (x, y)| points in the direction of the maximum rate of
increase of the
function f (x, y), and (2) the magnitude of the gradient, given by:
G|f (x, y)| = G2x + G2y equals the maximum rate of increase of f (x, y) per unit
distance in the direction G. From vector analysis, the direction of the gradient
G
is defined as: α(x, y) = tan−1 ( Gxy ), where the angle α is measured with respect
to the x axis.
Cross-Correlation. The fundamental method of calculating the image corre-
lation is called cross-correlation, which essentially is a simple sum of pairwise
multiplications of corresponding pixel values of the images. The cross-correlation
function plays an important role in matching the characteristic features of the
object to match. Its main drawback is that it is biased by changes in global
brightness of the images, so changing the brightness of the image may increase
or reduce the value of the cross-correlation, even if the second image is not similar
at all.
Normalized Cross-Correlation. The equation of cross-correlation for tem-
plate matching is motivated by the distance measure (squared Euclidean dis-
tance)
d2f,t (u, v) = [f (x, y) − t(x − u, y − v)]2
x,y
where f is the query image and the sum is over (x, y) under the window con-
taining the template t positioned at (u, v). Expanding d2
d2f,t (u, v) = [f 2 (x, y) − 2f (x, y)t(x − u, y − v) + t2 (x − u, y − v)]
x,y
x,y [t (x − u, y − v)] is constant. If the term
2 2
The term x,y [f (x, y)] is
approximately constant, then the remaining cross-correlation term
c(u, v) = [f (x, y)t(x − u, y − v)] (1)
x,y
Vision Controlled Peg-Hole Insertaion Task 443
is a measure of the similarity between the image and the feature. There are
several disadvantages to using (1) for template matching:
• If the image brightness varies with position, matching (1) can fail. The cor-
relation of the feature and a bright spot may be higher than the feature and
an exactly matching region.
• The range of c(u, v) is dependant on the size of the feature.
The correlation coefficient overcomes these difficulties by normalizing the
image and feature vectors to unit length, yielding a cosine-like correlation coef-
ficient.
¯
x,y [f (x, y) − fu,v ][t(x − u, y − v) − t̄]
N CC(u, v) =
¯ 2 [t(x − u, y − v) − t̄]2
x,y [f (x, y) − fu,v ] x,y
Pc = R(Pw − T )
where,
Pw equals a point in the real-world coordinate system,
Pc equals the homogeneous point in the camera coordinate system,
R equals the rotation matrix between the real-world coordinate axis and the
camera coordinate axis, and
T equals the origin of the real-world coordinate axis minus the camera coor-
dinate axis.
⎡ ⎤ ⎡ ⎤
x X
⎣y ⎦ = sM [r1 r2 t] ⎣ Y ⎦
1 1
Different calibration algorithms [8,12,24] are available in literature. One of
the well-known methods are Tsai two-step method, in which the process of calcu-
lating the camera parameters is divided into two steps. The first step is to solve
linear equations to get parts of the external parameters. The focal length and
distortion correction coefficients will be figured out in the second step. It only
needs one image to get the rotation and translation matrix of the camera model,
and most equations in this method are linear, so that reduces the calculation
complexity.
446 A. Sauceda Cienfuegos et al.
4 Proposed Methodolody
Proposed methodology for peg-hole insertion task consists of two sequential step:
(i) vision control and (ii) robot kinematics as shown in Fig. 2. Two cameras
were mounted to capture the top and side view of the peg and hole. Vision
control returns the three dimensional world coordinate of the center position and
rotation of the peg, hole and gripper. From this position, the robot kinematics
can compute the number of rotations required for the encoder of the robot arm
servomotor so that robot gripper can reach to the peg position, then pick pulse
are sent to the gripper servomotor to pick the peg and then the arm servomotor
provides the linear motion for the gripper to reach to the hole position, then
insert pulse are sent to the gripper servomotor to insert the peg into the hole.
After that release pulse are sent to the gripper servomotor to release the peg and
then return pulse are sent to the robot arm servomotor to return the gripper to
its initial position. The mathematical model used by vision control and robot
kinematics are given below.
Fig. 2. Block diagram of the proposed vision controlled peg-hole insertion task
The vision control consists of two sequential steps: (i) Template Matching, and
(ii) Calibration.
(i) Template matching. We exploit normalized cross correlation technique
for matching the expected peg and hole shapes. Normalized cross-correlation
Vision Controlled Peg-Hole Insertaion Task 447
The regression algorithm will require good initial conditions. If the target is
plane, the camera axis is normal to the plane, and the image is roughly centered
on the target, then the initial conditions are easy to obtain. These are:
θ=ω=k=0
x = translation in x from the origin
y = translation in y from the origin
z = distance of the camera from the calibration plane
f = focal length of the lens
xp = yp = 0
k1 = k2 = k3 = 0.
5 Experimental Results
Gantry Robot. We conducted the peg hole insertion task experiment using
gantry robot. A gantry robot consists of a manipulator mounted onto an over-
head system that allows movement across a horizontal plane. Gantry robots are
also called Cartesian or linear robots. They are usually large systems that per-
form pick and place applications, but they can also be used in welding and other
applications. Unlike other industrial robots, gantry robots have one additional
feature that give them a leg, or rather an arm, up on other systems. Because
they are mounted from above, they are capable of reach angles and crevices that
even standard floor mounted robots may have trouble reaching during an appli-
cation. Along with their reach and all position capability, gantry robots are also
fundamental in packaging and other material handling applications. Because of
their track, they can pick up items or boxes of items and move them to another
work station or space down the line, something a floor-mounted robot could
never achieve. It is this kind of versatility that makes gantry robotics attractive
to manufacturers in several different industries [22]. The gantry robot used in
this experiment has three degrees of motion and have one servomotor for each
of this motion as shown in Fig. 3.
Camera Used in this Experiment. The camera used for this experiment is
a Basler acA640-90gm with resolution 659 × 494 px, frame rate 90 fps, pixel bit
depth 12 bits.
Advantages of LabVIEW for Robot Programming. We executed the code
in LabVIEW environment [11]. For the robot control we exploited LabVIEW in
Fig. 3. Diagram of the experimental set up with gantry robot, servomotor of the arm
and gripper as well as ball-screw pitch
450 A. Sauceda Cienfuegos et al.
brightness as the input of template learning and then fuse these templates
which use as an input for template matching algorithm. Fusion of multiple tem-
plates increases the accuracy of template matching algorithm. Figure 6 demon-
strates that multiple images of circular dots and the distances among them
are used as the input of the calibration algorithm. The output of the cal-
ibration algorithm is the inverse of the homography matrix as discussed in
Sect. 3.2 which is used as the input of the template matching algorithm. The
pixel coordinate of the center position of the peg, hole and gripper found from
452 A. Sauceda Cienfuegos et al.
template matching algorithm are multiplied with this inverse of the homog-
raphy matrix which provides their three dimensional real world coordinates
P p (X, Y, Z), P h (X, Y, Z), θp (X, Y, Z), θh (X, Y, Z), P g (X, Y, Z) that are used as
the input of the robot kinematics controller as shown in Fig. 2.
Pick the Peg. The gantry robot is composed by three ball screw actuators that
determine the motion of the robot. One ball screw actuators are used for each
axis. The models of the AC servos and ball screws are given in the Table 1.
In order to control the position of each axis of the gantry robot we have to
operate the servo drivers on position control. For the purpose of generating the
pulses to move the robot, we use DAQ Assistant to send the pulses from the
card NI SCB-68A to the AC Drivers. N pulses generated by the DAQ Assistant
as shown in Eq. 2 where we set high time that is the time that the pulse is on
high and the number of samples that is the number of pulses or pulse train as
demonstrated in Fig. 9 that is obtained from the respective parameters of the
Eq. 2. The pulses train is driven out of the DAQ SCB-68A to the servo driver
(Yaskawa SGDH Servo Driver as shown in Fig. 8) where it internally processes
the necessary signal for the AC servo motor (Yaskawa SGMAH AC Servo as
illustrated in Fig. 8). For determining the rotation of the servo motion is needed
an digital signal that is sent to the servo driver as the same way showed in Fig. 8.
In general, the servo driver receives two inputs: the position control and rotation
control.
Insert the Peg. We used a commercial two fingers gripper composed by two
DC AX-18 servos, one for the hold and release the peg and the second one for
the roll axis. In order for a better grip and for the pick and insertion task, the
gripper has to have the same rotation as the peg/hole from the respective Y
axis. Given that angle as θp /θh , we calculated the necessary input for the DC
servo. Where θp and θh are the decimal numbers from 0 to 1023 where the unit
is 0.29◦ in that way we obtain the roll axis for the gripper. For the hold and
release task of the gripper it uses two gears with a 1:1 gear ratio for the motion
of each finger. For hold the peg the servo could rotates to 30◦ or 270◦ and for
the release of the peg the servo has to rotate to 150◦ as illustrated in Fig. 9.
454
A. Sauceda Cienfuegos et al.
Fig. 11. Block diagram of computer vision guided peg hole insertion task
Vision Controlled Peg-Hole Insertaion Task 455
Return Home. Return home consists of release pulse for gripper servo motor
as shown in Fig. 9 and return pulse for arm servo motor as shown in Fig. 8.
Figure 10 shows the flowchart of the gantry robot kinematics. The average errors
of template matching and calibration algorithms are illustrated in Table 2.
The block diagram of the implementation of computer vision guided peg hole
insertion task through labview is demonstrated in Fig. 11.
the hole more efficiently. Towards achieving this goal, we plan to implement the
force and torque sensor in the finger of the gripper of the robot so that the robot
can change the direction and angle of the motion while inserting the peg into
the hole based on the signal captured by the force and torque sensor. Then we
plan to incorporate visual sensor with the force torque sensor to compute the
misalignment of the peg with the hole and decrease the overall experimental
error by identifying the location of the marks [9]. We would also plan to modify
the calibration algorithm to reduce the calibration error as well. We plan to
implement a linear algebra based novel cost function which is constructed in
real-world coordinates which makes calibration error uniform for different types
of geometric primitives and perspective invariant that makes non sensitive to
image resolution or camera-object distance. In the cost function formulation back
projection will be casted as a minimization problem, such that the re-projection
of the estimated world-space position, from world space to image space, achieves
a minimum difference from the annotated image position [7].
References
1. Balletti, L., Rocchi, A., Belo, F., Catalano, M., Garabini, M., Grioli, G., Bicchi,
A.: Towards variable impedance assembly: the VSA peg-in-hole. In: 2012 12th
IEEE-RAS International Conference on Humanoid Robots (Humanoids 2012), pp.
402–408. IEEE (2012)
2. Callegari, M., Gabrielli, A., Palpacelli, M.-C., Principi, M.: Design of advanced
robotic systems for assembly automation. Int. J. Mech. Control 8(1), 3–8 (2007)
3. Callegari, M., Suardi, A.: On the force-controlled assembly operations of a new
parallel kinematics manipulator. In: Proceedings of the Mediterranean Conference
on Control and Automation, pp. 18–20 (2003)
4. Cervera Mateu, E.: Perception-based learning for fine motion planning in robot
manipulation (1997)
5. Choi, J.W., Fang, T.H., Yoo, W.S., Lee, M.H.: Sensor data fusion using perception
net for a precise assembly task. IEEE/ASME Trans. Mech. 8(4), 513–516 (2003)
6. Dietrich, F., Buchholz, D., Wobbe, F., Sowinski, F., Raatz, A., Schumacher, W.,
Wahl, F.M.: On contact models for assembly tasks: Experimental investigation
beyond the peg-in-hole problem on the example of force-torque maps. In: 2010
IEEE/RSJ International Conference on Intelligent Robots and Systems (IROS),
pp. 2313–2318. IEEE (2010)
7. Ismail, K.A.: Application of computer vision techniques for automated road safety
analysis and traffic data collection. Ph.D. thesis, University of British Columbia
(2010). https://open.library.ubc.ca/cIRcle/collections/24/items/1.0062871
8. Jain, R., Kasturi, R., Schunck, B.G.: Machine Vision. McGraw-Hill Inc., New York
(1995)
9. Kim, J., Cho, H.S.: Visual sensor-based measurement for deformable peg-in-hole
tasks. In: Proceedings of the 1999 IEEE/RSJ International Conference on Intelli-
gent Robots and Systems, IROS 1999, vol. 1, pp. 567–572. IEEE (1999)
10. Kwon, K., Ready, S.: Practical Guide to Machine Vision Software: An Intro-
duction with LabVIEW. Wiley (2015). https://books.google.com.mx/books?id=
jiCoAEACAAJ
Vision Controlled Peg-Hole Insertaion Task 457
11. Kwon, K., Ready, S., Sons, J.W.: Practical Guide to Machine Vision Software: An
Introduction with LabVIEW. Wiley-VCH (2014). https://books.google.ca/books?
id=yXkKrgEACAAJ
12. Li, W., Gee, T., Friedrich, H., Delmas, P.: A practical comparison between Zhang’s
and Tsai’s calibration approaches. In: Proceedings of the 29th International Con-
ference on Image and Vision Computing New Zealand, IVCNZ 2014, pp. 166–171
(2014) http://doi.acm.org/10.1145/2683405.2683443
13. Lopez-Juarez, I., Corona-Castuera, J., Peña-Cabrera, M., Ordaz-Hernandez, K.:
On the design of intelligent robotic agents for assembly. Inf. Sci. 171(4), 377–402
(2005)
14. Lopez-Juarez, I., Howarth, M.: Learning manipulative skills with art. In: Proceed-
ings of the 2000 IEEE/RSJ International Conference on Intelligent Robots and
Systems (IROS 2000), vol. 1, pp. 578–583. IEEE (2000)
15. Lopez-Juarez, I., Howarth, M., Sivayoganathan, K.: An adaptive learning approach
to control contact force in assembly. In: Proceedings of the 1998 IEEE/RSJ Inter-
national Conference Intelligent Robots and Systems, vol. 3, pp. 1443–1448. IEEE
(1998)
16. Lopez-Juarez, I., Ordaz-Hernández, K., Peña-Cabrera, M., Corona-Castuera, J.,
Rios-Cabrera, R.: On the design of a multimodal cognitive architecture for per-
ceptual learning in industrial robots. In: Gelbukh, A., Albornoz, Á., Terashima-
Marı́n, H. (eds.) MICAI 2005. LNCS, vol. 3789, pp. 1062–1072. Springer, Heidel-
berg (2005). doi:10.1007/11579427 108
17. López-Juárez, I., Rios-Cabrera, R., Peña-Cabrera, M., Méndez, G.M., Osorio, R.:
Fast object recognition for grasping tasks using industrial robots. Computación y
Sistemas 16(4), 421–432 (2012)
18. Navarro-Gonzalez, J., Lopez-Juarez, I., Rios-Cabrera, R., Ordaz-Hernández, K.:
On-line knowledge acquisition and enhancement in robotic assembly tasks. Robot.
Comput. Int. Manuf. 33, 78–89 (2015)
19. Newman, W.S., Zhao, Y., Pao, Y.H.: Interpretation of force and moment signals
for compliant peg-in-hole assembly. In: Proceedings of the 2001 IEEE International
Conference on Robotics and Automation, ICRA 2001, vol. 1, pp. 571–576. IEEE
(2001)
20. Park, H., Bae, J.H., Park, J.H., Baeg, M.H., Park, J.: Intuitive peg-in-hole assembly
strategy with a compliant manipulator. In: 2013 44th International Symposium on
Robotics (ISR), pp. 1–5. IEEE (2013)
21. Perveen, N., Kumar, D., Bhardwaj, I.: An overview on template matching method-
ologies and its applications. IJRCCT 2(10), 988–995 (2013)
22. Ratcliffe, J.D., Lewin, P.L., Rogers, E., Htnen, J.J., Owens, D.H.:
Norm-optimal iterative learning control applied to gantry robots for
automation applications. IEEE Trans. Robot. 22(6), 1303–1307 (2006).
http://dblp.uni-trier.de/db/journals/trob/trob22.html#RatcliffeLRHO06
23. Reinhart, G., Radi, M.: Some issues of integrating telepresence technology into
industrial robotic assembly. In: Proceedings of the International Conference on
Control and Automation, Dubai. Citeseer (2009)
24. Samper, D., Santolaria, J., Brosed, F.J., Majarena, A.C., Aguilar, J.J.: Analysis
of Tsai calibration method using two- and three-dimensional calibration objects.
Mach. Vis. Appl. 24(1), 117–131 (2013)
25. Sharma, K., Shirwalkar, V., Pal, P.K.: Intelligent and environment-independent
peg-in-hole search strategies. In: 2013 International Conference on Control,
Automation, Robotics and Embedded Systems (CARE), pp. 1–6. IEEE (2013)
458 A. Sauceda Cienfuegos et al.
26. Tsuruoka, T., Fujioka, H., Moriyama, T., Mayeda, H.: 3D analysis of contact in
peg-hole insertion. In: 1997 IEEE International Symposium on Assembly and Task
Planning, ISATP 1997, pp. 84–89. IEEE (1997)
27. Xia, Y., Yin, Y., Chen, Z.: Dynamic analysis for peg-in-hole assembly with contact
deformation. Int. J. Adv. Manuf. Technol. 30(1–2), 118–128 (2006)
28. Xue, G., Fukuda, T., Arai, F., Asama, H., Kaetsu, H., Endo, I.: Dynami-
cally reconfigurable robotic systemassembly of new type cells as a dual-peg-in-
hole problem. In: Asama, H., Fukuda, T., Arai, T., Endo, I. (eds.) Distributed
Autonomous Robotic Systems, pp. 383–394. Springer, Tokyo (1994). doi:10.1007/
978-4-431-68275-2 34
29. kook Yun, S.: Compliant manipulation for peg-in-hole: is passive compliance a
key to learn contact motion? In: ICRA, pp. 1647–1652. IEEE (2008) http://dblp.
uni-trier.de/db/conf/icra/icra2008.html#Yun08
30. Zhou, J., Georganas, N.D., Petriu, E.M., Shen, X., Marlic, F.: Modelling contact
forces for 3D interactive peg-in-hole virtual reality operations. In: Proceedings of
the Instrumentation and Measurement Technology Conference, IMTC 2008, pp.
1397–1402. IEEE (2008)