TW202411802A - Visual calibrating method for virtual tcp of robotic arm - Google Patents

Visual calibrating method for virtual tcp of robotic arm Download PDF

Info

Publication number
TW202411802A
TW202411802A TW111134357A TW111134357A TW202411802A TW 202411802 A TW202411802 A TW 202411802A TW 111134357 A TW111134357 A TW 111134357A TW 111134357 A TW111134357 A TW 111134357A TW 202411802 A TW202411802 A TW 202411802A
Authority
TW
Taiwan
Prior art keywords
camera
sphere
axis component
robot arm
coordinate system
Prior art date
Application number
TW111134357A
Other languages
Chinese (zh)
Other versions
TWI837822B (en
Inventor
許煥坤
Original Assignee
創博股份有限公司
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 創博股份有限公司 filed Critical 創博股份有限公司
Priority to TW111134357A priority Critical patent/TWI837822B/en
Publication of TW202411802A publication Critical patent/TW202411802A/en
Application granted granted Critical
Publication of TWI837822B publication Critical patent/TWI837822B/en

Links

Images

Landscapes

  • Manipulator (AREA)

Abstract

A visual calibrating method applied by a system including a robotic arm, a camera, and a ball, includes: controlling the robotic arm to move for the ball to enter a screen of the camera on a flange of the robotic arm; controlling the robotic arm to respectively move along each axis and recording ball information to calculate three moving vectors of the ball with respect to a camera-coordinate system; calculating a rotation matrix of the camera-coordinate system with respect to a robot-coordinate system based on the three moving vectors and estimating the orientation of the camera-coordinate system with respect to the flange; controlling the camera to capture clear images of the ball locating at a virtual tool center point (TCP) from different angles and recording multiple calibration-point information; and, calculating an offset of the virtual TCP with respect to the flange based on the multiple calibration-point information.

Description

機器手臂的虛擬工具點的視覺校正方法Visual calibration method for virtual tool points of robot arms

本發明涉及機器手臂,尤其涉及機器手臂的校正方法。The present invention relates to a machine arm, and more particularly to a calibration method for a machine arm.

機器手臂的使用者可以依照實際需求,於法蘭面上裝設對應的工具,藉此利用工具來實現抓取、加工或組裝等作業。The user of the robot arm can install corresponding tools on the flange surface according to actual needs, and use the tools to perform operations such as grasping, processing or assembly.

一般來說,機器手臂具有機器手臂座標系,法蘭面具有法蘭面座標系,而雖然工具設置在法蘭面上,但工具上的工具中心點(Tool Center Point, TCP),例如爪尖,並不是在法蘭面上。因此,在裝設或更換了一個新的工具後,機器手臂的使用者需要對工具進行校正,以獲得工具中心點相對於法蘭面的姿態(orientation)及偏移量(offset)。在得知了所述姿態及偏移量後,機器手臂才能夠對其上的工具進行精準的控制。Generally speaking, the robot arm has a robot arm coordinate system, and the flange surface has a flange surface coordinate system. Although the tool is set on the flange surface, the tool center point (TCP) on the tool, such as the claw tip, is not on the flange surface. Therefore, after installing or replacing a new tool, the user of the robot arm needs to calibrate the tool to obtain the orientation and offset of the tool center point relative to the flange surface. After knowing the orientation and offset, the robot arm can accurately control the tool on it.

一般來說,各式的工具都會使用對應的治具來進行工具中心點的校正。例如,處理器可以控制機器手臂移動,並讓工具中心點觸碰治具上的特定位置,藉此計算工具中心點相對於機器手臂座標系的位置。Generally speaking, various tools use corresponding fixtures to calibrate the tool center point. For example, the processor can control the movement of the robot arm and make the tool center point touch a specific position on the fixture to calculate the position of the tool center point relative to the robot arm coordinate system.

惟,部分的工具並不具有明確的工具中心點。例如,部分使用者會將相機作為工具設置在法蘭面上,以利用相機結合機器手臂來實現光學檢測程序。由於相機不具有實體的工具中心點,因此在相關技術的機器手臂中,將無法直接對相機進行有效的校正程序。However, some tools do not have a clear tool center point. For example, some users will use the camera as a tool to set it on the flange surface to use the camera in combination with the robot arm to implement the optical inspection process. Since the camera does not have a physical tool center point, it is impossible to directly perform an effective calibration process on the camera in the robot arm of the relevant technology.

另一方面,若要於環境中增設額外的感測器來實現相機的校正程序,將會導致成本的增加,因而不受本領域技術人員的青睞。On the other hand, if additional sensors are added to the environment to implement the camera calibration process, it will increase the cost and is therefore not favored by technicians in this field.

本發明的主要目的,在於提供一種機器手臂的虛擬工具點的視覺校正方法,可以不需要設置額外的感測器,而直接對設置在法蘭面上的相機進行校正。The main purpose of the present invention is to provide a method for visually calibrating a virtual tool point of a robot arm, which can directly calibrate a camera set on the flange surface without setting up additional sensors.

為了達成上述目的,本發明的視覺校正方法主要應用於具有一機器手臂、一相機及一球體的一校正系統,其中該機器手臂的一端具有一法蘭面並使用一機器手臂座標系,該相機設置於該法蘭面上並使用一相機座標系,並且該視覺校正方法包括下列步驟:In order to achieve the above-mentioned object, the vision calibration method of the present invention is mainly applied to a calibration system having a robot arm, a camera and a sphere, wherein one end of the robot arm has a flange surface and uses a robot arm coordinate system, the camera is arranged on the flange surface and uses a camera coordinate system, and the vision calibration method includes the following steps:

a)基於該機器手臂座標系控制該機器手臂移動,以令該球體進入該相機的畫面中;a) controlling the movement of the robot arm based on the robot arm coordinate system so that the sphere enters the image of the camera;

b)控制該機器手臂沿著三軸的方向依序進行平移,以記錄該球體的一球體資訊,並基於該球體資訊計算該球體相對於該相機座標系的三組移動向量;b) controlling the robot arm to translate in sequence along the directions of the three axes to record spherical information of the sphere, and calculating three sets of movement vectors of the sphere relative to the camera coordinate system based on the spherical information;

c)基於該三組移動向量計算該相機座標系相對於該機器手臂座標系的一旋轉矩陣,並推算該相機座標系相對於該法蘭面的一姿態;c) calculating a rotation matrix of the camera coordinate system relative to the robot arm coordinate system based on the three sets of motion vectors, and inferring a posture of the camera coordinate system relative to the flange surface;

d)基於該機器手臂座標系及該旋轉矩陣來使用該相機座標系,以控制該相機通過不同角度捕捉該球體的一清晰影像並且記錄至少三筆校正點資訊,其中該清晰影像是於該球體位於該相機前的一虛擬工具點上時被捕捉;d) using the camera coordinate system based on the robot arm coordinate system and the rotation matrix to control the camera to capture a clear image of the sphere at different angles and record at least three calibration point information, wherein the clear image is captured when the sphere is located at a virtual tool point in front of the camera;

e)基於該至少三筆校正點資訊計算該虛擬工具點相對於該法蘭面的一偏移量;及e) calculating an offset of the virtual tool point relative to the flange surface based on the at least three calibration point information; and

f)基於該姿態及該偏移量完成該相機的該虛擬工具點的一校正程序。f) completing a calibration procedure of the virtual tool point of the camera based on the pose and the offset.

本發明將相機安裝至機器手臂上的任意位置以做為機器手臂的工具,並透過視覺方式來直接對相機進行校正。相較於相關技術,本發明在安裝程序上不需要使用特定的安裝治具,也不需要限制相機的安裝位置及角度,提高了使用彈性及便利性。在校正程序上,本發明不需要使用額外的感測器來對相機進行校正,從而降低了校正成本。The present invention installs the camera at any position on the machine arm as a tool of the machine arm, and directly calibrates the camera by visual means. Compared with the related art, the present invention does not require the use of a specific mounting fixture in the installation procedure, nor does it require restrictions on the camera's installation position and angle, thereby improving the flexibility and convenience of use. In the calibration procedure, the present invention does not require the use of additional sensors to calibrate the camera, thereby reducing the calibration cost.

茲就本發明之一較佳實施例,配合圖式,詳細說明如後。A preferred embodiment of the present invention is described in detail below with reference to the drawings.

首請參閱圖1,為本發明的機器手臂的示意圖的具體實施例。本發明揭露了一種機器手臂的虛擬工具點的視覺校正方法(下面將於說明書中簡稱為校正方法),所述校正方法主要應用於一種機器手臂系統。於圖1的實施例中,所述機器手臂系統主要包括機器手臂1、設置於機器手臂1上的相機3,以及任意放置在機器手臂1外部的空間中的球體4。Please refer to FIG. 1 , which is a schematic diagram of a specific embodiment of the robot arm of the present invention. The present invention discloses a method for visually correcting a virtual tool point of a robot arm (hereinafter referred to as the correction method in the specification), and the correction method is mainly applied to a robot arm system. In the embodiment of FIG. 1 , the robot arm system mainly includes a robot arm 1, a camera 3 disposed on the robot arm 1, and a sphere 4 arbitrarily placed in a space outside the robot arm 1.

機器手臂1的一端固定設置於地面或平台上,另一端具備有法蘭面(Flange)2。本發明中,相機3透過非特定的固定手段被設置於法蘭面2的外側。One end of the robot arm 1 is fixedly mounted on the ground or a platform, and the other end is provided with a flange 2. In the present invention, the camera 3 is mounted on the outer side of the flange 2 by non-specific fixing means.

機器手臂1的使用者可以依照實際需求,於法蘭面2上設置對應的工具,例如爪具或螺絲刀等,不加以限定。若使用者欲使用機器手臂1來進行光學檢測,則可將相機3做為工具,安裝於法蘭面2上。一般來說,相機3並不具有實體的工具中心點(Tool Center Point, TCP),因此無法透過一般的校正手段及治具來為相機3進行校正程序。本發明的其中一個技術特徵在於,在不使用額外的感測器的情況下,可藉由視覺方式來直接對機器手臂1上的相機3進行校正。The user of the robot arm 1 can set corresponding tools, such as claws or screwdrivers, on the flange surface 2 according to actual needs, without limitation. If the user wants to use the robot arm 1 for optical inspection, the camera 3 can be installed on the flange surface 2 as a tool. Generally speaking, the camera 3 does not have a physical tool center point (TCP), so it is impossible to calibrate the camera 3 through general calibration means and fixtures. One of the technical features of the present invention is that the camera 3 on the robot arm 1 can be calibrated directly by visual means without using additional sensors.

具體地,由於相機3並不具有一個可以被明確識別的實體工具中心點,因此在將相機3做為機器手臂1的工具的情境中,使用者並不曉得機器手臂1要移動到哪個位置並呈現什麼姿態,才能夠令相機3拍攝到待測物的清晰影像。Specifically, since the camera 3 does not have a clearly identifiable physical tool center point, when the camera 3 is used as a tool of the robot arm 1, the user does not know where the robot arm 1 should move to and what posture it should present in order for the camera 3 to capture a clear image of the object to be measured.

本發明的技術手段是通過測試來確認相機3前方的一個清晰點,並將這個清晰點做為相機3的虛擬工具點(Virtual TCP)。The technical means of the present invention is to confirm a clear point in front of the camera 3 through testing, and use this clear point as a virtual tool point (Virtual TCP) of the camera 3.

具體地,相機3依照其原生規格具有一段清楚的成像範圍,本發明將成像範圍中的一個特定點做為相機3的虛擬工具點。這個虛擬工具點與相機3的本體間存在一個特定的物距,本發明將此物距視為一個實體工具的長度,進而將此物距的端點(即,所述特定點)做為相機3的虛擬工具點。當一個物體位於相機3前方的虛擬工具點上時,相機3可以捕捉這個物體的清晰影像,進而可以實現有效的光學檢測。Specifically, the camera 3 has a clear imaging range according to its native specifications. The present invention uses a specific point in the imaging range as the virtual tool point of the camera 3. There is a specific object distance between the virtual tool point and the body of the camera 3. The present invention regards this object distance as the length of a physical tool, and then uses the end point of this object distance (i.e., the specific point) as the virtual tool point of the camera 3. When an object is located at the virtual tool point in front of the camera 3, the camera 3 can capture a clear image of the object, thereby achieving effective optical detection.

於一實施例中,所述相機3為定焦相機,而具有一段固定的成像範圍,但不以此為限。In one embodiment, the camera 3 is a fixed-focus camera having a fixed imaging range, but the invention is not limited thereto.

為了獲取所述虛擬工具點並且對相機3進行校正,本發明於空間中放置一顆大小適中的球體4。本發明中,只要一顆球體4可以被相機3的畫面全部涵蓋,並且在相機3移動了指定位移量後仍可存在於相機3的畫面中,即可被本發明的機器手臂系統所使用。In order to obtain the virtual tool point and calibrate the camera 3, the present invention places a sphere 4 of moderate size in space. In the present invention, as long as a sphere 4 can be completely covered by the image of the camera 3 and can still exist in the image of the camera 3 after the camera 3 moves a specified displacement, it can be used by the robot arm system of the present invention.

所述球體4必須為正圓形的球體4。The sphere 4 must be a perfect round sphere 4.

如圖1所示,機器手臂1使用機器手臂座標系S1(Xm,Ym,Zm),法蘭面2使用法蘭面座標系S2(Xf,Yf,Zf),相機3使用相機座標系S3(Xc,Yc,Zc),而相機3上的虛擬工具點則使用工具座標系S4(Xt,Yt,Zt)。As shown in FIG1 , the robot arm 1 uses the robot arm coordinate system S1 (Xm, Ym, Zm), the flange surface 2 uses the flange surface coordinate system S2 (Xf, Yf, Zf), the camera 3 uses the camera coordinate system S3 (Xc, Yc, Zc), and the virtual tool point on the camera 3 uses the tool coordinate system S4 (Xt, Yt, Zt).

機器手臂座標系S1與法蘭面座標系S2間的對應關係可透過機器人運動學(robot kinematics)關係來直接獲得,但法蘭面座標系S2與相機座標系S3間的對應關係為未知。其中,相機座標系S3與工具座標系S4設定為相同姿態,僅有偏移量的差別。所述機器人運動學關係為本技術領域中的公知技術,於此不再贅述。The correspondence between the robot arm coordinate system S1 and the flange surface coordinate system S2 can be directly obtained through the robot kinematics relationship, but the correspondence between the flange surface coordinate system S2 and the camera coordinate system S3 is unknown. Among them, the camera coordinate system S3 and the tool coordinate system S4 are set to the same posture, with only the difference in offset. The robot kinematics relationship is a well-known technology in the field of technology and will not be repeated here.

本發明的視覺校正方法主要是透過相機3及球體4來對相機3的虛擬工具點31進行校正,藉此獲得法蘭面座標系S2與相機座標系S3間的對應關係。在獲得了法蘭面座標系S2與相機座標系S3間的對應關係後,機器手臂系統即可基於相機座標系S3來直接對機器手臂1/相機3進行準確的控制。The visual calibration method of the present invention mainly calibrates the virtual tool point 31 of the camera 3 through the camera 3 and the sphere 4, thereby obtaining the corresponding relationship between the flange surface coordinate system S2 and the camera coordinate system S3. After obtaining the corresponding relationship between the flange surface coordinate system S2 and the camera coordinate system S3, the robot arm system can directly control the robot arm 1/camera 3 accurately based on the camera coordinate system S3.

請同時參閱圖1及圖2,其中圖2為本發明的校正方法的流程圖的具體實施例。Please refer to FIG. 1 and FIG. 2 at the same time, wherein FIG. 2 is a flow chart of a specific embodiment of the calibration method of the present invention.

本發明中,使用者在欲使用相機3進行光學檢測時,可將相機3安裝至機器手臂1的法蘭面2上。此時,相機3的虛擬工具點(即,相機3前方一個可以清晰成像的位置,且此位置具有工具座標系S4)相對於法蘭面2的姿態(orientation)及偏移量(offset)是未知的,因此需要先執行本發明的視覺校正方法以獲得所述姿態及偏移量,藉此完成相機3及其虛擬工具點的校正程序。如上所述,相機3具有相機座標系S3而虛擬工具點具有工具座標系S4,且相機座標系S3與工具座標系S4設定為相同姿態。因此,當找出工具座標系S4相對於法蘭面2的姿態後,即可將該姿態代換為相機座標系S3相對於法蘭面2的姿態。換句話說,找出了工具座標系S4相對於法蘭面2的姿態,即代表同時找出了相機座標系S3相對於法蘭面2的姿態,而不需再另外計算。In the present invention, when the user wants to use the camera 3 for optical inspection, the camera 3 can be mounted on the flange surface 2 of the robot arm 1. At this time, the orientation and offset of the virtual tool point of the camera 3 (i.e., a position in front of the camera 3 where a clear image can be obtained, and this position has a tool coordinate system S4) relative to the flange surface 2 are unknown, so it is necessary to first execute the visual calibration method of the present invention to obtain the orientation and offset, thereby completing the calibration procedure of the camera 3 and its virtual tool point. As described above, the camera 3 has a camera coordinate system S3 and the virtual tool point has a tool coordinate system S4, and the camera coordinate system S3 and the tool coordinate system S4 are set to the same orientation. Therefore, once the posture of the tool coordinate system S4 relative to the flange surface 2 is found, the posture can be replaced by the posture of the camera coordinate system S3 relative to the flange surface 2. In other words, finding the posture of the tool coordinate system S4 relative to the flange surface 2 means that the posture of the camera coordinate system S3 relative to the flange surface 2 is also found, without the need for additional calculation.

值得一提的是,本發明的視覺校正方法主要可由使用者手動控制機器手臂1的移動來加以實現,或是由機器手臂系統中的一個處理器(圖未標示)自動控制機器手臂1的移動來實現,不加以限定。為了便於理解本發明,下面將於說明書中以由機器手臂系統的處理器對機器手臂1進行控制的技術方案來進行說明,但並不以此限制本發明的專利範圍。It is worth mentioning that the vision correction method of the present invention can be implemented mainly by the user manually controlling the movement of the robot arm 1, or by a processor (not shown) in the robot arm system automatically controlling the movement of the robot arm 1, without limitation. In order to facilitate the understanding of the present invention, the following technical solution of the robot arm 1 being controlled by the processor of the robot arm system will be described in the specification, but the patent scope of the present invention is not limited thereto.

如圖2所示,首先,機器手臂系統的處理器基於機器手臂座標系S1來控制機器手臂1移動,以令空間中的球體4進入相機3的畫面中(步驟S10)。As shown in FIG. 2 , first, the processor of the robot arm system controls the movement of the robot arm 1 based on the robot arm coordinate system S1 so that the sphere 4 in the space enters the picture of the camera 3 (step S10 ).

如上所述,相機3被安裝在機器手臂1一端的法蘭面2上,因此當機器手臂1移動時,相機3會隨著法蘭面2的移動而改變位置。然而,本發明的其中一個技術特徵在於不使用特定的安裝治具,並且不限制相機3安裝於法蘭面2上的位置及角度,因此相機3相對於法蘭面2的姿態及偏移量是未知的。據於上述原因,處理器於步驟S10中只能基於機器手臂座標系S1來對機器手臂1進行控制,因此機器手臂1的移動向量相對於機器手臂座標系S1和相機座標系S3的表示可能相等或不相等。As described above, the camera 3 is mounted on the flange surface 2 at one end of the robot arm 1, so when the robot arm 1 moves, the camera 3 changes position with the movement of the flange surface 2. However, one of the technical features of the present invention is that no specific mounting fixture is used, and the position and angle of the camera 3 mounted on the flange surface 2 are not limited, so the posture and offset of the camera 3 relative to the flange surface 2 are unknown. Based on the above reasons, the processor can only control the robot arm 1 based on the robot arm coordinate system S1 in step S10, so the movement vector of the robot arm 1 relative to the robot arm coordinate system S1 and the camera coordinate system S3 may be equal or unequal.

接著,處理器基於機器手臂座標系S1繼續控制機器手臂1,以令機器手臂1沿著三軸的方向依序進行平移,並且於平移至定點後記錄球體4的球體資訊(步驟S12)。其中,處理器還可在控制機器手臂1移動前先記錄球體4的初始球體資訊。Next, the processor continues to control the robot arm 1 based on the robot arm coordinate system S1, so that the robot arm 1 sequentially translates along the directions of the three axes, and records the ball information of the ball 4 after translating to a fixed point (step S12). The processor can also record the initial ball information of the ball 4 before controlling the robot arm 1 to move.

具體地,處理器於上述步驟S12中,是在不改變機器手臂1的姿態的前提下,控制機器手臂1沿著機器手臂座標系S1上的x軸、y軸及z軸分別進行三次平移動作。隨著機器手臂1的每一次平移動作,球體4於相機3的畫面中的位置會對應改變。於機器手臂1每一次的平移動作結束時,球體4會分別坐落在畫面中的一個特定參考點。於一實施例中,所述球體資訊(及初始球體資訊)至少包括球體4於相機座標系S3上的參考點位置,以及球體4在相機3的畫面(例如圖3所示的畫面30)中呈現的直徑(容後詳述)。Specifically, in the above step S12, the processor controls the robot arm 1 to perform three translation movements along the x-axis, y-axis and z-axis on the robot arm coordinate system S1 without changing the posture of the robot arm 1. With each translation movement of the robot arm 1, the position of the sphere 4 in the image of the camera 3 will change accordingly. At the end of each translation movement of the robot arm 1, the sphere 4 will be located at a specific reference point in the image. In one embodiment, the sphere information (and the initial sphere information) includes at least the reference point position of the sphere 4 on the camera coordinate system S3, and the diameter of the sphere 4 presented in the image of the camera 3 (such as the image 30 shown in Figure 3) (described in detail later).

值得一提的是,相機3本身使用相機座標系S3,而相機3所讀取到的影像還具有影像座標系(圖未標示)。一般來說,相機座標系S3與相機3內部的影像座標系會因為所拍攝的物體(例如球體4)與相機3間的距離(z軸)不同,而在x軸及y軸方向上有縮小/放大的狀況。在一定的誤差範圍內,可以將相機座標系S3與影像座標系視為相同,但在此前提下,機器手臂1在機器人座標系S1的三個軸向上的運動不能太大。It is worth mentioning that the camera 3 itself uses the camera coordinate system S3, and the image read by the camera 3 also has an image coordinate system (not shown). Generally speaking, the camera coordinate system S3 and the image coordinate system inside the camera 3 will be reduced/enlarged in the x-axis and y-axis directions due to the different distances (z-axis) between the photographed object (such as the sphere 4) and the camera 3. Within a certain error range, the camera coordinate system S3 and the image coordinate system can be regarded as the same, but under this premise, the movement of the robot arm 1 in the three axes of the robot coordinate system S1 cannot be too large.

若將相機座標系S3與影像座標系視為相同,則處理器可將相機3使用內部的影像座標系感測到的影像資料直接當做相機座標系S3上的資料,並進行後續的計算程序。若將相機座標系S3與影像座標系視為不同座標系,則處理器在相機3使用內部的影像座標系感測到了影像資料後,先透過一個縮小/放大的轉換關係將影像座標系上的影像資料轉換到相機座標系S3上後,再使用轉換後的資料進行後續的計算程序。If the camera coordinate system S3 and the image coordinate system are considered the same, the processor can directly treat the image data sensed by the camera 3 using the internal image coordinate system as the data on the camera coordinate system S3 and perform subsequent calculation procedures. If the camera coordinate system S3 and the image coordinate system are considered different coordinate systems, after the camera 3 senses the image data using the internal image coordinate system, the processor first converts the image data on the image coordinate system to the camera coordinate system S3 through a reduction/enlargement conversion relationship, and then uses the converted data to perform subsequent calculation procedures.

為了便於理解,下面以將相機座標系S3與影像座標系視為相同座標系的技術手段,進行說明,但並不以此為限。For ease of understanding, the following description is made using a technical approach in which the camera coordinate system S3 and the image coordinate system are considered to be the same coordinate system, but the invention is not limited thereto.

步驟S12後,處理器可基於四筆球體資訊(包括一筆在起點記錄的初始球體資訊與三筆從起點移動三個方向至定點後記錄的球體資訊)來計算球體4相對於相機座標系S3的三組移動向量 (步驟S14)。於步驟S14中,處理器分別將三個移動後的定點的資訊減去起點的資訊,以獲得三組移動向量,其中這三組移動向量分別對應至球體4於相機座標系S3上的移動。After step S12, the processor can calculate three sets of motion vectors of the sphere 4 relative to the camera coordinate system S3 based on four pieces of sphere information (including one piece of initial sphere information recorded at the starting point and three pieces of sphere information recorded after moving from the starting point to the fixed point in three directions) (step S14). In step S14, the processor subtracts the information of the starting point from the information of the three moved fixed points to obtain three sets of motion vectors, wherein the three sets of motion vectors correspond to the movement of the sphere 4 on the camera coordinate system S3.

值得一提的是,本發明主要是將球體4在相機3的畫面中的態樣記錄成所述球體資訊,然而相機3的畫面30僅能描繪一個二維空間,並且相機3所拍攝的影像為2D影像,無法表現深度資訊(即,只能看到相機座標系S3上的X軸及Y軸的像素),因此上述移動向量中的z軸分量將是未知的。對此,機器手臂系統的處理器還需透過球體資訊以及三組移動向量中的x軸分量以及y軸分量來計算出正確的z軸分量(容後詳述)。It is worth mentioning that the present invention mainly records the state of the sphere 4 in the image of the camera 3 as the sphere information. However, the image 30 of the camera 3 can only depict a two-dimensional space, and the image taken by the camera 3 is a 2D image, which cannot express depth information (that is, only the pixels of the X-axis and Y-axis on the camera coordinate system S3 can be seen). Therefore, the z-axis component in the above-mentioned motion vector will be unknown. In this regard, the processor of the robot arm system needs to calculate the correct z-axis component through the sphere information and the x-axis component and y-axis component in the three sets of motion vectors (described in detail later).

步驟S14後,處理器可基於所述三組移動向量來計算相機座標系S3相對於機器手臂座標系S1的旋轉矩陣,並且可推算出相機座標系S3相對於法蘭面2的姿態(步驟S16)。更具體地,工具座標系S4與相機座標系S3係設定為相同姿態,因此處理器於步驟S16中可同時推算出相機座標系S3相對於法蘭面2的姿態以及工具座標系S4相對於法蘭面2的姿態。After step S14, the processor can calculate the rotation matrix of the camera coordinate system S3 relative to the robot arm coordinate system S1 based on the three sets of motion vectors, and can infer the posture of the camera coordinate system S3 relative to the flange surface 2 (step S16). More specifically, the tool coordinate system S4 and the camera coordinate system S3 are set to the same posture, so the processor can simultaneously infer the posture of the camera coordinate system S3 relative to the flange surface 2 and the posture of the tool coordinate system S4 relative to the flange surface 2 in step S16.

具體地,機器手臂座標系S1與法蘭面座標系S2間的對應關係可透過機器人運動學關係來獲得,故可視為一筆已知資訊。據此,當處理器計算取得相機座標系S3相對於機器手臂座標系S1的旋轉矩陣後,即可基於機器手臂座標系S1、所述旋轉矩陣以及機器人運動學關係來推算出相機座標系S3相對於法蘭面2的姿態。Specifically, the correspondence between the robot arm coordinate system S1 and the flange surface coordinate system S2 can be obtained through the robot kinematics relationship, so it can be regarded as a known information. Accordingly, when the processor calculates the rotation matrix of the camera coordinate system S3 relative to the robot arm coordinate system S1, the posture of the camera coordinate system S3 relative to the flange surface 2 can be inferred based on the robot arm coordinate system S1, the rotation matrix and the robot kinematics relationship.

在步驟S16後,處理器即可獲得相機3相對於法蘭面2的姿態,同時也可得知工具座標系S4對於法蘭面座標系S2的姿態。若要完成對相機3的校正程序,還需要進一步獲得虛擬工具點31相對於法蘭面2的偏移量。After step S16, the processor can obtain the posture of the camera 3 relative to the flange surface 2, and also know the posture of the tool coordinate system S4 relative to the flange surface coordinate system S2. To complete the calibration procedure for the camera 3, it is necessary to further obtain the offset of the virtual tool point 31 relative to the flange surface 2.

步驟S16後,處理器可基於機器手臂座標系S1以及所述旋轉矩陣來使用相機座標系S3直接控制相機3,令相機3透過至少三個不同的角度捕捉球體4的清晰影像,並且記錄至少三筆校正點資訊(步驟S18)。本發明中,若相機3受控制而移動至一特定位置,並且可以捕捉到球體4的清晰影像,則處理器可假定球體4的當前位置坐落在相機3前方的虛擬工具點31上。After step S16, the processor can directly control the camera 3 using the camera coordinate system S3 based on the robot arm coordinate system S1 and the rotation matrix, so that the camera 3 captures clear images of the sphere 4 from at least three different angles and records at least three calibration point information (step S18). In the present invention, if the camera 3 is controlled to move to a specific position and can capture a clear image of the sphere 4, the processor can assume that the current position of the sphere 4 is located on the virtual tool point 31 in front of the camera 3.

於一實施例中,所述捕捉動作指的是讓球體4於相機3的畫面30中清晰成像。於另一實施例中,所述捕捉動作指的是由相機3直接拍攝球體4的影像。惟,上述僅為本發明的部分具體實施範例,但不以此為限。In one embodiment, the capturing action refers to making the sphere 4 clearly imaged in the picture 30 of the camera 3. In another embodiment, the capturing action refers to directly photographing the image of the sphere 4 by the camera 3. However, the above are only some specific implementation examples of the present invention, but are not limited thereto.

所述校正點資訊可例如包括當球體4坐落在虛擬工具點31上時,機器手臂1所呈現的姿態。並且,所述校正點資訊還可例如包括球體4在畫面30中的座標,以及球體4在畫面30中呈現的直徑(容後詳述)。The calibration point information may include, for example, the posture of the robot arm 1 when the sphere 4 is located on the virtual tool point 31. In addition, the calibration point information may also include, for example, the coordinates of the sphere 4 in the picture 30 and the diameter of the sphere 4 in the picture 30 (described in detail later).

如上所述,所有校正點資訊都是於球體4坐落在虛擬工具點31上時被記錄的,因此基於這些校正點資訊,處理器即可計算出虛擬工具點31相對於法蘭面2的偏移量(步驟S20)。As described above, all the calibration point information is recorded when the sphere 4 is located on the virtual tool point 31, so based on the calibration point information, the processor can calculate the offset of the virtual tool point 31 relative to the flange surface 2 (step S20).

最後,在於步驟S16中獲得了相機座標系S3相對於法蘭面2的姿態(相同於工具座標系S4相對於法蘭面2的姿態),並且於步驟S20中獲得了虛擬工具點31相對於法蘭面2的偏移量後,處理器即可基於所述姿態及所述偏移量來完成對相機3/虛擬工具點31的校正程序(步驟S22)。Finally, after obtaining the posture of the camera coordinate system S3 relative to the flange surface 2 (the same as the posture of the tool coordinate system S4 relative to the flange surface 2) in step S16 and obtaining the offset of the virtual tool point 31 relative to the flange surface 2 in step S20, the processor can complete the calibration procedure of the camera 3/virtual tool point 31 based on the posture and the offset (step S22).

於所述校正程序完成後,機器手臂系統即可透過工具座標系S4來直接控制虛擬工具點移動,以令待測物坐落在相機3前方的虛擬工具點31上,藉此讓相機3拍攝待測物的清晰影像,進而可以實現有效的光學檢測。After the calibration procedure is completed, the robot arm system can directly control the movement of the virtual tool point through the tool coordinate system S4 so that the object to be tested is located on the virtual tool point 31 in front of the camera 3, so that the camera 3 can capture a clear image of the object to be tested, thereby achieving effective optical detection.

續請同時參閱圖3、圖4及圖5,其中圖3為本發明的相機移動示意圖的具體實施例,圖4為本發明的相機座標系的示意圖的具體實施例,圖5為本發明的旋轉矩陣的建立流程圖的具體實施例。圖5用來對圖2中的步驟S10至步驟S16做更進一步的詳細說明。Please refer to FIG. 3, FIG. 4 and FIG. 5 simultaneously, wherein FIG. 3 is a specific embodiment of the camera movement schematic diagram of the present invention, FIG. 4 is a specific embodiment of the camera coordinate system schematic diagram of the present invention, and FIG. 5 is a specific embodiment of the rotation matrix establishment flow chart of the present invention. FIG. 5 is used to further explain step S10 to step S16 in FIG. 2 in detail.

如圖3所示,在要計算相機座標系S3/工具座標系S4相對於法蘭面2的姿態時,首先由處理器基於機器手臂座標系S1控制機器手臂1移動,以令球體4位於相機3的畫面30中的一個初始參考點p0c,並且記錄初始參考點p0c在相機座標系S3中的初始座標及球體4於畫面30中的初始直徑(步驟S30)。As shown in FIG3 , when calculating the posture of the camera coordinate system S3/tool coordinate system S4 relative to the flange surface 2, the processor first controls the movement of the robot arm 1 based on the robot arm coordinate system S1 so that the sphere 4 is located at an initial reference point p0c in the image 30 of the camera 3, and records the initial coordinates of the initial reference point p0c in the camera coordinate system S3 and the initial diameter of the sphere 4 in the image 30 (step S30).

參照圖3及圖4的實施例,所述初始參考點p0c的初始座標可例如為(p0cx,p0cy,p0cz),所述初始直徑可例如為d0。具體地,本發明的機器手臂系統可以透過影像處理功能來於相機3的畫面30中對球體4進行定位,藉此獲取初始參考點p0c的初始座標以及初始直徑,但不加以限定。3 and 4, the initial coordinates of the initial reference point p0c may be, for example, (p0cx, p0cy, p0cz), and the initial diameter may be, for example, d0. Specifically, the robot arm system of the present invention may locate the sphere 4 in the image 30 of the camera 3 through the image processing function, thereby obtaining the initial coordinates and initial diameter of the initial reference point p0c, but this is not limited.

接著,處理器控制機器手臂1沿著x軸平移第一指定向量Lx(不一定像圖3所示一樣與影像軸平行),以令球體4位於相機3的畫面30中的第一參考點p1c,並且記錄第一參考點p1c在相機座標系S3上的第一座標及球體4於畫面30中的第一直徑(步驟S32)。Next, the processor controls the robot arm 1 to translate the first specified vector Lx along the x-axis (not necessarily parallel to the image axis as shown in FIG. 3 ) so that the sphere 4 is located at the first reference point p1c in the image 30 of the camera 3, and records the first coordinate of the first reference point p1c on the camera coordinate system S3 and the first diameter of the sphere 4 in the image 30 (step S32).

本實施例中,所述平移動作指的是控制機器手臂1僅進行x軸方向上的移動,在y軸方向及z軸方向上皆不移動,並且不改變機器手臂1的姿態。此處的x軸方向、y軸方向和z軸方向皆是參考於機器手臂座標系S1。In this embodiment, the translation motion refers to controlling the robot arm 1 to move only in the x-axis direction, without moving in the y-axis direction and the z-axis direction, and without changing the posture of the robot arm 1. The x-axis direction, y-axis direction and z-axis direction here are all referenced to the robot arm coordinate system S1.

機器手臂1沿著x軸方向平移了第一指定向量Lx的距離,意謂著球體4相對於相機3沿著反方向平移了第一指定向量Lx的距離(即,球體4相對於相機3的運動參考於機器手臂座標系S1是(-Lx,0,0)的向量)。參照圖3及圖4的實施例,所述第一參考點p1c的第一座標可例如為(p1cx,p1cy,p1cz)。具體地,本發明的機器手臂系統可以透過影像處理功能來於相機3的畫面30中對球體4進行定位,並獲取第一參考點p1c的第一座標的x軸分量、y軸分量以及球體4的第一直徑,但不加以限定。The robot arm 1 translates the distance of the first specified vector Lx along the x-axis direction, which means that the sphere 4 translates the distance of the first specified vector Lx along the opposite direction relative to the camera 3 (that is, the movement of the sphere 4 relative to the camera 3 is a vector (-Lx, 0, 0) with reference to the robot arm coordinate system S1). Referring to the embodiments of Figures 3 and 4, the first coordinate of the first reference point p1c can be, for example, (p1cx, p1cy, p1cz). Specifically, the robot arm system of the present invention can locate the sphere 4 in the image 30 of the camera 3 through the image processing function, and obtain the x-axis component and y-axis component of the first coordinate of the first reference point p1c and the first diameter of the sphere 4, but is not limited thereto.

另外,雖然機器手臂1並沒有沿著z軸方向移動,但是球體4相對於相機3的姿態是未知的,因此在機器手臂1移動了第一指定向量Lx的距離後,球體4於畫面30中的尺寸可能會有所改變(亦可能不變)。如圖3所示,所述第一直徑可例如為d1,其中第一直徑d1可能大於、小於或等於初始直徑d0。In addition, although the robot arm 1 does not move along the z-axis direction, the posture of the sphere 4 relative to the camera 3 is unknown, so after the robot arm 1 moves the distance of the first specified vector Lx, the size of the sphere 4 in the image 30 may change (or may not change). As shown in FIG. 3 , the first diameter may be, for example, d1, wherein the first diameter d1 may be greater than, less than, or equal to the initial diameter d0.

接著,處理器控制機器手臂1沿著y軸平移第二指定向量Ly(不一定像圖3所示一樣與影像軸平行),以令球體4位於相機3的畫面30中的一個第二參考點p2c,並且記錄第二參考點p2c於相機座標系S3上的第二座標及球體4於畫面30中的第二直徑(步驟S34)。步驟S34中執行的平移動作控制機器手臂1僅於y軸方向移動,在x軸方向及z軸方向上皆不移動,並且不改變機器手臂1的姿態。此處的x軸方向、y軸方向和z軸方向皆是參考於機器手臂座標系S1。Next, the processor controls the robot arm 1 to translate the second specified vector Ly along the y-axis (not necessarily parallel to the image axis as shown in FIG. 3 ) so that the sphere 4 is located at a second reference point p2c in the image 30 of the camera 3, and records the second coordinate of the second reference point p2c on the camera coordinate system S3 and the second diameter of the sphere 4 in the image 30 (step S34). The translation action executed in step S34 controls the robot arm 1 to move only in the y-axis direction, and does not move in the x-axis direction and the z-axis direction, and does not change the posture of the robot arm 1. The x-axis direction, y-axis direction and z-axis direction here are all referenced to the robot arm coordinate system S1.

在機器手臂1沿著y軸方向平移了第二指定向量Ly的距離後,球體4即相對相機3沿著反方向平移了第二指定向量Ly的距離(即,球體4相對於相機3的運動參考於機器手臂座標系S1是(0,-Ly,0)的向量)。如圖3及圖4所示,所述第二參考點p2c的第二座標可例如為(p2cx,p2cy,p2cz)。具體地,本發明的機器手臂系統可以透過影像處理功能來於相機3的畫面30中對球體4進行定位,並獲取第二參考點p2c的第二座標的x軸分量、y軸分量以及球體4的第二直徑,但不加以限定。After the robot arm 1 translates the distance of the second specified vector Ly along the y-axis direction, the sphere 4 translates the distance of the second specified vector Ly along the opposite direction relative to the camera 3 (that is, the movement of the sphere 4 relative to the camera 3 is referenced to the vector (0, -Ly, 0) of the robot arm coordinate system S1). As shown in Figures 3 and 4, the second coordinate of the second reference point p2c can be, for example, (p2cx, p2cy, p2cz). Specifically, the robot arm system of the present invention can locate the sphere 4 in the image 30 of the camera 3 through the image processing function, and obtain the x-axis component and y-axis component of the second coordinate of the second reference point p2c and the second diameter of the sphere 4, but it is not limited to this.

另外,當機器手臂1移動了第二指定向量Ly後,球體4於畫面30中的尺寸可能會有所改變(亦可能不變)。如圖3所示,所述第二直徑可例如為d2,其中第二直徑d2可能大於、小於或等於初始直徑d0。In addition, when the robot arm 1 moves the second designated vector Ly, the size of the sphere 4 in the image 30 may change (or may not change). As shown in FIG3 , the second diameter may be, for example, d2, wherein the second diameter d2 may be greater than, less than, or equal to the initial diameter d0.

接著,處理器控制機器手臂1沿著z軸平移第三指定向量Lz(不一定像圖3所示一樣與影像軸平行),以令球體4位於相機3的畫面30中的一個第三參考點p3c,並且記錄第三參考點p3c於相機座標系S3上的第三座標以及球體4於畫面30中的第三直徑(步驟S36)。步驟S36中執行的平移動作控制機器手臂1僅於z軸方向移動,在x軸方向及y軸方向上皆不移動,並且不改變機器手臂1的姿態。此處的x軸方向、y軸方向和z軸方向皆是參考於機器手臂座標系S1。Next, the processor controls the robot arm 1 to translate the third specified vector Lz along the z-axis (not necessarily parallel to the image axis as shown in FIG. 3 ) so that the sphere 4 is located at a third reference point p3c in the image 30 of the camera 3, and records the third coordinate of the third reference point p3c on the camera coordinate system S3 and the third diameter of the sphere 4 in the image 30 (step S36). The translation action executed in step S36 controls the robot arm 1 to move only in the z-axis direction, and does not move in the x-axis direction and the y-axis direction, and does not change the posture of the robot arm 1. The x-axis direction, the y-axis direction and the z-axis direction here are all referenced to the robot arm coordinate system S1.

在機器手臂1沿著z軸方向平移了第三指定向量Lz的距離後,球體4即相對相機3沿著反方向平移了第三指定向量Lz的距離(即,球體4相對於相機3的運動參考於機器手臂座標系S1是(0,0,-Lz)的向量)。如圖3及圖4所示,所述第三參考點p3c的第三座標可例如為(p3cx,p3cy,p3cz)。具體地,本發明的機器手臂系統可以透過影像處理功能來於相機3的畫面30中對球體4進行定位,並獲取第三參考點p3c的第三座標的x軸分量、y軸分量以及球體4的第三直徑,但不加以限定。After the robot arm 1 translates the distance of the third specified vector Lz along the z-axis direction, the sphere 4 translates the distance of the third specified vector Lz along the opposite direction relative to the camera 3 (that is, the movement of the sphere 4 relative to the camera 3 is referenced to the vector (0,0,-Lz) of the robot arm coordinate system S1). As shown in Figures 3 and 4, the third coordinate of the third reference point p3c can be, for example, (p3cx, p3cy, p3cz). Specifically, the robot arm system of the present invention can locate the sphere 4 in the image 30 of the camera 3 through the image processing function, and obtain the x-axis component and y-axis component of the third coordinate of the third reference point p3c and the third diameter of the sphere 4, but it is not limited to this.

另外,當機器手臂1移動了第三指定向量Lz後,球體4於畫面30中的尺寸可能會有所改變(亦可能不變)。如圖3所示,所述第三直徑可例如為d3,其中第三直徑d3可能大於、小於或等於初始直徑d0。In addition, after the robot arm 1 moves the third designated vector Lz, the size of the sphere 4 in the picture 30 may change (or may not change). As shown in FIG3 , the third diameter may be, for example, d3, wherein the third diameter d3 may be greater than, less than, or equal to the initial diameter d0.

於上述步驟S34中,處理器可以於球體4位於第一參考點p1c上時,直接控制機器手臂1沿著y軸方向平移第二指定向量Ly的距離,或是先控制機器手臂1移動以令球體4回到初始參考點p0c後,再控制機器手臂1沿著y軸方向平移第二指定向量Ly的距離。In the above step S34, the processor can directly control the robot arm 1 to translate the distance of the second specified vector Ly along the y-axis direction when the sphere 4 is located at the first reference point p1c, or first control the robot arm 1 to move so that the sphere 4 returns to the initial reference point p0c, and then control the robot arm 1 to translate the distance of the second specified vector Ly along the y-axis direction.

相似地,於上述步驟S36中,處理器可以於球體4位於第二參考點p2c上時,直接控制機器手臂1沿著z軸方向平移第三指定向量Lz的距離,或是先控制機器手臂1移動以令球體4回到初始參考點p0c後,再控制機器手臂1沿著z軸方向平移第三指定向量Lz的距離。Similarly, in the above step S36, the processor can directly control the robot arm 1 to translate the distance of the third specified vector Lz along the z-axis direction when the sphere 4 is located at the second reference point p2c, or first control the robot arm 1 to move so that the sphere 4 returns to the initial reference point p0c, and then control the robot arm 1 to translate the distance of the third specified vector Lz along the z-axis direction.

惟,上述僅為本發明的部分具體實施範例,但並不以此為限。However, the above are only some specific implementation examples of the present invention, but are not limited thereto.

值得一提的是,上述步驟S32、步驟S34及步驟S36的目的在於記錄三筆球體資訊(即,球體4於相機座標系S3上的座標的x軸分量與y軸分量以及於畫面30上呈現的直徑),因此處理器可以依照任意順序來執行步驟S32、步驟S34及步驟S36。換句話說,步驟S32、步驟S34及步驟S36並不具有必然的執行順序關係,而不以圖5所示的順序為限。另外,上述步驟S30的目的則在於記錄一筆初始球體資訊。It is worth mentioning that the purpose of the above steps S32, S34 and S36 is to record three pieces of sphere information (i.e., the x-axis component and the y-axis component of the coordinates of the sphere 4 on the camera coordinate system S3 and the diameter presented on the screen 30), so the processor can execute steps S32, S34 and S36 in any order. In other words, steps S32, S34 and S36 do not have a necessary execution order relationship and are not limited to the order shown in Figure 5. In addition, the purpose of the above step S30 is to record an initial sphere information.

步驟S36後,處理器取得了球體4的四筆球體資訊(包含初始球體資訊),並可基於四筆球體資訊計算球體4相對於相機座標系S3的三組移動向量(步驟S38)。After step S36, the processor obtains four pieces of sphere information (including initial sphere information) of the sphere 4, and can calculate three sets of movement vectors of the sphere 4 relative to the camera coordinate system S3 based on the four pieces of sphere information (step S38).

更具體地,若處理器在控制機器手臂1移動前需先回到初始參考點p0c,則在步驟S38中,處理器是基於四筆球體資訊(包含在初始參考點p0c上取得的初始球體資訊)來計算球體4相對於相機座標系S3的三組移動向量。惟,上述僅為本發明的其中一個具體實施範例,但並不以此為限。More specifically, if the processor needs to return to the initial reference point p0c before controlling the robot arm 1 to move, then in step S38, the processor calculates three sets of movement vectors of the sphere 4 relative to the camera coordinate system S3 based on four pieces of sphere information (including the initial sphere information obtained at the initial reference point p0c). However, the above is only one specific implementation example of the present invention, but is not limited thereto.

具體地,上述步驟S38主要是依據初始參考點p0c的初始座標、第一參考點p1c的第一座標、第二參考點p2c的第二座標、第三參考點p3c的第三座標、初始直徑d0、第一直徑d1、第二直徑d2及第三直徑d3來計算三組移動向量。所述三組移動向量包括第一移動向量、第二移動向量及第三移動向量,其中第一移動向量由第一x軸分量、第一y軸分量及第一z軸分量組成,第二移動向量由第二x軸分量、第二y軸分量及第二z軸分量組成,而第三移動向量由第三x軸分量、第三y軸分量及第三z軸分量組成。Specifically, the above step S38 mainly calculates three sets of movement vectors according to the initial coordinates of the initial reference point p0c, the first coordinates of the first reference point p1c, the second coordinates of the second reference point p2c, the third coordinates of the third reference point p3c, the initial diameter d0, the first diameter d1, the second diameter d2 and the third diameter d3. The three sets of movement vectors include a first movement vector, a second movement vector and a third movement vector, wherein the first movement vector is composed of a first x-axis component, a first y-axis component and a first z-axis component, the second movement vector is composed of a second x-axis component, a second y-axis component and a second z-axis component, and the third movement vector is composed of a third x-axis component, a third y-axis component and a third z-axis component.

以圖4為例,在步驟S38中,處理器主要可以依據第一座標(例如(p1cx,p1cy,p1cz))與初始座標(例如(p0cx,p0cy,p0cz))的差值來計算第一移動向量中的第一x軸分量以及第一y軸分量,依據第二座標(例如(p2cx,p2cy,p2cz))與初始座標(例如(p0cx,p0cy,p0cz))的差值來計算第二移動向量中的第二x軸分量以及第二y軸分量,並依據第三座標(例如(p3cx,p3cy,p3cz))與初始座標(例如(p0cx,p0cy,p0cz))的差值來計算第三移動向量中的第三x軸分量以及第三y軸分量。Taking Figure 4 as an example, in step S38, the processor can mainly calculate the first x-axis component and the first y-axis component in the first motion vector according to the difference between the first coordinate (e.g., (p1cx, p1cy, p1cz)) and the initial coordinate (e.g., (p0cx, p0cy, p0cz)), calculate the second x-axis component and the second y-axis component in the second motion vector according to the difference between the second coordinate (e.g., (p2cx, p2cy, p2cz)) and the initial coordinate (e.g., (p0cx, p0cy, p0cz)), and calculate the third x-axis component and the third y-axis component in the third motion vector according to the difference between the third coordinate (e.g., (p3cx, p3cy, p3cz)) and the initial coordinate (e.g., (p0cx, p0cy, p0cz)).

值得一提的是,上述步驟S30至步驟S36所記錄的球體資訊,主要包括在相機3的畫面30中對球體4進行定位後所獲得的座標位置,但相機3的畫面30屬於二維空間而無法表現深度資訊。也就是說,透過計算初始座標與第一座標、第二座標以及第三座標的差值,無法直接獲得三組移動向量中的z軸分量。It is worth mentioning that the sphere information recorded in the above steps S30 to S36 mainly includes the coordinate position obtained after positioning the sphere 4 in the image 30 of the camera 3, but the image 30 of the camera 3 belongs to a two-dimensional space and cannot express depth information. In other words, by calculating the difference between the initial coordinates and the first coordinates, the second coordinates and the third coordinates, the z-axis component of the three sets of movement vectors cannot be directly obtained.

上述初始座標、第一座標、第二座標及第三座標是在基於機器手臂座標系S1控制機器手臂1的移動後所記錄下來的座標。根據座標系的三軸正交關係,可以獲得下列三個方程式。本發明中,處理器可以基於所述第一x軸分量、第一y軸分量、第二x軸分量、第二y軸分量、第三x軸分量及第三y軸分量來執行下列三個方程式,藉此獲得三組移動向量中的第一z軸分量、第二z軸分量及第三z軸分量。當第一z軸分量、第二z軸分量及第三z軸分量計算完成後,處理器即可獲得完整的第一移動向量(例如可表示為(a1,b1,c1))、第二移動向量(例如可表示為(a2,b2,c2))以及第三移動向量(例如可表示為(a3,b3,c3))(步驟S40)。The above initial coordinates, first coordinates, second coordinates and third coordinates are the coordinates recorded after controlling the movement of the robot arm 1 based on the robot arm coordinate system S1. According to the orthogonal relationship of the three axes of the coordinate system, the following three equations can be obtained. In the present invention, the processor can execute the following three equations based on the first x-axis component, the first y-axis component, the second x-axis component, the second y-axis component, the third x-axis component and the third y-axis component to obtain the first z-axis component, the second z-axis component and the third z-axis component in three sets of movement vectors. After the first z-axis component, the second z-axis component and the third z-axis component are calculated, the processor can obtain the complete first movement vector (for example, represented by (a1, b1, c1)), the second movement vector (for example, represented by (a2, b2, c2)) and the third movement vector (for example, represented by (a3, b3, c3)) (step S40).

第一方程式:c1c2 = –a1a2 – b1b2。First equation: c1c2 = –a1a2 – b1b2.

第二方程式:c2c3 = –a2a3 – b2b3。Second equation: c2c3 = –a2a3 – b2b3.

第三方程式:c1c3 = –a1a3 – b1b3。The third equation: c1c3 = –a1a3 – b1b3.

於上述方程式中,a1為第一x軸分量、a2為第二x軸分量、a3為第三x軸分量、b1為第一y軸分量、b2為第二y軸分量、b3為第三y軸分量、c1為第一z軸分量、c2為第二z軸分量,而c3為第三z軸分量。In the above equation, a1 is the first x-axis component, a2 is the second x-axis component, a3 is the third x-axis component, b1 is the first y-axis component, b2 is the second y-axis component, b3 is the third y-axis component, c1 is the first z-axis component, c2 is the second z-axis component, and c3 is the third z-axis component.

值得一提的是,透過上述第一方程式、第二方程式及第三方程式,將會分別求得兩組第一z軸分量、兩組第二z軸分量以及兩組第三z軸分量,其中包括第一組(c1, c2, c3)的解以及第二組(c1, c2, c3)的解,並且兩組解會相差一個負號。例如,若第一組解為(2, 3, -4),則第二組解即為(-2, -3, 4)。換句話說,當第一z軸分量(c1)、第二z軸分量(c2)以及第三z軸分量(c3)的其中之一被確定後,另外兩個分量的正負號即可被確定。It is worth mentioning that through the above-mentioned first equation, second equation and third-party program, two sets of first z-axis components, two sets of second z-axis components and two sets of third z-axis components will be obtained respectively, including the solution of the first set (c1, c2, c3) and the solution of the second set (c1, c2, c3), and the two sets of solutions will differ by a negative sign. For example, if the first set of solutions is (2, 3, -4), then the second set of solutions is (-2, -3, 4). In other words, when one of the first z-axis component (c1), the second z-axis component (c2) and the third z-axis component (c3) is determined, the positive and negative signs of the other two components can be determined.

於上述步驟S40中,處理器主要可以透過比較第一直徑d1與初始直徑d0的大小來判斷球體4由初始參考點p0c移動至第一參考點p1c時是遠離相機3或靠近相機3,進而決定要使用第一z軸分量的負解或正解。In the above step S40, the processor can mainly judge whether the sphere 4 is far away from or close to the camera 3 when moving from the initial reference point p0c to the first reference point p1c by comparing the first diameter d1 with the initial diameter d0, and then decide to use the negative solution or positive solution of the first z-axis component.

舉例來說,若第一直徑d1大於初始直徑d0,代表球體4從初始參考點p0c移動至第一參考點p1c時是靠近相機3,此時處理器會取第一z軸分量的正解。反之,若第一直徑d1小於初始直徑d0,代表球體4從初始參考點p0c移動至第一參考點p1c時是遠離相機3,此時處理器會取第一z軸分量的負解。For example, if the first diameter d1 is larger than the initial diameter d0, it means that the sphere 4 is close to the camera 3 when it moves from the initial reference point p0c to the first reference point p1c, and the processor will take the positive solution of the first z-axis component. On the contrary, if the first diameter d1 is smaller than the initial diameter d0, it means that the sphere 4 is far away from the camera 3 when it moves from the initial reference point p0c to the first reference point p1c, and the processor will take the negative solution of the first z-axis component.

當處理器經由上述計算方法判斷需取用第一z軸分量的正解時,即可同時確定第二z軸分量以及第三z軸分量的正負號。例如,若第一組(c1, c2, c3)的解整體乘積為正,且需取用第一z軸分量的正解,則處理器可同時確定需取用第二z軸分量的正解以及第三z軸分量的正解,或是取用第二z軸分量的負解以及第三z軸分量的負解。再例如,若第一組(c1, c2, c3)的解整體乘積為負,且需取用第一z軸分量的正解,則處理器可同時確定需取用第二z軸分量的正解以及第三z軸分量的負解,或是取用第二z軸分量的負解以及第三z軸分量的正解。When the processor determines through the above calculation method that the positive solution of the first z-axis component needs to be used, the positive and negative signs of the second z-axis component and the third z-axis component can be determined at the same time. For example, if the overall product of the solutions of the first group (c1, c2, c3) is positive and the positive solution of the first z-axis component needs to be used, the processor can simultaneously determine that the positive solution of the second z-axis component and the positive solution of the third z-axis component need to be used, or the negative solution of the second z-axis component and the negative solution of the third z-axis component need to be used. For another example, if the overall product of the solutions of the first group (c1, c2, c3) is negative and the positive solution of the first z-axis component is required, the processor can simultaneously determine whether the positive solution of the second z-axis component and the negative solution of the third z-axis component are required, or whether the negative solution of the second z-axis component and the positive solution of the third z-axis component are required.

相對地,當處理器經由上述計算方法判斷需取用第一z軸分量的負解時,即可按照上述之相同邏輯來同時確定第二z軸分量以及第三z軸分量的正負號。In contrast, when the processor determines through the above calculation method that the negative solution of the first z-axis component needs to be used, the positive and negative signs of the second z-axis component and the third z-axis component can be simultaneously determined according to the same logic as above.

於上述步驟S40中,處理器亦可比較第二直徑d2與初始直徑d0的大小來判斷球體4由初始參考點p0c移動至第二參考點p2c時是遠離相機3或靠近相機3,進而決定要取用第二z軸分量的負解或正解。或者,處理器亦可比較第三直徑d3與初始直徑d0的大小來判斷球體4由初始參考點p0c移動至第三參考點p3c時是遠離相機3或靠近相機3,進而決定要取用第三z軸分量的負解或正解。In the above step S40, the processor can also compare the second diameter d2 with the initial diameter d0 to determine whether the sphere 4 is far away from the camera 3 or close to the camera 3 when it moves from the initial reference point p0c to the second reference point p2c, and then decide to use the negative solution or positive solution of the second z-axis component. Alternatively, the processor can also compare the third diameter d3 with the initial diameter d0 to determine whether the sphere 4 is far away from the camera 3 or close to the camera 3 when it moves from the initial reference point p0c to the third reference point p3c, and then decide to use the negative solution or positive solution of the third z-axis component.

如前文所述,基於方程式求解程序,處理器在上述步驟S40中只要確認要取用第一z軸分量、第二z軸分量及第三z軸分量的其中之一的正解或是負解,就可以同時確定另外兩個分量要取用正解或是負解。因此,處理器於步驟S40中可以使用讓直徑有明顯變化的移動向量來判斷要使用對應的z軸分量的正解或負解,而不需要分別對三個z軸分量都進行正負號的判斷。As described above, based on the equation solving procedure, the processor can simultaneously determine whether the other two components should be used as positive solutions or negative solutions by confirming in the above step S40 that one of the first z-axis component, the second z-axis component, and the third z-axis component is to be used as a positive solution or a negative solution. Therefore, the processor can use the motion vector that causes a significant change in diameter to determine whether the corresponding z-axis component is to be used as a positive solution or a negative solution in step S40, without having to determine the positive and negative signs of the three z-axis components separately.

惟,上述僅為本發明的具體實施範例,但並不以上述為限。However, the above are only specific implementation examples of the present invention, but are not limited to the above.

當確定了正確的第一z軸分量、第二z軸分量以及第三z軸分量後,處理器即可由第一x軸分量、第一y軸分量及第一z軸分量來形成第一移動向量,例如為(a1,b1,c1)。並且,處理器可由第二x軸分量、第二y軸分量及第二z軸分量來形成第二移動向量,例如為(a2,b2,c2)。並且,處理器可由第三x軸分量、第三y軸分量及第三z軸分量來形成第三移動向量,例如為(a3,b3,c3)。After determining the correct first z-axis component, second z-axis component, and third z-axis component, the processor can form a first motion vector, such as (a1, b1, c1), from the first x-axis component, the first y-axis component, and the first z-axis component. Furthermore, the processor can form a second motion vector, such as (a2, b2, c2), from the second x-axis component, the second y-axis component, and the second z-axis component. Furthermore, the processor can form a third motion vector, such as (a3, b3, c3), from the third x-axis component, the third y-axis component, and the third z-axis component.

步驟S40後,處理器即確定了第一移動向量、第二移動向量及第三移動向量。接著,透過對第一移動向量、第二移動向量及第三移動向量進行正規化處理以將這些移動向量轉成單位長度後,即可產生相機座標系S3相對於機器手臂座標系S1的旋轉矩陣(步驟S42)。After step S40, the processor determines the first motion vector, the second motion vector and the third motion vector. Then, by normalizing the first motion vector, the second motion vector and the third motion vector to convert these motion vectors into unit length, a rotation matrix of the camera coordinate system S3 relative to the robot arm coordinate system S1 can be generated (step S42).

於一實施例中,所述旋轉矩陣可例如為:In one embodiment, the rotation matrix may be, for example:

.

所述旋轉矩陣中的t代表第一移動向量,u代表第二移動向量,而v代表第三移動向量。處理器於步驟S42中主要是將第一x軸分量a1、第一y軸分量b1及第一z軸分量c1分別除以第一移動向量t的長度,將第二x軸分量a2、第二y軸分量b2及第二z軸分量c2分別除以第二移動向量u的長度,並將第三x軸分量a3、第三y軸分量b3及第三z軸分量c3分別除以第三移動向量v的長度,藉此完成正規化處理。In the rotation matrix, t represents the first motion vector, u represents the second motion vector, and v represents the third motion vector. In step S42, the processor mainly divides the first x-axis component a1, the first y-axis component b1, and the first z-axis component c1 by the length of the first motion vector t, divides the second x-axis component a2, the second y-axis component b2, and the second z-axis component c2 by the length of the second motion vector u, and divides the third x-axis component a3, the third y-axis component b3, and the third z-axis component c3 by the length of the third motion vector v, thereby completing the normalization process.

於步驟S42後,相機座標系S3相對於機器手臂座標系S1的旋轉矩陣即成為已知資訊。此時,由於機器手臂座標系S1與法蘭面座標系S2間的對應關係也是已知的,因此處理器可直接推算出相機座標系S3相對於法蘭面2的姿態。After step S42, the rotation matrix of the camera coordinate system S3 relative to the robot arm coordinate system S1 becomes known information. At this time, since the correspondence between the robot arm coordinate system S1 and the flange surface coordinate system S2 is also known, the processor can directly calculate the posture of the camera coordinate system S3 relative to the flange surface 2.

續請同時參閱圖6A、圖6B、圖7A、圖7B及圖8,其中圖6A為本發明的相機拍攝示意圖的第一具體實施例,圖6B為球體成像示意圖的第一具體實施例,圖7A為本發明的相機拍攝示意圖的第二具體實施例,圖7B為球體成像示意圖的第二具體實施例,圖8為本發明的偏移量計算流程圖的具體實施例。圖8用來對圖2中的步驟S18至步驟S20做更進一步的詳細說明。Please refer to Figures 6A, 6B, 7A, 7B and 8 simultaneously, wherein Figure 6A is a first specific embodiment of the camera shooting diagram of the present invention, Figure 6B is a first specific embodiment of the spherical imaging diagram, Figure 7A is a second specific embodiment of the camera shooting diagram of the present invention, Figure 7B is a second specific embodiment of the spherical imaging diagram, and Figure 8 is a specific embodiment of the offset calculation flow chart of the present invention. Figure 8 is used to further explain step S18 to step S20 in Figure 2 in detail.

於圖2的步驟S16後,機器手臂系統的處理器即可獲得相機座標系S3相對於機器手臂座標系S1的旋轉矩陣。基於機器手臂座標系S1以及旋轉矩陣,處理器可以直接使用相機座標系S3來精準地控制機器手臂1上的相機3。After step S16 in FIG2 , the processor of the robot arm system can obtain the rotation matrix of the camera coordinate system S3 relative to the robot arm coordinate system S1. Based on the robot arm coordinate system S1 and the rotation matrix, the processor can directly use the camera coordinate system S3 to accurately control the camera 3 on the robot arm 1.

如圖6A、圖6B及圖8所示,在要計算相機3的虛擬工具點31相對於法蘭面2的偏移量時,首先由處理器基於相機座標系S3來(透過機器手臂1)控制相機3移動,並且令球體4落入相機3的畫面30上的任意參考點(步驟S50)。As shown in Figures 6A, 6B and 8, when calculating the offset of the virtual tool point 31 of the camera 3 relative to the flange surface 2, the processor first controls the movement of the camera 3 based on the camera coordinate system S3 (through the robot arm 1), and makes the sphere 4 fall into any reference point on the screen 30 of the camera 3 (step S50).

如圖6A及圖6B所示,處理器於步驟S50中主要是使用相機座標系S3來控制相機3移動至指定位置。於這個指定位置上,相機3從特定角度對準球體4,並且可以補捉到球體4的整體影像,意即,可以令球體4的整體進入相機3的畫面30中。於圖6A的實施例中,處理器是令相機3從球體4的右側對準球體4,但不以此為限。As shown in FIG6A and FIG6B , the processor mainly uses the camera coordinate system S3 to control the camera 3 to move to a designated position in step S50. At this designated position, the camera 3 is aligned with the sphere 4 from a specific angle and can capture the entire image of the sphere 4, that is, the entire sphere 4 can enter the frame 30 of the camera 3. In the embodiment of FIG6A , the processor controls the camera 3 to align the sphere 4 from the right side of the sphere 4, but the present invention is not limited thereto.

於一實施例中,所述任意參考點可例如為前述的初始參考點p0c。於另一實施例中,所述令球體4落入畫面30中的任意參考點的動作,是指讓球體4的圓心40位於畫面30的正中央。惟,上述僅為本發明的部分實施範例,但並不以此為限。In one embodiment, the arbitrary reference point may be, for example, the aforementioned initial reference point p0c. In another embodiment, the action of making the sphere 4 fall into an arbitrary reference point in the image 30 refers to making the center 40 of the sphere 4 be located in the center of the image 30. However, the above are only some implementation examples of the present invention, but are not limited thereto.

接著,處理器再次使用相機座標系S3來使相機3移動,以調整相機3與球體4間的距離,藉此讓球體4可以清晰成像,並於畫面30上呈現球體4的清晰影像(步驟S52)。於一實施例中,所述距離是由使用者自行決定,或由處理器經計算後獲得,但不加以限定。Then, the processor uses the camera coordinate system S3 again to move the camera 3 to adjust the distance between the camera 3 and the sphere 4, so that the sphere 4 can be clearly imaged and a clear image of the sphere 4 is presented on the screen 30 (step S52). In one embodiment, the distance is determined by the user or obtained by the processor after calculation, but it is not limited.

具體地,處理器於步驟S50及步驟S52中調整相機3的位置,目的在於令球體4可以落在相機3的畫面30中適當位置並與相機3間隔適當距離,如此一來,機器手臂系統可以將球體4的所在位置視為是相機3前方的虛擬工具點31。當相機3再次移動,並且將其他物件放置於相機3前方的虛擬工具點31時,相機3必定可以擷取此物件的清晰影像。如此一來,使用者可以在校正完成後,使用相機3前方的虛擬工具點31做為機器手臂1上的工具,以實現光學檢測。Specifically, the processor adjusts the position of the camera 3 in step S50 and step S52, so that the sphere 4 can fall at a proper position in the image 30 of the camera 3 and be spaced at a proper distance from the camera 3, so that the robot arm system can regard the position of the sphere 4 as the virtual tool point 31 in front of the camera 3. When the camera 3 moves again and places other objects at the virtual tool point 31 in front of the camera 3, the camera 3 can definitely capture a clear image of the object. In this way, after the calibration is completed, the user can use the virtual tool point 31 in front of the camera 3 as a tool on the robot arm 1 to achieve optical detection.

於步驟S52後,相機3可以捕捉球體4的清晰影像,因此可將球體4的當前位置認定為虛擬工具點31。此時,處理器可記錄球體4當前的校正點資訊(步驟S54)。於一實施例中,所述校正點資訊至少包括機器手臂1的當前姿態、球體4當前於畫面30中的座標,以及球體4當前於畫面30中呈現的直徑等(例如圖6B中所示的直徑df)。After step S52, the camera 3 can capture a clear image of the sphere 4, so the current position of the sphere 4 can be identified as the virtual tool point 31. At this time, the processor can record the current calibration point information of the sphere 4 (step S54). In one embodiment, the calibration point information at least includes the current posture of the robot arm 1, the current coordinates of the sphere 4 in the screen 30, and the diameter of the sphere 4 currently displayed in the screen 30 (e.g., the diameter df shown in FIG. 6B).

接著,處理器判斷是否已經取得了足夠數量的校正點資訊(步驟S56)。於一實施例中,所述足夠數量的校正點資訊為至少三筆的校正點資訊,但並不以此為限。Next, the processor determines whether a sufficient amount of calibration point information has been obtained (step S56). In one embodiment, the sufficient amount of calibration point information is at least three pieces of calibration point information, but is not limited thereto.

若於步驟S56中判斷尚未取得足夠數量的校正點資訊,則處理器基於相機座標系S3來控制機器手臂1移動或旋轉,以改變相機3相對於球體4的拍攝角度(步驟S58)。意即,處理器藉由對機器手臂1的控制,令相機3以不同於前一次使用的角度來正對球體4。接著,處理器再次執行步驟S50至步驟S54,以從不同角度來獲取球體4的清晰影像並取得另一筆校正點資訊。If it is determined in step S56 that a sufficient amount of calibration point information has not been obtained, the processor controls the robot arm 1 to move or rotate based on the camera coordinate system S3 to change the shooting angle of the camera 3 relative to the sphere 4 (step S58). That is, the processor controls the robot arm 1 to make the camera 3 face the sphere 4 at an angle different from the previous angle. Then, the processor executes steps S50 to S54 again to obtain a clear image of the sphere 4 from a different angle and obtain another set of calibration point information.

如上所述,於再次執行步驟S50時,處理器是控制機器手臂1/相機3移動或旋轉,以改變相機3相對於球體4的角度。於圖7A的實施例中,處理器是令相機3從球體4的上方對準球體4,但不以此為限。As described above, when executing step S50 again, the processor controls the robot arm 1/camera 3 to move or rotate to change the angle of the camera 3 relative to the sphere 4. In the embodiment of FIG. 7A , the processor controls the camera 3 to align with the sphere 4 from above the sphere 4, but the present invention is not limited thereto.

於再次執行步驟S52時,處理器同樣會調整相機3相對於球體4的距離,藉此讓球體4位於前述虛擬工具點31上。如圖7A所示,處理器令球體4在相機3的畫面30中的直徑,相同於前一次記錄所述校正點資訊時球體4在畫面30中呈現的直徑df。When executing step S52 again, the processor will also adjust the distance between the camera 3 and the sphere 4, so that the sphere 4 is located on the aforementioned virtual tool point 31. As shown in FIG7A , the processor makes the diameter of the sphere 4 in the image 30 of the camera 3 the same as the diameter df of the sphere 4 presented in the image 30 when the calibration point information was recorded last time.

更具體地說,本發明的處理器在記錄球體4的多筆校正點資訊時,會改變相機3相對於球體4的拍攝角度,但是會讓球體4坐落在畫面30中的相同位置(例如上述的任意參考點或初始參考點p0c),並且令球體4在畫面30中呈現相同的直徑df(即,令相機3與球體4間的距離維持相同)。More specifically, when recording multiple calibration point information of the sphere 4, the processor of the present invention will change the shooting angle of the camera 3 relative to the sphere 4, but will make the sphere 4 be located at the same position in the picture 30 (such as the arbitrary reference point or the initial reference point p0c mentioned above), and make the sphere 4 present the same diameter df in the picture 30 (that is, keep the distance between the camera 3 and the sphere 4 the same).

藉由讓球體4在相機3的畫面30中保持相同的態樣,處理器可以確認相機3相對於球體4的拍攝角度改變後,球體4都仍位於虛擬工具點31上。如此一來,處理器所記錄的多筆校正點資訊可被用來指出同一個虛擬工具點31的位置。藉此,如圖8所示,處理器可以在取得了符合數量(例如至少三筆)的校正點資訊後,基於這些校正點資訊計算虛擬工具點31相對於機器手臂1的法蘭面2的偏移量(步驟S60)。By keeping the sphere 4 in the same state in the image 30 of the camera 3, the processor can confirm that the sphere 4 is still located on the virtual tool point 31 after the shooting angle of the camera 3 relative to the sphere 4 changes. In this way, the multiple calibration point information recorded by the processor can be used to indicate the position of the same virtual tool point 31. Thus, as shown in FIG8 , after obtaining a suitable number (e.g., at least three) of calibration point information, the processor can calculate the offset of the virtual tool point 31 relative to the flange surface 2 of the robot arm 1 based on these calibration point information (step S60).

最後,如圖2的步驟S22所示,在獲得了相機座標系S3相對於法蘭面2的姿態以及虛擬工具點31相對於法蘭面2的偏移量後,處理器即可完成對相機3及其前方的虛擬工具點31的校正程序。更具體地,處理器可將所述姿態及偏移量寫入機器手臂系統中做為控制參數的其中之一,以完成所述校正程序。Finally, as shown in step S22 of FIG. 2 , after obtaining the posture of the camera coordinate system S3 relative to the flange surface 2 and the offset of the virtual tool point 31 relative to the flange surface 2, the processor can complete the calibration procedure for the camera 3 and the virtual tool point 31 in front of it. More specifically, the processor can write the posture and offset into the robot arm system as one of the control parameters to complete the calibration procedure.

在完成了校正程序後,處理器可將相機3做為是機器手臂1的其中一種工具來使用。當使用者欲使用相機3來進行光學檢測時,可以直接使用工具座標系S4來精準地控制相機3進行移動,並使待檢測物能夠準確地位於虛擬工具點31上。藉此,確保相機3能夠取得待檢測物的清晰影像,進而能夠有效地獲得光學檢測的精準結果。After the calibration process is completed, the processor can use the camera 3 as one of the tools of the robot arm 1. When the user wants to use the camera 3 for optical inspection, the tool coordinate system S4 can be directly used to accurately control the movement of the camera 3, so that the object to be inspected can be accurately positioned on the virtual tool point 31. In this way, it is ensured that the camera 3 can obtain a clear image of the object to be inspected, and thus can effectively obtain accurate results of optical inspection.

以上所述僅為本發明之較佳具體實例,非因此即侷限本發明之專利範圍,故舉凡運用本發明內容所為之等效變化,均同理皆包含於本發明之範圍內,合予陳明。The above description is only a preferred specific example of the present invention, and does not limit the patent scope of the present invention. Therefore, all equivalent changes made by applying the contents of the present invention are also included in the scope of the present invention and are appropriately stated.

1:機器手臂 2:法蘭面 3:相機 30:相機畫面 31:虛擬工具點 4:球體 40:圓心 d0、d1、d2、d3、df:直徑 S1:機器人座標系 S2:法蘭面座標系 S3:相機座標系 S4:工具座標系 S10~S22:校正步驟 S30~S42:矩陣建立步驟 S50~S60:偏移量計算步驟 1: Robot arm 2: Flange surface 3: Camera 30: Camera screen 31: Virtual tool point 4: Sphere 40: Center of circle d0, d1, d2, d3, df: Diameter S1: Robot coordinate system S2: Flange surface coordinate system S3: Camera coordinate system S4: Tool coordinate system S10~S22: Calibration step S30~S42: Matrix creation step S50~S60: Offset calculation step

圖1為本發明的機器手臂的示意圖的具體實施例。FIG. 1 is a schematic diagram of a specific embodiment of a robot arm of the present invention.

圖2為本發明的校正方法的流程圖的具體實施例。FIG. 2 is a flow chart of a specific embodiment of the calibration method of the present invention.

圖3為本發明的相機移動示意圖的具體實施例。FIG. 3 is a specific embodiment of a camera movement schematic diagram of the present invention.

圖4為本發明的相機座標系的示意圖的具體實施例。FIG. 4 is a specific embodiment of a schematic diagram of a camera coordinate system of the present invention.

圖5為本發明的旋轉矩陣的建立流程圖的具體實施例。FIG. 5 is a specific embodiment of a flowchart of establishing a rotation matrix of the present invention.

圖6A為本發明的相機拍攝示意圖的第一具體實施例。FIG. 6A is a first specific embodiment of a camera shooting diagram of the present invention.

圖6B為球體成像示意圖的第一具體實施例。FIG. 6B is a schematic diagram of a spherical imaging according to a first specific embodiment.

圖7A為本發明的相機拍攝示意圖的第二具體實施例。FIG. 7A is a second specific embodiment of a camera shooting diagram of the present invention.

圖7B為球體成像示意圖的第二具體實施例。FIG. 7B is a second specific embodiment of a schematic diagram of spherical imaging.

圖8為本發明的偏移量計算流程圖的具體實施例。FIG8 is a specific embodiment of the offset calculation flow chart of the present invention.

S10~S22:校正步驟 S10~S22: Calibration steps

Claims (10)

一種機器手臂的虛擬工具點的視覺校正方法,應用於具有一機器手臂、一相機及一球體的一校正系統,其中該機器手臂的一端具有一法蘭面並使用一機器手臂座標系,該相機設置於該法蘭面上並使用一相機座標系,該視覺校正方法包括: a)基於該機器手臂座標系控制該機器手臂移動,以令該球體進入該相機的一畫面中; b)控制該機器手臂沿著三軸的方向依序進行平移,記錄該球體的一球體資訊,並基於該球體資訊計算該球體相對於該相機座標系的三組移動向量; c)基於該三組移動向量計算該相機座標系相對於該機器手臂座標系的一旋轉矩陣,並推算該相機座標系相對於該法蘭面的一姿態; d)基於該機器手臂座標系及該旋轉矩陣來使用該相機座標系,以控制該相機通過不同角度捕捉該球體的一清晰影像並且記錄至少三筆校正點資訊,其中該清晰影像是於該球體位於該相機前的一虛擬工具點上時被捕捉; e)基於該至少三筆校正點資訊計算該虛擬工具點相對於該法蘭面的一偏移量;及 f)基於該姿態及該偏移量完成該相機的該虛擬工具點的一校正程序。 A visual calibration method for a virtual tool point of a robot arm is applied to a calibration system having a robot arm, a camera and a sphere, wherein one end of the robot arm has a flange surface and uses a robot arm coordinate system, and the camera is set on the flange surface and uses a camera coordinate system. The visual calibration method includes: a) controlling the movement of the robot arm based on the robot arm coordinate system to make the sphere enter a picture of the camera; b) controlling the robot arm to translate in sequence along the directions of three axes, recording a sphere information of the sphere, and calculating three sets of movement vectors of the sphere relative to the camera coordinate system based on the sphere information; c) calculating a rotation matrix of the camera coordinate system relative to the robot arm coordinate system based on the three sets of movement vectors, and inferring a posture of the camera coordinate system relative to the flange surface; d) using the camera coordinate system based on the robot arm coordinate system and the rotation matrix to control the camera to capture a clear image of the sphere at different angles and record at least three calibration point information, wherein the clear image is captured when the sphere is located on a virtual tool point in front of the camera; e) calculating an offset of the virtual tool point relative to the flange surface based on the at least three calibration point information; and f) completing a calibration procedure of the virtual tool point of the camera based on the posture and the offset. 如請求項1所述的視覺校正方法,其中該球體資訊包括該球體於該相機座標系上的一參考點位置,以及該球體於該畫面中呈現的一直徑。A vision correction method as described in claim 1, wherein the spherical information includes a reference point position of the sphere on the camera coordinate system and a diameter of the sphere presented in the image. 如請求項2所述的視覺校正方法,其中該步驟b)包括: b1)控制該機器手臂移動以令該球體位於該畫面中的一初始參考點,並記錄該初始參考點於該相機座標系上的一初始座標以及該球體於該畫面中的一初始直徑; b2)控制該機器手臂沿一x軸平移一第一指定向量,以令該球體位於該畫面中的一第一參考點,並記錄該第一參考點於該相機座標系上的一第一座標以及該球體於該畫面中的一第一直徑; b3)控制該機器手臂沿一y軸平移一第二指定向量,以令該球體位於該畫面中的一第二參考點,並記錄該第二參考點於該相機座標系上的一第二座標以及該球體於該畫面中的一第二直徑; b4)控制該機器手臂沿一z軸平移一第三指定向量,以令該球體位於該畫面中的一第三參考點,並記錄該第三參考點於該相機座標系上的一第三座標以及該球體於該畫面中的一第三直徑;及 b5)依據該初始座標、該第一座標、該第二座標、該第三座標、該初始直徑、該第一直徑、該第二直徑及該第三直徑計算該三組移動向量。 The visual correction method as described in claim 2, wherein the step b) includes: b1) controlling the robot arm to move so that the sphere is located at an initial reference point in the picture, and recording an initial coordinate of the initial reference point in the camera coordinate system and an initial diameter of the sphere in the picture; b2) controlling the robot arm to translate a first specified vector along an x-axis so that the sphere is located at a first reference point in the picture, and recording a first coordinate of the first reference point in the camera coordinate system and a first diameter of the sphere in the picture; b3) controlling the robot arm to translate a second specified vector along a y-axis so that the sphere is located at a second reference point in the picture, and recording a second coordinate of the second reference point in the camera coordinate system and a second diameter of the sphere in the picture; b4) controlling the robot arm to translate a third specified vector along a z-axis so that the sphere is located at a third reference point in the image, and recording a third coordinate of the third reference point in the camera coordinate system and a third diameter of the sphere in the image; and b5) calculating the three sets of movement vectors based on the initial coordinate, the first coordinate, the second coordinate, the third coordinate, the initial diameter, the first diameter, the second diameter and the third diameter. 如請求項3所述的視覺校正方法,其中於該步驟b5)包括依據該第一座標及該初始座標計算一第一移動向量的一第一x軸分量及一第一y軸分量、依據該第二座標及該初始座標計算一第二移動向量的一第二x軸分量及一第二y軸分量,並且依據該第三座標及該初始座標計算一第三移動向量的一第三x軸分量及一第三y軸分量。A visual correction method as described in claim 3, wherein the step b5) includes calculating a first x-axis component and a first y-axis component of a first motion vector based on the first coordinate and the initial coordinate, calculating a second x-axis component and a second y-axis component of a second motion vector based on the second coordinate and the initial coordinate, and calculating a third x-axis component and a third y-axis component of a third motion vector based on the third coordinate and the initial coordinate. 如請求項4所述的視覺校正方法,其中該步驟b5)還包括透過一第一方程式、一第二方程式及一第三方程式計算該第一移動向量的一第一z軸分量、該第二移動向量的一第二z軸分量及該第三移動向量的一第三z軸分量: 該第一方程式:c1c2 = –a1a2 – b1b2; 該第二方程式:c2c3 = –a2a3 – b2b3; 該第三方程式:c1c3 = –a1a3 – b1b3; 其中,a1為該第一x軸分量、a2為該第二x軸分量、a3為該第三x軸分量、b1為該第一y軸分量、b2為該第二y軸分量、b3為該第三y軸分量、c1為該第一z軸分量、c2為該第二z軸分量、c3為該第三z軸分量。 The visual correction method as described in claim 4, wherein the step b5) further includes calculating a first z-axis component of the first motion vector, a second z-axis component of the second motion vector, and a third z-axis component of the third motion vector through a first equation, a second equation, and a third-party program: The first equation: c1c2 = –a1a2 – b1b2; The second equation: c2c3 = –a2a3 – b2b3; The third-party program: c1c3 = –a1a3 – b1b3; Among them, a1 is the first x-axis component, a2 is the second x-axis component, a3 is the third x-axis component, b1 is the first y-axis component, b2 is the second y-axis component, b3 is the third y-axis component, c1 is the first z-axis component, c2 is the second z-axis component, and c3 is the third z-axis component. 如請求項5所述的視覺校正方法,其中該第一方程式、該第二方程式及該第三方程式共同獲得兩組該第一z軸分量、兩組該第二z軸分量以及兩組該第三z軸分量,該步驟b5)還包括透過該第一直徑及該初始直徑確定正確的該第一z軸分量、透過該第二直徑及該初始直徑確定正確的該第二z軸分量以及透過該第三直徑及該初始直徑確定正確的該第三z軸分量,其中該第一移動向量由該第一x軸分量、該第一y軸分量及正確的該第一z軸分量組成,該第二移動向量由該第二x軸分量、該第二y軸分量及正確的該第二z軸分量組成,該第三移動向量由該第三x軸分量、該第三y軸分量及正確的該第三z軸分量組成。The vision correction method as described in claim 5, wherein the first equation, the second equation and the third-party program jointly obtain two sets of the first z-axis components, two sets of the second z-axis components and two sets of the third z-axis components, and the step b5) further includes determining the correct first z-axis component through the first diameter and the initial diameter, determining the correct second z-axis component through the second diameter and the initial diameter, and determining the correct second z-axis component through The third diameter and the initial diameter determine the correct third z-axis component, wherein the first motion vector is composed of the first x-axis component, the first y-axis component and the correct first z-axis component, the second motion vector is composed of the second x-axis component, the second y-axis component and the correct second z-axis component, and the third motion vector is composed of the third x-axis component, the third y-axis component and the correct third z-axis component. 如請求項3所述的視覺校正方法,其中該步驟c)包括對該第一移動向量、該第二移動向量及該第三移動向量進行正規化處理以將該第一移動向量、該第二移動向量及該第三移動向量轉成單位長度並產生該旋轉矩陣。The visual correction method as described in claim 3, wherein the step c) includes normalizing the first motion vector, the second motion vector and the third motion vector to convert the first motion vector, the second motion vector and the third motion vector into unit length and generate the rotation matrix. 如請求項3所述的視覺校正方法,其中該步驟c)包括基於旋轉矩陣以及該機器手臂座標系至該法蘭面的一機器人運動學(robot kinematics)關係推算該相機座標系相對於該法蘭面的該姿態。A vision calibration method as described in claim 3, wherein the step c) includes calculating the posture of the camera coordinate system relative to the flange surface based on a rotation matrix and a robot kinematics relationship from the robot arm coordinate system to the flange surface. 如請求項3所述的視覺校正方法,其中該步驟b3)是先控制該機器手臂移動以令該球體回到該初始參考點後,再控制該機器手臂沿該y軸平移該第二指定向量的距離,並且該步驟b4)先控制該機器手臂移動以令該球體回到該初始參考點後,再控制該機器手臂沿該z軸平移該第三指定向量的距離。A vision correction method as described in claim 3, wherein the step b3) is to first control the robot arm to move so that the sphere returns to the initial reference point, and then control the robot arm to translate the distance of the second specified vector along the y-axis, and the step b4) is to first control the robot arm to move so that the sphere returns to the initial reference point, and then control the robot arm to translate the distance of the third specified vector along the z-axis. 如請求項3所述的視覺校正方法,其中該步驟d)包括: d1)基於該相機座標系控制該相機移動,以令該球體位於該畫面上的一任意參考點; d2)調整該相機相對於該球體間的距離,以令該球體清晰成像並於該畫面中呈現該清晰影像; d3)記錄該球體的該校正點資訊,其中該校正點資訊包括該機器手臂的一當前姿態、該球體於該畫面中的一座標以及該球體於該畫面中的一直徑; d4)於尚未取得至少三筆該校正點資訊前,控制該機器手臂旋轉或移動以令該相機以不同角度正對該球體,並且再次執行該步驟d1)至該步驟d3);及 d5)於取得至少三筆該校正點資訊後,基於該至少三筆校正點資訊計算該虛擬工具點相對於該法蘭面的該偏移量。 The visual correction method as described in claim 3, wherein the step d) includes: d1) controlling the movement of the camera based on the camera coordinate system so that the sphere is located at an arbitrary reference point on the screen; d2) adjusting the distance between the camera and the sphere so that the sphere is clearly imaged and the clear image is presented in the screen; d3) recording the correction point information of the sphere, wherein the correction point information includes a current posture of the robot arm, a coordinate of the sphere in the screen, and a diameter of the sphere in the screen; d4) before obtaining at least three pieces of the correction point information, controlling the robot arm to rotate or move so that the camera faces the sphere at different angles, and executing the steps d1) to d3) again; and d5) After obtaining at least three pieces of calibration point information, the offset of the virtual tool point relative to the flange surface is calculated based on the at least three pieces of calibration point information.
TW111134357A 2022-09-12 2022-09-12 Visual calibrating method for virtual tcp of robotic arm TWI837822B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
TW111134357A TWI837822B (en) 2022-09-12 2022-09-12 Visual calibrating method for virtual tcp of robotic arm

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
TW111134357A TWI837822B (en) 2022-09-12 2022-09-12 Visual calibrating method for virtual tcp of robotic arm

Publications (2)

Publication Number Publication Date
TW202411802A true TW202411802A (en) 2024-03-16
TWI837822B TWI837822B (en) 2024-04-01

Family

ID=91228059

Family Applications (1)

Application Number Title Priority Date Filing Date
TW111134357A TWI837822B (en) 2022-09-12 2022-09-12 Visual calibrating method for virtual tcp of robotic arm

Country Status (1)

Country Link
TW (1) TWI837822B (en)

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
TWI693990B (en) * 2017-07-13 2020-05-21 達明機器人股份有限公司 Device and method for calibrating end-effector of robot arm
TWI711910B (en) * 2018-03-19 2020-12-01 達明機器人股份有限公司 Method for calibrating eye-to-hand camera of robot arm
CN113001535B (en) * 2019-12-18 2022-11-15 财团法人工业技术研究院 Automatic correction system and method for robot workpiece coordinate system
TWI762371B (en) * 2021-07-06 2022-04-21 財團法人工業技術研究院 Automated calibration system and method for the relation between a profile scanner coordinate frame and a robot arm coordinate frame

Also Published As

Publication number Publication date
TWI837822B (en) 2024-04-01

Similar Documents

Publication Publication Date Title
TWI672206B (en) Method and apparatus of non-contact tool center point calibration for a mechanical arm, and a mechanical arm system with said calibration function
JP2020116734A (en) System and method for automatic hand-eye calibration of vision system for robot motion
CN110238845B (en) Automatic hand-eye calibration method and device for optimal calibration point selection and error self-measurement
CN109754432B (en) Camera automatic calibration method and optical motion capture system
JP4191080B2 (en) Measuring device
CN111801198B (en) Hand-eye calibration method, system and computer storage medium
CN106457562B (en) Method and robot system for calibration machine people
JP4021413B2 (en) Measuring device
CN110666798B (en) Robot vision calibration method based on perspective transformation model
CN110136208A (en) A kind of the joint automatic calibration method and device of Visual Servoing System
CN114714356A (en) Method for accurately detecting calibration error of hand eye of industrial robot based on binocular vision
CN110136204B (en) Sound film dome assembly system based on calibration of machine tool position of bilateral telecentric lens camera
CN110298888B (en) Camera calibration method based on single-axis high-precision displacement platform
JP2009269110A (en) Assembly equipment
CN111515944A (en) Automatic calibration method for non-fixed path robot
CN111899305A (en) Camera automatic calibration optimization method and related system and equipment
WO2018209592A1 (en) Movement control method for robot, robot and controller
JP2015062991A (en) Coordinate system calibration method, robot system, program, and recording medium
CN110136068B (en) Sound membrane dome assembly system based on position calibration between bilateral telecentric lens cameras
CN114952856A (en) Mechanical arm hand-eye calibration method, system, computer and readable storage medium
CN107993227B (en) Method and device for acquiring hand-eye matrix of 3D laparoscope
TWI837822B (en) Visual calibrating method for virtual tcp of robotic arm
CN113781558A (en) Robot vision locating method with decoupled posture and position
CN112132903A (en) Coordinate system calibration method and system for vision system and multi-axis motion system
CN115457142B (en) Calibration method and system of MR hybrid photographic camera