JP2021089224A - Position detection method, encoder unit, and robot - Google Patents

Position detection method, encoder unit, and robot Download PDF

Info

Publication number
JP2021089224A
JP2021089224A JP2019220159A JP2019220159A JP2021089224A JP 2021089224 A JP2021089224 A JP 2021089224A JP 2019220159 A JP2019220159 A JP 2019220159A JP 2019220159 A JP2019220159 A JP 2019220159A JP 2021089224 A JP2021089224 A JP 2021089224A
Authority
JP
Japan
Prior art keywords
image
template
matching
mark
coordinates
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
JP2019220159A
Other languages
Japanese (ja)
Inventor
近藤 貴幸
Takayuki Kondo
貴幸 近藤
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Seiko Epson Corp
Original Assignee
Seiko Epson Corp
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 Seiko Epson Corp filed Critical Seiko Epson Corp
Priority to JP2019220159A priority Critical patent/JP2021089224A/en
Publication of JP2021089224A publication Critical patent/JP2021089224A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Optical Transform (AREA)
  • Manipulator (AREA)
  • Transmission And Conversion Of Sensor Element Output (AREA)

Abstract

To provide a position detection method and an encoder unit that can easily improve detection accuracy, and to provide a robot including the encoder unit.SOLUTION: A method using an encoder having a scale unit having a plurality of marks and image pick-up devices, and includes the steps of: acquiring a first template image and first reference coordinates when the scale unit is at a first position; acquiring first matching coordinates of the marks by template matching based on the first template image when the scale unit is at a second position; determining the correlation relationship established between the first position, second position, first reference coordinates, and first matching coordinates; acquiring measurement matching coordinates of the marks by the template matching based on the first template image; and determining a measurement position on the basis of the first position, first reference coordinates, measurement matching coordinates, and correlation relationship.SELECTED DRAWING: Figure 9

Description

本発明は、位置検出方法、エンコーダーユニットおよびロボットに関するものである。 The present invention relates to a position detection method, an encoder unit and a robot.

エンコーダーの一種として光学式のロータリーエンコーダーが知られている。ロータリーエンコーダーは、例えば、回動可能な関節部を有するロボットアームを備えるロボットにおいて、関節部の回転角度、回転位置、回転数、回転速度等の回転状態を検出する。その検出結果は、例えば、関節部の駆動制御に用いられる。 An optical rotary encoder is known as a kind of encoder. The rotary encoder detects a rotation state such as a rotation angle, a rotation position, a rotation speed, and a rotation speed of a joint portion in a robot including a robot arm having a rotatable joint portion, for example. The detection result is used, for example, for driving control of a joint portion.

特許文献1に記載のエンコーダーは、グレイ符号等の数値パターンおよびストライプ状のパターンが形成されているコード板を撮像素子で読み取り、読み取った数値パターンおよびストライプ状のパターンから位置を検出する。 The encoder described in Patent Document 1 reads a code plate on which a numerical pattern such as a Gray code and a striped pattern are formed by an image pickup device, and detects a position from the read numerical pattern and the striped pattern.

特開昭63−187118号公報Japanese Unexamined Patent Publication No. 63-187118

特許文献1に記載のエンコーダーにおいて、高い検出精度を実現するためには、コード板に高精細なパターンを形成することや、コード板を設置する際に高い精度で位置決めすることが必要となる。そのため、特許文献1に記載のエンコーダーでは、高い検出精度を実現することが容易ではないという課題がある。 In the encoder described in Patent Document 1, in order to realize high detection accuracy, it is necessary to form a high-definition pattern on the cord plate and to position the encoder with high accuracy when installing the cord plate. Therefore, the encoder described in Patent Document 1 has a problem that it is not easy to realize high detection accuracy.

本発明の適用例に係る位置検出方法は、
複数のマークを有するスケール部と、前記マークを撮像する撮像素子と、を有し、前記撮像素子に対して前記スケール部が相対的に移動するエンコーダーを用いて、前記スケール部の位置を検出する位置検出方法であって、
前記スケール部が第1位置にあるとき、前記撮像素子により前記マークを撮像して第1基準画像を生成し、第1テンプレート画像、および、前記第1基準画像における前記マークの第1基準座標を取得するステップと、
前記スケール部が第2位置にあるとき、前記撮像素子により前記マークを撮像して第2基準画像を生成し、前記第1テンプレート画像に基づくテンプレートマッチングにより、前記第2基準画像において前記第1テンプレート画像と合致する前記マークの第1合致座標を取得するステップと、
前記第1位置と、前記第2位置と、前記第1基準座標と、前記第1合致座標と、の間に成り立つ相関関係を求めるステップと、
前記スケール部が計測位置にあるとき、前記撮像素子により前記マークを撮像して測位画像を生成し、前記第1テンプレート画像に基づくテンプレートマッチングにより、前記測位画像における前記マークの測位合致座標を取得するステップと、
前記第1位置、前記第1基準座標、前記測位合致座標、および前記相関関係に基づいて、前記計測位置を求めるステップと、
を有することを特徴とする。
The position detection method according to the application example of the present invention is
The position of the scale unit is detected by using an encoder having a scale unit having a plurality of marks and an image sensor that images the mark, and the scale unit moves relative to the image sensor. It is a position detection method
When the scale unit is in the first position, the mark is imaged by the image sensor to generate a first reference image, and the first template image and the first reference coordinates of the mark in the first reference image are obtained. Steps to get and
When the scale unit is in the second position, the mark is imaged by the image sensor to generate a second reference image, and template matching based on the first template image results in the first template in the second reference image. The step of acquiring the first matching coordinates of the mark that matches the image, and
A step of finding a correlation established between the first position, the second position, the first reference coordinate, and the first matching coordinate.
When the scale unit is at the measurement position, the mark is imaged by the image sensor to generate a positioning image, and the positioning matching coordinates of the mark in the positioning image are acquired by template matching based on the first template image. Steps and
A step of obtaining the measurement position based on the first position, the first reference coordinate, the positioning matching coordinate, and the correlation.
It is characterized by having.

実施形態に係るロボットを示す側面図である。It is a side view which shows the robot which concerns on embodiment. 第1実施形態に係るエンコーダーユニットを示す断面図である。It is sectional drawing which shows the encoder unit which concerns on 1st Embodiment. 図2のエンコーダーを示す機能ブロック図である。It is a functional block diagram which shows the encoder of FIG. 図2のエンコーダーが備えるスケール部を説明するための図である。It is a figure for demonstrating the scale part provided in the encoder of FIG. 図4に示すスケール部のE部拡大図である。It is an enlarged view of E part of the scale part shown in FIG. 図5に示すスケール部の部分拡大図である。It is a partially enlarged view of the scale part shown in FIG. 第1実施形態に係る位置検出方法を示すフローチャートである。It is a flowchart which shows the position detection method which concerns on 1st Embodiment. 図7に示す位置検出方法のうち、ステップS1を詳細に示すフローチャートである。Of the position detection methods shown in FIG. 7, it is a flowchart showing step S1 in detail. 図7に示すステップS1を説明するための図である。It is a figure for demonstrating step S1 shown in FIG. 図9に示す位置検出方法で取得される、校正角、テンプレート画像、基準座標、および、係数を示す一覧表である。It is a list which shows the calibration angle, the template image, the reference coordinate, and the coefficient acquired by the position detection method shown in FIG. 図2に示すエンコーダーが備える撮像素子の撮像画像を説明するための図である。It is a figure for demonstrating the image capture image of the image pickup element included in the encoder shown in FIG. 図11に示す撮像画像内に設定される探索領域でのテンプレートマッチングを説明するための図である。It is a figure for demonstrating the template matching in the search area set in the captured image shown in FIG. テンプレートマッチングの際に相関値が最大または最小となる状態から1画素分ずれた状態を示す図である。It is a figure which shows the state which deviated by 1 pixel from the state which the correlation value becomes the maximum or the minimum at the time of template matching. テンプレートマッチングの際に相関値が最大または最小となる状態を示す図である。It is a figure which shows the state which the correlation value becomes the maximum or the minimum at the time of template matching. テンプレートマッチングの際に相関値が最大または最小となる状態から図13に示す状態とは反対側に1画素分ずれた状態を示す図である。It is a figure which shows the state which deviated by 1 pixel from the state which the correlation value becomes the maximum or the minimum at the time of template matching to the side opposite to the state shown in FIG. 第2実施形態に係る位置検出方法のうち、ステップS1を詳細に示すフローチャートである。It is a flowchart which shows step S1 in detail in the position detection method which concerns on 2nd Embodiment. 図16に示す位置検出方法で取得される、校正角、テンプレート画像、基準座標、および、係数を示す一覧表である。It is a list which shows the calibration angle, the template image, the reference coordinate, and the coefficient acquired by the position detection method shown in FIG.

以下、本発明の位置検出方法、エンコーダーユニットおよびロボットの好適な実施形態を添付図面に基づいて詳細に説明する。 Hereinafter, preferred embodiments of the position detection method, encoder unit, and robot of the present invention will be described in detail with reference to the accompanying drawings.

1.ロボット
図1は、実施形態に係るロボットを示す側面図である。なお、以下では、説明の便宜上、図1中の上側を「上」、下側を「下」と言う。また、図1中の基台側を「基端側」、その反対側を「先端側」と言う。
1. 1. Robot FIG. 1 is a side view showing a robot according to an embodiment. In the following, for convenience of explanation, the upper side in FIG. 1 is referred to as “upper” and the lower side is referred to as “lower”. Further, the base side in FIG. 1 is referred to as a "base end side", and the opposite side is referred to as a "tip side".

図1に示すロボット100は、いわゆる水平多関節ロボット(スカラロボット)であり、例えば、精密機器等を製造する製造工程等で用いられ、精密機器や部品等の把持や搬送等を行うことができる。 The robot 100 shown in FIG. 1 is a so-called horizontal articulated robot (SCARA robot), and is used, for example, in a manufacturing process for manufacturing precision equipment and the like, and can grip and transport precision equipment and parts. ..

図1に示すように、ロボット100は、基台110と、第1アーム120と、第2アーム130と、作業ヘッド140と、エンドエフェクター150と、配線引き回し部160と、を有している。以下、ロボット100の各部を順次簡単に説明する。 As shown in FIG. 1, the robot 100 has a base 110, a first arm 120, a second arm 130, a work head 140, an end effector 150, and a wiring routing portion 160. Hereinafter, each part of the robot 100 will be briefly described in sequence.

基台110は、例えば、図示しない床面にボルト等によって固定されている。基台110の上端部には、第1アーム120が連結されている。第1アーム120は、基台110を通る第1軸J1まわりに回動可能となっている。 The base 110 is fixed to, for example, a floor surface (not shown) with bolts or the like. The first arm 120 is connected to the upper end of the base 110. The first arm 120 is rotatable around the first axis J1 passing through the base 110.

基台110内には、第1アーム120を回動させる駆動力を発生させるモーター111と、モーター111の駆動力を減速する減速機112とが設置されている。減速機112の入力軸は、モーター111の回動軸に連結され、減速機112の出力軸は、第1アーム120に連結されている。そのため、モーター111が駆動し、その駆動力が減速機112を介して第1アーム120に伝達されると、第1アーム120が基台110に対して第1軸J1まわりに回動する。 A motor 111 that generates a driving force for rotating the first arm 120 and a speed reducer 112 that reduces the driving force of the motor 111 are installed in the base 110. The input shaft of the speed reducer 112 is connected to the rotation shaft of the motor 111, and the output shaft of the speed reducer 112 is connected to the first arm 120. Therefore, when the motor 111 is driven and the driving force is transmitted to the first arm 120 via the speed reducer 112, the first arm 120 rotates around the first axis J1 with respect to the base 110.

また、基台110および第1アーム120には、減速機112の出力軸の回動角度を検出することで、基台110に対する第1アーム120の回動状態を検出する第1エンコーダーであるエンコーダー1が設けられている。 Further, the base 110 and the first arm 120 are encoders that are first encoders that detect the rotational state of the first arm 120 with respect to the base 110 by detecting the rotation angle of the output shaft of the speed reducer 112. 1 is provided.

第1アーム120の先端部には、第2アーム130が連結している。第2アーム130は、第1アーム120に対して第2軸J2まわりに回動可能となっている。図示しないが、第2アーム130内には、第2アーム130を回動させる駆動力を発生させる第2モーターと、第2モーターの駆動力を減速する減速機とが設置されている。そして、第2モーターの駆動力が減速機を介して第1アーム120に伝達されることにより、第2アーム130が第1アーム120に対して第2軸J2まわりに回動する。また、図示しないが、第2モーターには、第1アーム120に対する第2アーム130の回動状態を検出する、前述したエンコーダー1とは別のエンコーダーが設けられている。 A second arm 130 is connected to the tip of the first arm 120. The second arm 130 is rotatable around the second axis J2 with respect to the first arm 120. Although not shown, a second motor that generates a driving force for rotating the second arm 130 and a speed reducer that reduces the driving force of the second motor are installed in the second arm 130. Then, the driving force of the second motor is transmitted to the first arm 120 via the speed reducer, so that the second arm 130 rotates around the second axis J2 with respect to the first arm 120. Further, although not shown, the second motor is provided with an encoder different from the encoder 1 described above, which detects the rotational state of the second arm 130 with respect to the first arm 120.

第2アーム130の先端部には、作業ヘッド140が配置されている。作業ヘッド140は、第2アーム130の先端部に同軸的に配置された、図示しないスプラインナットおよび図示しないボールネジナットに挿通されたスプラインシャフト141を有している。スプラインシャフト141は、第2アーム130に対して第3軸J3まわりに回転可能であり、かつ、上下方向に移動(昇降)可能となっている。 A work head 140 is arranged at the tip of the second arm 130. The working head 140 has a spline shaft 141 inserted through a spline nut (not shown) and a ball screw nut (not shown) coaxially arranged at the tip of the second arm 130. The spline shaft 141 can rotate around the third axis J3 with respect to the second arm 130, and can move (up and down) in the vertical direction.

第2アーム130内には、図示しないが、回転モーターおよび昇降モーターが配置されている。回転モーターの駆動力は、図示しない駆動力伝達機構によってスプラインナットに伝達され、スプラインナットが正逆回転すると、スプラインシャフト141が鉛直方向に沿う第3軸J3まわりに正逆回転する。また、図示しないが、回転モーターには、第2アーム130に対するスプラインシャフト141の回動状態を検出する、前述したエンコーダー1とは別のエンコーダーが設けられている。 Although not shown, a rotary motor and an elevating motor are arranged in the second arm 130. The driving force of the rotary motor is transmitted to the spline nut by a driving force transmission mechanism (not shown), and when the spline nut rotates forward and reverse, the spline shaft 141 rotates forward and reverse around the third axis J3 along the vertical direction. Further, although not shown, the rotary motor is provided with an encoder different from the encoder 1 described above, which detects the rotational state of the spline shaft 141 with respect to the second arm 130.

一方、昇降モーターの駆動力は、図示しない駆動力伝達機構によってボールネジナットに伝達され、ボールネジナットが正逆回転すると、スプラインシャフト141が上下に移動する。昇降モーターには、第2アーム130に対するスプラインシャフト141の移動量を検出する、前述したエンコーダー1とは別のエンコーダーが設けられている。 On the other hand, the driving force of the elevating motor is transmitted to the ball screw nut by a driving force transmission mechanism (not shown), and when the ball screw nut rotates in the forward and reverse directions, the spline shaft 141 moves up and down. The elevating motor is provided with an encoder different from the encoder 1 described above, which detects the amount of movement of the spline shaft 141 with respect to the second arm 130.

スプラインシャフト141の先端部(下端部)には、エンドエフェクター150が連結されている。エンドエフェクター150としては、特に限定されず、例えば、被搬送物を把持するもの、被加工物を加工するもの等が挙げられる。 An end effector 150 is connected to the tip end portion (lower end portion) of the spline shaft 141. The end effector 150 is not particularly limited, and examples thereof include those that grip an object to be transported, those that process an object to be processed, and the like.

第2アーム130内に配置された各電子部品、例えば、第2モーター、回転モーター、昇降モーター、各エンコーダー等に接続される複数の配線は、第2アーム130と基台110とを連結する管状の配線引き回し部160内を通って基台110内まで引き回されている。さらに、かかる複数の配線は、基台110内でまとめられることによって、モーター111およびエンコーダー1に接続される配線とともに、基台110の外部に設置され、ロボット100を統括制御する図示しない制御装置まで引き回される。 A plurality of wirings connected to each electronic component arranged in the second arm 130, for example, a second motor, a rotary motor, an elevating motor, each encoder, etc., are tubular connecting the second arm 130 and the base 110. It is routed to the base 110 through the wiring route 160 of the above. Further, such a plurality of wirings are grouped in the base 110, and together with the wirings connected to the motor 111 and the encoder 1, are installed outside the base 110 to a control device (not shown) that controls the robot 100 in an integrated manner. Be routed.

以上、ロボット100の構成について簡単に説明したが、このロボット100は、前述したように、第1部材である基台110と、基台110に対して回動する第2部材である第1アーム120と、エンコーダーユニット10と、を備える。ここで、本実施形態に係るエンコーダーユニット10は、回動軸まわりに回転して駆動力を出力する出力軸を有する減速機112と、減速機112の出力軸の回動角度を検出するエンコーダー1と、を有する。そして、基台110内には減速機112が設置されていて、減速機112の出力軸が第1アーム120に接続されている。このようなロボット100によれば、後述するように第1アーム120の回動角度を高精度に検出し、その検出結果に基づいて、第1アーム120の駆動制御を高精度に行うことができる。 The configuration of the robot 100 has been briefly described above. As described above, the robot 100 has a base 110 which is a first member and a first arm which is a second member which rotates with respect to the base 110. A 120 and an encoder unit 10 are provided. Here, the encoder unit 10 according to the present embodiment is a speed reducer 112 having an output shaft that rotates around a rotation shaft and outputs a driving force, and an encoder 1 that detects the rotation angle of the output shaft of the speed reducer 112. And have. A speed reducer 112 is installed in the base 110, and the output shaft of the speed reducer 112 is connected to the first arm 120. According to such a robot 100, as will be described later, the rotation angle of the first arm 120 can be detected with high accuracy, and the drive control of the first arm 120 can be performed with high accuracy based on the detection result. ..

2.第1実施形態
2.1.エンコーダーユニット
以下、第1実施形態に係るエンコーダーユニット10について説明する。なお、エンコーダーユニット10は、様々な機器に組み込まれるが、以下では、エンコーダーユニット10をロボット100に組み込む場合を例に説明する。
2. First Embodiment 2.1. Encoder Unit Hereinafter, the encoder unit 10 according to the first embodiment will be described. The encoder unit 10 is incorporated in various devices, but the case where the encoder unit 10 is incorporated in the robot 100 will be described below as an example.

図2は、第1実施形態に係るエンコーダーユニットを示す断面図である。図3は、図2のエンコーダーを示す機能ブロック図である。図4は、図2のエンコーダーが備えるスケール部を説明するための図である。図5は、図4に示すスケール部のE部拡大図である。図6は、図5に示すスケール部の部分拡大図である。なお、図2および図4〜図6では、説明の便宜上、各部の縮尺が適宜変更されており、図示の構成は実際の縮尺と必ずしも一致するわけではなく、また、各部の図示を適宜簡略化している。 FIG. 2 is a cross-sectional view showing an encoder unit according to the first embodiment. FIG. 3 is a functional block diagram showing the encoder of FIG. FIG. 4 is a diagram for explaining a scale unit included in the encoder of FIG. FIG. 5 is an enlarged view of the E portion of the scale portion shown in FIG. FIG. 6 is a partially enlarged view of the scale portion shown in FIG. In addition, in FIG. 2 and FIGS. 4 to 6, the scale of each part is appropriately changed for convenience of explanation, the structure shown does not necessarily match the actual scale, and the illustration of each part is simplified as appropriate. ing.

図2に示すように、前述したロボット100の基台110は、モーター111と減速機112を支持する支持部材114を有し、モーター111および減速機112を収納している。このような基台110に対して、第1アーム120は、第1軸J1まわりに回動可能になっている。 As shown in FIG. 2, the base 110 of the robot 100 described above has a support member 114 that supports the motor 111 and the speed reducer 112, and houses the motor 111 and the speed reducer 112. With respect to such a base 110, the first arm 120 is rotatable around the first axis J1.

第1アーム120は、図2の左右に延在するアーム本体部121と、アーム本体部121から下方に向けて突出している軸部122と、を有し、これらが互いに接続されている。そして、軸部122は、軸受115を介して基台110に対して第1軸J1まわりに回動可能になっているとともに、減速機112の出力軸に接続されている。また、減速機112の入力軸は、モーター111の回動軸1111に接続されている。減速機112としては、特に限定されないが、例えば、波動減速機、遊星歯車減速機、サイクロ減速機、RV減速機等が挙げられる。 The first arm 120 has an arm main body 121 extending to the left and right in FIG. 2 and a shaft portion 122 protruding downward from the arm main body 121, and these are connected to each other. The shaft portion 122 is rotatable around the first shaft J1 with respect to the base 110 via the bearing 115, and is connected to the output shaft of the speed reducer 112. Further, the input shaft of the speed reducer 112 is connected to the rotation shaft 1111 of the motor 111. The speed reducer 112 is not particularly limited, and examples thereof include a wave speed reducer, a planetary gear speed reducer, a cyclo speed reducer, and an RV speed reducer.

ここで、基台110は、その自重や基台110が支える他の質量による荷重が加わる構造体である。同様に、第1アーム120も、その自重や第1アーム120が支える他の質量による荷重が加わる構造体である。このような基台110および第1アーム120の構成材料としては、それぞれ、特に限定されないが、例えば、金属材料が挙げられる。 Here, the base 110 is a structure to which a load due to its own weight or another mass supported by the base 110 is applied. Similarly, the first arm 120 is also a structure to which a load due to its own weight or another mass supported by the first arm 120 is applied. The constituent materials of the base 110 and the first arm 120 are not particularly limited, and examples thereof include a metal material.

本実施形態では、基台110および第1アーム120の外表面は、ロボット100の外表面の一部を構成している。なお、基台110および第1アーム120の外表面上には、カバー、衝撃吸収材等の外装部材が装着されていてもよい。 In the present embodiment, the outer surfaces of the base 110 and the first arm 120 form a part of the outer surface of the robot 100. An exterior member such as a cover or a shock absorbing material may be mounted on the outer surfaces of the base 110 and the first arm 120.

このような相対的に回動する基台110および第1アーム120には、これらの回動状態を検出するエンコーダー1が設けられている。エンコーダー1は、リニアエンコーダーであってもよいが、以下の説明では、エンコーダー1がロータリーエンコーダーである例について説明する。なお、ロータリーエンコーダーでは、スケール部2の回動角度を検出するが、リニアエンコーダーでは、直動するスケール部の位置を検出する。 Such a relatively rotating base 110 and the first arm 120 are provided with an encoder 1 for detecting these rotating states. The encoder 1 may be a linear encoder, but in the following description, an example in which the encoder 1 is a rotary encoder will be described. The rotary encoder detects the rotation angle of the scale unit 2, while the linear encoder detects the position of the linearly moving scale unit.

エンコーダー1は、第1アーム120に設けられているスケール部2と、基台110に設けられている検出部3と、検出部3に電気的に接続された回路部4と、を有する。回路部4は、処理部5と、記憶部6と、を有する。 The encoder 1 has a scale unit 2 provided on the first arm 120, a detection unit 3 provided on the base 110, and a circuit unit 4 electrically connected to the detection unit 3. The circuit unit 4 includes a processing unit 5 and a storage unit 6.

図2に示すように、スケール部2は、アーム本体部121の基台110と対向する部分、すなわち、アーム本体部121の下面であって軸部122を囲む部分に設けられている。このスケール部2は、図4に示すように、第1軸J1とは異なる位置で第1軸J1まわりに沿って配置されているドットパターンを有している。 As shown in FIG. 2, the scale portion 2 is provided on a portion of the arm main body portion 121 facing the base 110, that is, a portion on the lower surface of the arm main body portion 121 that surrounds the shaft portion 122. As shown in FIG. 4, the scale portion 2 has a dot pattern arranged around the first axis J1 at a position different from that of the first axis J1.

スケール部2は、例えば第1アーム120の表面に設けられる。これにより、スケール部2を設けるための部材を第1アーム120とは別に設ける必要がない。そのため、部品点数を少なくすることができる。なお、スケール部2は、第1アーム120の表面に直に設けられている場合に限定されず、例えば、第1アーム120の表面に貼着されたシート状の部材に設けられていてもよいし、第1アーム120とともに回動するように設けられた板状の部材に設けられていてもよい。すなわち、スケール部2が設けられる部材は、第1アーム120とともに基台110に対して第1軸J1まわりに回動する部材であればよい。 The scale portion 2 is provided on the surface of the first arm 120, for example. As a result, it is not necessary to provide a member for providing the scale portion 2 separately from the first arm 120. Therefore, the number of parts can be reduced. The scale portion 2 is not limited to the case where it is provided directly on the surface of the first arm 120, and may be provided on, for example, a sheet-like member attached to the surface of the first arm 120. However, it may be provided on a plate-shaped member provided so as to rotate together with the first arm 120. That is, the member provided with the scale portion 2 may be a member that rotates around the first axis J1 with respect to the base 110 together with the first arm 120.

図4ないし図6に示すように、スケール部2は、複数のドット20が列状に配置されてなるマーク21を複数有している。複数のマーク21は、第1軸J1を中心とする円周に沿って、ほぼ等間隔で配置されている。なお、以下の説明では、第1軸J1を中心とする円の半径が延在する方向を「半径方向DR」といい、半径方向DRに直交する方向を「周方向DC」という。 As shown in FIGS. 4 to 6, the scale unit 2 has a plurality of marks 21 in which a plurality of dots 20 are arranged in a row. The plurality of marks 21 are arranged at substantially equal intervals along the circumference centered on the first axis J1. In the following description, the direction in which the radius of the circle centered on the first axis J1 extends is referred to as "radial DR", and the direction orthogonal to the radial DR is referred to as "circumferential DC".

マーク21は、図5に示すように、周方向DCにおける長さに比べて半径方向DRにおける長さが長い形状をなしている。このマーク21は、図6に示すように、複数のドット20が半径方向DRに沿って列をなし、かつ、その列が周方向DCに沿って4列並んだものである。各列では、ドット20が周方向DCに沿ってずれているが、このドット20のずれのパターンが、マーク21を一意に識別する固有の識別子として機能する。本実施形態では、半径方向DRに並んだ4つのドット20で形成される列を1つの単位とし、この単位が周方向DCに4列並んでなる16個のドット20によって、後述するテンプレートマッチングにおいてテンプレート画像になり得る配列パターンが構成されている。したがって、各マーク21は、それぞれ、それ自身以外のマーク21とは異なる配列パターンを含んでいる。 As shown in FIG. 5, the mark 21 has a shape in which the length in the radial direction DR is longer than the length in the circumferential direction DC. As shown in FIG. 6, the mark 21 has a plurality of dots 20 arranged in a row along the radial DR, and the rows are arranged in four rows along the circumferential direction DC. In each column, the dots 20 are displaced along the circumferential DC, and the pattern of the deviation of the dots 20 functions as a unique identifier that uniquely identifies the mark 21. In the present embodiment, a row formed by four dots 20 arranged in the radial direction DR is set as one unit, and 16 dots 20 in which the units are arranged in four rows in the circumferential direction DC are used in template matching described later. An array pattern that can be a template image is configured. Therefore, each mark 21 contains an arrangement pattern different from that of the other marks 21.

そうすると、このようなマーク21を有するスケール部2を第1軸J1まわりに回動させたとき、後述する撮像画像G内の所定領域において、同じ配列パターンは2回以上出現しないことになる。本願明細書では、このような識別性を持つことを「ユニーク」といい、ユニークなパターンのことを「ユニークパターンUP」という。各マーク21に含まれた固有のユニークパターンUPを識別することができれば、スケール部2の周方向における絶対位置を識別することができる。 Then, when the scale portion 2 having such a mark 21 is rotated around the first axis J1, the same array pattern does not appear more than once in a predetermined region in the captured image G described later. In the specification of the present application, having such distinctiveness is referred to as "unique", and a unique pattern is referred to as "unique pattern UP". If the unique unique pattern UP included in each mark 21 can be identified, the absolute position of the scale portion 2 in the circumferential direction can be identified.

また、ユニークパターンUPは、マーク21の半径方向DRにおいて繰り返し含まれているのが好ましい。これにより、図5に示す撮像領域RIが半径方向DRにずれた場合でも、これらの領域にユニークパターンUPを捉えることができる。 Further, it is preferable that the unique pattern UP is repeatedly included in the radial DR of the mark 21. As a result, even when the imaging region RI shown in FIG. 5 is displaced in the radial direction DR, the unique pattern UP can be captured in these regions.

図6に示すドット20の位置、大きさ、数、配列パターン等は、一例であり、これに限定されるものではない。また、図2とは逆に、スケール部2を基台110側に配置し、検出部3を第1アーム120側に配置してもよい。 The positions, sizes, numbers, arrangement patterns, and the like of the dots 20 shown in FIG. 6 are examples, and are not limited thereto. Further, contrary to FIG. 2, the scale unit 2 may be arranged on the base 110 side, and the detection unit 3 may be arranged on the first arm 120 side.

各図に示すマーク21は、白地に複数の黒色のドット20をユニークに配置することにより構成されている。なお、ドット20の形状は、図示では円形であるが、これに限定されず、例えば、楕円形、四角形、異形状等であってもよい。また、マーク21は、複数のドット20で構成されたドットパターンに限定されず、例えば、直線状のラインで構成されたパターン、曲線状のラインで構成されたパターン、ドット、直線状のラインおよび曲線状のラインのうちの少なくとも2つを組み合わせて構成されたパターンであってもよい。さらに、マーク21は、上述したパターンの白地と黒色のドットまたはラインを反転したパターン、すなわち黒地と白色のドットまたはラインのパターンであってもよい。また、ドット20は、例えば、染料、顔料等のインクで形成されたものであってもよいし、凹凸形状によるものであってもよい。 The mark 21 shown in each figure is configured by uniquely arranging a plurality of black dots 20 on a white background. The shape of the dot 20 is circular in the drawing, but is not limited to this, and may be, for example, an ellipse, a quadrangle, or an irregular shape. Further, the mark 21 is not limited to a dot pattern composed of a plurality of dots 20, and for example, a pattern composed of linear lines, a pattern composed of curved lines, dots, linear lines, and the like. The pattern may be composed of a combination of at least two of the curved lines. Further, the mark 21 may be a pattern in which the white background and the black dots or lines of the above-mentioned pattern are inverted, that is, a pattern of the black background and the white dots or lines. Further, the dots 20 may be formed of, for example, an ink such as a dye or a pigment, or may have an uneven shape.

また、マーク21は、ドット20のような図柄を用いたものに限定されず、例えば、数字を含んでいてもよいし、ローマ字、アラビア文字、漢字等の文字を含んでいてもよいし、文字以外の記号、符号、しるし、標章、図案、1次元バーコード、QRコード(登録商標)等を含んでいてもよい。 Further, the mark 21 is not limited to the one using a pattern such as a dot 20, and may include, for example, a number, a character such as a Roman character, an Arabic character, or a Chinese character, or a character. Other symbols, codes, marks, marks, designs, one-dimensional barcodes, QR codes (registered trademarks) and the like may be included.

図2に示す検出部3は、基台110内に設けられている撮像素子31と、基台110が有する開口に設けられている光学系32と、を有し、撮像素子31が光学系32を介してスケール部2の周方向DCの一部、具体的には図5の撮像領域RIを撮像する。撮像領域RIの画角は、複数のマーク21を同一画像内に捉えられる角度に設定されるのが好ましい。なお、必要に応じて、撮像素子31の撮像領域RIを照明する光源を設けてもよい。 The detection unit 3 shown in FIG. 2 includes an image pickup element 31 provided in the base 110 and an optical system 32 provided in the opening of the base 110, and the image pickup element 31 is an optical system 32. A part of the circumferential direction DC of the scale unit 2, specifically, the image pickup region RI of FIG. 5 is imaged via the image sensor. The angle of view of the imaging region RI is preferably set to an angle at which a plurality of marks 21 can be captured in the same image. If necessary, a light source that illuminates the image pickup region RI of the image pickup device 31 may be provided.

撮像素子31としては、例えば、CCD(Charge Coupled Devices)、CMOS(Complementary Metal Oxide Semiconductor)等が挙げられる。このような撮像素子31は、撮影された画像を画素ごとの電気信号に変換して出力する。撮像素子31は、2次元撮像素子(エリアイメージセンサ)、あるいは1次元撮像素子(ラインイメージセンサ)のどちらであってもよい。1次元撮像素子は、画素の並びがアームの旋回円に接する方向に配置することが望ましい。2次元撮像素子を用いた場合は、情報量の多い2次元画像を生成でき、後述のテンプレートマッチングによるドット20の検出精度を高めやすい。その結果、第1アーム120の回動状態を高精度に検出することができる。1次元撮像素子を用いた場合は、画像のサンプリング周期いわゆるフレームレートが高いため、検出頻度を高めることが可能になり、高速動作時に有利である。本実施形態では、撮像素子31は、2次元撮像素子である。 Examples of the image sensor 31 include CCD (Charge Coupled Devices), CMOS (Complementary Metal Oxide Semiconductor), and the like. Such an image sensor 31 converts the captured image into an electric signal for each pixel and outputs the image. The image sensor 31 may be either a two-dimensional image sensor (area image sensor) or a one-dimensional image sensor (line image sensor). It is desirable that the one-dimensional image sensor is arranged in a direction in which the arrangement of pixels is in contact with the swirling circle of the arm. When a two-dimensional image sensor is used, a two-dimensional image having a large amount of information can be generated, and it is easy to improve the detection accuracy of the dot 20 by template matching described later. As a result, the rotational state of the first arm 120 can be detected with high accuracy. When a one-dimensional image sensor is used, since the image sampling cycle, that is, the frame rate, is high, it is possible to increase the detection frequency, which is advantageous during high-speed operation. In the present embodiment, the image sensor 31 is a two-dimensional image sensor.

光学系32は、スケール部2と撮像素子31との間に配置されている結像光学系である。この光学系32は、少なくとも物体側(スケール部2側)がテレセントリックであることが好ましい。これにより、スケール部2と撮像素子31との間の距離が変動しても、撮像素子31への結像倍率の変化を低減することができ、その結果、エンコーダー1の検出精度の低下を低減することができる。特に、光学系32が両側テレセントリックである場合、光学系32が有するレンズと撮像素子31との間の距離が変動しても、撮像素子31への結像倍率の変化を低減することができる。そのため、光学系32の組み立てが容易になるという利点がある。 The optical system 32 is an imaging optical system arranged between the scale unit 2 and the image pickup device 31. It is preferable that at least the object side (scale portion 2 side) of the optical system 32 is telecentric. As a result, even if the distance between the scale unit 2 and the image sensor 31 fluctuates, the change in the imaging magnification on the image sensor 31 can be reduced, and as a result, the decrease in the detection accuracy of the encoder 1 is reduced. can do. In particular, when the optical system 32 is telecentric on both sides, even if the distance between the lens of the optical system 32 and the image sensor 31 fluctuates, the change in the imaging magnification on the image sensor 31 can be reduced. Therefore, there is an advantage that the optical system 32 can be easily assembled.

ここで、図5に示すように、撮像素子31の撮像領域RIは、スケール部2の周方向DCにおける一部と重なるように設定されている。これにより、撮像素子31は、撮像領域RI内にあるドット20を撮像することができる。したがって、回路部4においてこのドット20を読み取ることにより、第1アーム120の回動状態を知ることができる。 Here, as shown in FIG. 5, the image pickup region RI of the image pickup device 31 is set so as to overlap a part of the scale unit 2 in the circumferential direction DC. As a result, the image sensor 31 can image the dots 20 in the image pickup region RI. Therefore, by reading the dot 20 in the circuit unit 4, the rotational state of the first arm 120 can be known.

図2および図3に示す回路部4は、処理装置である処理部5(プロセッサー)と、ROM(Read only memory)、RAM(Random Access Memory)等の記憶部6(メモリー)と、を有する。ここで、記憶部6には、処理部5で読み取り可能な指示や情報が記憶されており、処理部5は、記憶部6から指示や情報を適宜読み取って実行することで、各種機能を実現する。このような回路部4は、例えば、マイコンやASIC(application specific integrated circuit)またはFPGA(field-programmable gate array)等を用いて構成することができる。特にASICまたはFPGAを用いて回路部4をハードウェア化することで、回路部4の高処理速度化、小型化および低コスト化を図ることができる。なお、回路部4の少なくとも一部は、前述したロボット100の制御装置に組み込まれていてもよい。 The circuit unit 4 shown in FIGS. 2 and 3 includes a processing unit 5 (processor) which is a processing device, and a storage unit 6 (memory) such as a ROM (Read only memory) and a RAM (Random Access Memory). Here, the storage unit 6 stores instructions and information that can be read by the processing unit 5, and the processing unit 5 realizes various functions by appropriately reading and executing the instructions and information from the storage unit 6. To do. Such a circuit unit 4 can be configured by using, for example, a microcomputer, an ASIC (application specific integrated circuit), an FPGA (field-programmable gate array), or the like. In particular, by hardwareizing the circuit unit 4 using an ASIC or FPGA, it is possible to increase the processing speed, reduce the size, and reduce the cost of the circuit unit 4. At least a part of the circuit unit 4 may be incorporated in the control device of the robot 100 described above.

処理部5は、検出部3の検出結果に基づいて、基台110および第1アーム120の相対的な回動状態を推定する。この回動状態としては、例えば、回動角度、回動速度、回動方向等が挙げられる。 The processing unit 5 estimates the relative rotational state of the base 110 and the first arm 120 based on the detection result of the detection unit 3. Examples of the rotation state include a rotation angle, a rotation speed, a rotation direction, and the like.

特に、処理部5は、撮像素子31の撮像画像に対してテンプレート画像を用いてテンプレートマッチングすることでユニークパターンUPを画像認識し、その認識結果を用いて、基台110に対する第1アーム120の相対的な回動状態を推定する。 In particular, the processing unit 5 recognizes the unique pattern UP by template matching the image captured by the image sensor 31 using the template image, and uses the recognition result of the first arm 120 with respect to the base 110. Estimate the relative rotation state.

また、処理部5は、撮像素子31の撮像画像内におけるユニークパターンUPの位置に基づいて、基台110に対する第1アーム120の相対的な回動角度をより細かく推定する機能を有する。さらに、処理部5は、ユニークパターンUPが検出される時間間隔およびユニークパターンUPの移動量に基づいて回動速度を求めたり、検出されるユニークパターンUPの種類の順序に基づいて回動方向を推定したりする機能も有する。そして、処理部5は、前述した推定結果に応じた信号、すなわち、基台110に対する第1アーム120の相対的な回動状態に応じた信号を出力する。この信号は、例えば、図示しない制御装置に入力され、ロボット100の動作の制御に用いられる。 Further, the processing unit 5 has a function of estimating the relative rotation angle of the first arm 120 with respect to the base 110 in more detail based on the position of the unique pattern UP in the captured image of the image pickup device 31. Further, the processing unit 5 obtains the rotation speed based on the time interval in which the unique pattern UP is detected and the movement amount of the unique pattern UP, and determines the rotation direction based on the order of the types of the detected unique pattern UP. It also has a function to estimate. Then, the processing unit 5 outputs a signal corresponding to the above-mentioned estimation result, that is, a signal corresponding to the relative rotation state of the first arm 120 with respect to the base 110. This signal is input to, for example, a control device (not shown) and used to control the operation of the robot 100.

また、処理部5は、撮像素子31の撮像画像の一部を切り取ってテンプレート画像を生成する機能を有する。このテンプレート画像の生成は、基台110に対する第1アーム120の相対的な回動状態を推定するのに先立って、あるいは、必要に応じて適時、基台110に対する第1アーム120の相対的な回動角度における所定の校正角ごとに行われる。そして、生成したテンプレート画像は、校正角ごとに対応して記憶部6に記憶される。そして、処理部5は、記憶部6に記憶されているテンプレート画像を用いて、テンプレートマッチングを行う。なお、テンプレートマッチングおよびそれを用いた回動状態の推定については、後に詳述する。 In addition, the processing unit 5 has a function of cutting out a part of the captured image of the image pickup device 31 to generate a template image. The generation of this template image is prior to estimating the rotational state of the first arm 120 relative to the base 110, or as needed, relative to the first arm 120 relative to the base 110. It is performed at each predetermined calibration angle in the rotation angle. Then, the generated template image is stored in the storage unit 6 corresponding to each calibration angle. Then, the processing unit 5 performs template matching using the template image stored in the storage unit 6. The template matching and the estimation of the rotation state using the template matching will be described in detail later.

なお、処理部5は、基台110内に設けられた機器(内部機器)と基台110外に設けられた機器(外部機器)の双方を含む構成であってもよい。この場合、外部機器は、例えばパーソナルコンピューターで構成される。外部機器は、撮像画像の一部を切り取ってテンプレート画像を生成する機能を担うのが好ましい。この機能を外部機器に担わせることにより、内部機器の機能を簡素化することができ、基台110の小型化および低コスト化を図りやすくなる。 The processing unit 5 may be configured to include both a device (internal device) provided inside the base 110 and a device (external device) provided outside the base 110. In this case, the external device is composed of, for example, a personal computer. The external device preferably has a function of cutting out a part of the captured image to generate a template image. By assigning this function to the external device, the function of the internal device can be simplified, and it becomes easy to reduce the size and cost of the base 110.

記憶部6には、処理部5で読み取り可能な指示(プログラム)の他、処理部5で読み取り可能な各種情報(データ)が記憶されている。具体的には、記憶部6には、基台110に対する第1アーム120の相対的な回動状態ごとに、前述した撮像画像が、撮像画像内でのユニークパターンUPの座標(基準座標)に関する情報、および、第1アーム120の回動角度に関する情報(角度情報)とともに記憶されている。このような記憶部6は、不揮発性メモリー、揮発性メモリーのいずれであってもよいが、電力を供給しなくても情報を記憶した状態を保持することができ、省電力化を図ることができるという観点から、不揮発性メモリーであることが好ましい。 In addition to instructions (programs) that can be read by the processing unit 5, various information (data) that can be read by the processing unit 5 is stored in the storage unit 6. Specifically, in the storage unit 6, the above-mentioned captured image relates to the coordinates (reference coordinates) of the unique pattern UP in the captured image for each relative rotation state of the first arm 120 with respect to the base 110. It is stored together with the information and the information (angle information) regarding the rotation angle of the first arm 120. Such a storage unit 6 may be either a non-volatile memory or a volatile memory, but can hold a state in which information is stored without supplying power, and power saving can be achieved. From the viewpoint of being able to do so, a non-volatile memory is preferable.

2.2.位置検出方法
次に、第1実施形態に係る位置検出方法について説明する。
2.2. Position detection method Next, the position detection method according to the first embodiment will be described.

第1実施形態に係る位置検出方法は、テンプレート画像とそれに関する情報を取得するステップS1と、取得したテンプレート画像に基づいてスケール部2の回動角度を検出するステップS2と、を有する。かかる位置検出方法によれば、軸振れを伴う場合であっても、検出精度を高めることができる。 The position detection method according to the first embodiment includes a step S1 for acquiring a template image and information related thereto, and a step S2 for detecting the rotation angle of the scale unit 2 based on the acquired template image. According to such a position detection method, the detection accuracy can be improved even when the shaft runout is involved.

図7は、第1実施形態に係る位置検出方法を示すフローチャートである。図8は、図7に示す位置検出方法のうち、ステップS1を詳細に示すフローチャートである。図9は、図7に示すステップS1を説明するための図である。図10は、図9に示す位置検出方法で取得される、校正角、テンプレート画像、基準座標、および、係数を示す一覧表である。 FIG. 7 is a flowchart showing a position detection method according to the first embodiment. FIG. 8 is a flowchart showing step S1 in detail among the position detection methods shown in FIG. 7. FIG. 9 is a diagram for explaining step S1 shown in FIG. 7. FIG. 10 is a list showing calibration angles, template images, reference coordinates, and coefficients acquired by the position detection method shown in FIG.

ステップS1は、図8に示すように、ステップS101〜S114を含んでいる。以下、各ステップについて説明する。 Step S1 includes steps S101 to S114, as shown in FIG. Hereinafter, each step will be described.

2.2.1.テンプレート画像等の取得
図7に示すステップS1では、テンプレートマッチングを用いて基台110に対する第1アーム120の相対的な回動状態を推定するのに先立って、テンプレートマッチングに用いるテンプレート画像とそれに関する情報を含むデータセットを取得する。このテンプレート画像等の取得は、最初のテンプレートマッチングの前に1回行うだけでよいが、その後必要に応じて適時行ってもよい。その場合、テンプレートマッチングに用いるテンプレート画像を、新たに取得したテンプレート画像に更新することができる。
2.2.1. Acquisition of template image, etc. In step S1 shown in FIG. 7, a template image used for template matching and related to the template image are used prior to estimating the relative rotation state of the first arm 120 with respect to the base 110 using template matching. Get a dataset that contains information. The acquisition of the template image or the like may be performed only once before the first template matching, but may be performed after that as needed. In that case, the template image used for template matching can be updated with the newly acquired template image.

このステップS1では、まず、ステップS101として、エンコーダー1の回動軸と図示しない校正用エンコーダーとを機械的に接続する。校正用エンコーダーは、エンコーダー1の回動軸の回動角度、すなわちスケール部2の位置を十分な高精度で検出する角度校正用のエンコーダーである。これにより、テンプレート画像に対し、高精度の角度情報を付与することができる。 In step S1, first, as step S101, the rotation shaft of the encoder 1 and a calibration encoder (not shown) are mechanically connected. The calibration encoder is an angle calibration encoder that detects the rotation angle of the rotation shaft of the encoder 1, that is, the position of the scale unit 2 with sufficiently high accuracy. As a result, highly accurate angle information can be added to the template image.

次に、ステップS102として、エンコーダー1の回動軸を回動させ、スケール部2を開始角に合わせる。開始角は、特に限定されないが、スケール部2が含む複数のマーク21の1つを、撮像素子31の撮像画像に捉えたときの回動角度とする。 Next, in step S102, the rotation shaft of the encoder 1 is rotated to align the scale portion 2 with the start angle. The start angle is not particularly limited, but is a rotation angle when one of the plurality of marks 21 included in the scale unit 2 is captured in the image captured by the image sensor 31.

ここで、校正用エンコーダーで検出したエンコーダー1の回動軸の回動角度、すなわちスケール部2の回動角度を校正角θ[i]とする。変数iは、周方向DCに沿ってマーク21に付した番号に相当する値であり、スケール部2に設けられたマーク21の個数n+1に対応して、0からnまでの整数をとる。 Here, the rotation angle of the rotation shaft of the encoder 1 detected by the calibration encoder, that is, the rotation angle of the scale unit 2 is defined as the calibration angle θ [i]. The variable i is a value corresponding to the number assigned to the mark 21 along the circumferential direction DC, and takes an integer from 0 to n corresponding to the number n + 1 of the marks 21 provided in the scale unit 2.

次に、ステップS103として、変数iを0とする。エンコーダー1の回動軸が前述した開始角にあるとき、撮像素子31の撮像画像には、いずれかのマーク21が捉えられている。 Next, in step S103, the variable i is set to 0. When the rotation axis of the encoder 1 is at the start angle described above, one of the marks 21 is captured in the image captured by the image sensor 31.

次に、ステップS104として、記憶部6に校正角θ[i](第1位置)を記憶させる。ここでは、変数iとして0を設定しているため、校正角θ[0]を記憶させる。 Next, as step S104, the storage unit 6 stores the calibration angle θ [i] (first position). Here, since 0 is set as the variable i, the calibration angle θ [0] is stored.

次に、ステップS105として、エンコーダー1の撮像素子31にマーク21を撮像させる。これにより、撮像画像[i](第1基準画像)を生成する。ここでは、変数iとして0を設定しているため、撮像画像[0]を生成する。撮像画像[0]には、校正角θ[0]に対応するマーク21に含まれたユニークパターンUPが捉えられている。生成した撮像画像[0]は、記憶部6に一時的に記憶させる。 Next, in step S105, the image sensor 31 of the encoder 1 is made to image the mark 21. As a result, the captured image [i] (first reference image) is generated. Here, since 0 is set as the variable i, the captured image [0] is generated. In the captured image [0], the unique pattern UP included in the mark 21 corresponding to the calibration angle θ [0] is captured. The generated captured image [0] is temporarily stored in the storage unit 6.

次に、ステップS106として、変数iが0より大きいか否かを判断する。変数iが0より大きい場合、ステップS107、S108に移行する。変数iが0である場合、ステップS109〜S114に移行する。この時点では、変数iが0であるため、まず、ステップS109〜S114について説明し、ステップS107、S108については、後述する。 Next, in step S106, it is determined whether or not the variable i is larger than 0. If the variable i is larger than 0, the process proceeds to steps S107 and S108. If the variable i is 0, the process proceeds to steps S109 to S114. Since the variable i is 0 at this point, steps S109 to S114 will be described first, and steps S107 and S108 will be described later.

ステップS109では、変数iがn以下であるか否かを判断する。この変数iがn以下である場合、後述するテンプレート画像の取得を引き続き進める必要があるため、ステップS110に移行する。変数iがnより大きい場合、つまり、n+1である場合、全てのマーク21について、テンプレート画像の取得を終了したことになるため、テンプレート画像の取得等についてのステップフローは終了する。なお、この時点では変数iが0であるため、以下の説明では、まず、ステップS110等について説明する。 In step S109, it is determined whether or not the variable i is n or less. If this variable i is n or less, it is necessary to continue to acquire the template image described later, so the process proceeds to step S110. When the variable i is larger than n, that is, when it is n + 1, it means that the acquisition of the template image is completed for all the marks 21, so the step flow for acquiring the template image and the like is completed. Since the variable i is 0 at this point, step S110 and the like will be described first in the following description.

ステップS110では、記憶部6から撮像画像[i](第1基準画像)を読み出し、ユニークパターンUPが欠けることなく含まれるように、撮像画像[i]の切り出し位置を決定する。ここでは、変数iとして0を設定しているため、撮像画像[0]の切り出し位置を決定する。 In step S110, the captured image [i] (first reference image) is read from the storage unit 6, and the cutout position of the captured image [i] is determined so that the unique pattern UP is included without being chipped. Here, since 0 is set as the variable i, the cutout position of the captured image [0] is determined.

ステップS111では、撮像画像[i]における切り出し位置の左上端の座標を基準座標[i](第1基準座標)とする。ここでは、変数iとして0を設定しているため、撮像画像[i]における切り出し位置の左上端の座標を基準座標[0]とする。 In step S111, the coordinates of the upper left end of the cutout position in the captured image [i] are set as the reference coordinates [i] (first reference coordinates). Here, since 0 is set as the variable i, the coordinates of the upper left end of the cutout position in the captured image [i] are set as the reference coordinates [0].

ステップS112では、撮像画像[i]の基準座標[i]に基づいて、ユニークパターンUPの画像を切り出す。これにより、テンプレート画像[i](第1テンプレート画像)を取得する。ここでは、変数iとして0を設定しているため、テンプレート画像[0]を取得する。取得したテンプレート画像[0]および基準座標[0]は、記憶部6に記憶させる。一方、一時的に記憶されていた撮像画像[i]は、これ以降、任意のタイミングで破棄するか、新たな撮像画像を生成したときに上書きされる。 In step S112, an image of the unique pattern UP is cut out based on the reference coordinate [i] of the captured image [i]. As a result, the template image [i] (first template image) is acquired. Here, since 0 is set as the variable i, the template image [0] is acquired. The acquired template image [0] and reference coordinates [0] are stored in the storage unit 6. On the other hand, the temporarily stored captured image [i] is subsequently overwritten when it is discarded at an arbitrary timing or when a new captured image is generated.

このように本実施形態では、テンプレート画像[i]の取得に際し、ユニークパターンUPよりもサイズが大きい撮像画像[i]から、ユニークパターンUPが欠けることなく含まれる領域を切り出し位置として選択し、そこから切り出した画像をテンプレート画像[i]として採用するという方法を用いている。これにより、ユニークパターンUPの形成精度を必要以上に高めることなく、テンプレート画像[i]を取得することができる。このため、スケール部2の形成が容易になるとともに、形成コストの低減を図ることができる。換言すれば、形成精度が低いスケール部2を用いた場合でも、テンプレート画像[i]の取得に際して、低い形成精度を不問にすることができる。 As described above, in the present embodiment, when the template image [i] is acquired, a region including the unique pattern UP is selected as the cutout position from the captured image [i] having a size larger than that of the unique pattern UP. The method of adopting the image cut out from is adopted as the template image [i] is used. As a result, the template image [i] can be acquired without increasing the formation accuracy of the unique pattern UP more than necessary. Therefore, the scale portion 2 can be easily formed and the formation cost can be reduced. In other words, even when the scale portion 2 having a low forming accuracy is used, the low forming accuracy can be made unquestioned when the template image [i] is acquired.

図9には、エンコーダー1の回動軸が校正角θ[0]にあるときに撮像された撮像画像[0]の例が示されている。撮像画像[0]で捉えられている複数のマーク21のうち、画像中心に近いものを選択し、そこからユニークパターンUPを特定して、それが欠けることなく含まれる領域を切り出し位置とする。そして、撮像画像[0]から、切り出し位置の左上端の座標を求め、これを基準座標[0]として求める。また、切り出し位置に含まれるユニークパターンUPの画像を図10に示すようなテンプレート画像[0]として切り出す。 FIG. 9 shows an example of an captured image [0] captured when the rotation axis of the encoder 1 is at the calibration angle θ [0]. Among the plurality of marks 21 captured in the captured image [0], the one close to the center of the image is selected, the unique pattern UP is specified from the mark 21, and the region including the mark without being chipped is set as the cutout position. Then, the coordinates of the upper left end of the cutout position are obtained from the captured image [0], and this is obtained as the reference coordinate [0]. Further, the image of the unique pattern UP included in the cutout position is cut out as a template image [0] as shown in FIG.

次に、ステップS113では、エンコーダー1の回動軸を所定の角度進める。所定の角度とは、例えばマーク21の配置間隔に相当する角度であり、校正角θ[i]において撮像画像[i]の中心付近に捉えたマーク21と、それに隣り合うマーク21と、の離角に相当する角度とされる。これにより、撮像素子31では、隣のマーク21、すなわち後述する校正角θ[i2]に対応するマーク21を視野に捉えることができる。 Next, in step S113, the rotation axis of the encoder 1 is advanced by a predetermined angle. The predetermined angle is, for example, an angle corresponding to the arrangement interval of the marks 21. At the calibration angle θ [i], the mark 21 captured near the center of the captured image [i] and the mark 21 adjacent thereto are separated from each other. It is an angle corresponding to an angle. As a result, the image sensor 31 can capture the adjacent mark 21, that is, the mark 21 corresponding to the calibration angle θ [i2] described later, in the field of view.

次に、ステップS114では、変数iとしてi+1を設定する(変数iを更新する)。ここでは、更新前の変数iと更新後の変数iとを区別するため、更新後の変数iを「i2」と表記する。なお、各フローチャートでは、図示の便宜上、更新前および更新後を区別することなく変数iを使用している。 Next, in step S114, i + 1 is set as the variable i (the variable i is updated). Here, in order to distinguish between the variable i before the update and the variable i after the update, the variable i after the update is referred to as “i2”. In each flowchart, the variable i is used without distinguishing between before and after the update for convenience of illustration.

本ステップS114の直前では、変数iとして0を設定していたので、本ステップS114では変数i2として1が設定されることになる。ステップS114が終了すると、ステップフローは、ステップS104に戻る。 Immediately before this step S114, 0 was set as the variable i, so in this step S114, 1 is set as the variable i2. When step S114 is completed, the step flow returns to step S104.

2回目のステップS104でも、記憶部6に校正角θ[i2](第2位置)を記憶させる。ここでは、変数i2として1を設定しているため、校正角θ[1]を記憶させる。 Also in the second step S104, the storage unit 6 stores the calibration angle θ [i2] (second position). Here, since 1 is set as the variable i2, the calibration angle θ [1] is stored.

2回目のステップS105でも、撮像素子31にマーク21を撮像させる。これにより、撮像画像[i2](第2基準画像)を生成する。ここでは、変数i2として1を設定しているため、撮像画像[1]を生成する。撮像画像[1]には、校正角θ[1]に対応するマーク21に含まれたユニークパターンUPが捉えられている。生成した撮像画像[1]は、記憶部6に一時的に記憶させる。 Also in the second step S105, the image sensor 31 is made to image the mark 21. As a result, the captured image [i2] (second reference image) is generated. Here, since 1 is set as the variable i2, the captured image [1] is generated. In the captured image [1], the unique pattern UP included in the mark 21 corresponding to the calibration angle θ [1] is captured. The generated captured image [1] is temporarily stored in the storage unit 6.

2回目のステップS106でも、変数i2が0より大きいか否かを判断する。変数i2が0より大きい場合、ステップS107、S108に移行する。この説明の例では、この時点で変数i2が1であるため、以下、ステップS107、S108について説明する。 Also in the second step S106, it is determined whether or not the variable i2 is larger than 0. If the variable i2 is larger than 0, the process proceeds to steps S107 and S108. In the example of this explanation, since the variable i2 is 1 at this point, steps S107 and S108 will be described below.

ステップS107では、記憶部6からテンプレート画像[i2−1](第1テンプレート画像)を読み出し、生成した撮像画像[i2](第2基準画像)に対してテンプレートマッチングを行う。そうすると、撮像画像[i2]において、テンプレート画像[i2−1]と合致するユニークパターンUPが捉えられるので、捉えたユニークパターンUPの左上端の座標を、合致座標[i2−1](第1合致座標)とする。ここでは、変数i2として1を設定しているため、テンプレート画像[0]を読み出し、生成した撮像画像[1]に対してテンプレートマッチングを行う。そうすると、合致座標[0]が求められる。 In step S107, the template image [i2-1] (first template image) is read out from the storage unit 6, and template matching is performed on the generated captured image [i2] (second reference image). Then, in the captured image [i2], the unique pattern UP that matches the template image [i2-1] is captured. Therefore, the coordinates of the upper left end of the captured unique pattern UP are set to the matching coordinates [i2-1] (first match). Coordinates). Here, since 1 is set as the variable i2, the template image [0] is read out, and template matching is performed on the generated captured image [1]. Then, the matching coordinates [0] are obtained.

なお、ステップS107では、テンプレートマッチングを行う際、サブピクセル推定という処理を行うようにしてもよい。サブピクセル推定によれば、テンプレートマッチングによってユニークパターンUPの位置を推定する際、1画素以下の単位で位置を推定することができる。その結果、合致座標[i2−1](第1合致座標)をより高精度に求めることができる。 In step S107, a process called sub-pixel estimation may be performed when performing template matching. According to the sub-pixel estimation, when the position of the unique pattern UP is estimated by template matching, the position can be estimated in units of one pixel or less. As a result, the matching coordinates [i2-1] (first matching coordinates) can be obtained with higher accuracy.

以下、テンプレートマッチングおよびサブピクセル推定について説明する。
図11は、図2に示すエンコーダーが備える撮像素子の撮像画像を説明するための図である。
Hereinafter, template matching and sub-pixel estimation will be described.
FIG. 11 is a diagram for explaining an image captured by an image pickup device included in the encoder shown in FIG.

第1アーム120が基台110に対して第1軸J1まわりに回動すると、例えば、図11に示すように、撮像素子31の撮像画像G内に映っているユニークパターンUPの画像であるユニークパターン画像22Aは、撮像画像G内を円弧C1、C2に沿って移動する。ここで、円弧C1は、基台110に対する第1アーム120の回動に伴ってユニークパターン画像22Aの図11中下端が描く軌跡であり、円弧C2は、基台110に対する第1アーム120の回動に伴ってユニークパターン画像22Aの図11中上端が描く軌跡である。また、図11は、図5に示す撮像領域RI内に、互いに異なるマーク21に属する3つのユニークパターンUPが含まれている場合を図示している。そして、これに対応するように、図11に示す撮像画像Gには、ユニークパターン画像22Aの他に、ユニークパターン画像22Aに対して周方向DCでの一方側に位置するユニークパターン画像22Bと、他方側に位置するユニークパターン画像22Xと、が含まれている。 When the first arm 120 rotates around the first axis J1 with respect to the base 110, for example, as shown in FIG. 11, a unique image of the unique pattern UP reflected in the image G of the image sensor 31. The pattern image 22A moves in the captured image G along the arcs C1 and C2. Here, the arc C1 is a locus drawn by the lower center of FIG. 11 of the unique pattern image 22A with the rotation of the first arm 120 with respect to the base 110, and the arc C2 is the rotation of the first arm 120 with respect to the base 110. It is a locus drawn by the upper end in FIG. 11 of the unique pattern image 22A with the movement. Further, FIG. 11 illustrates a case where three unique patterns UP belonging to different marks 21 are included in the imaging region RI shown in FIG. In addition to the unique pattern image 22A, the captured image G shown in FIG. 11 includes a unique pattern image 22B located on one side of the unique pattern image 22A in the circumferential direction DC. The unique pattern image 22X located on the other side is included.

ここで、撮像素子31が撮像することにより得られる撮像画像Gは、撮像領域RIに対応した形状であって、X軸方向に沿って延びている2つの辺とY軸方向に沿って延びている2つの辺とを有する矩形をなしている。また、撮像画像GのX軸方向に沿って延びている2つの辺は、円弧C1、C2にできるだけ沿うように配置されている。また、撮像画像Gは、X軸方向およびY軸方向に行列状に並んでいる複数の画素を有する。ここで、画素の位置は、X軸方向での画素の位置を示す「X」、および、Y軸方向での画素の位置を示す「Y」で表される画素座標系(X,Y)で表される。また、撮像画像Gの図中左上端の画素は、画像座標系(X,Y)の原点画素P0(0,0)に設定されている。 Here, the captured image G obtained by imaging by the image sensor 31 has a shape corresponding to the imaging region RI, and extends along the two sides extending in the X-axis direction and the Y-axis direction. It forms a rectangle with two sides. Further, the two sides extending along the X-axis direction of the captured image G are arranged so as to be along the arcs C1 and C2 as much as possible. Further, the captured image G has a plurality of pixels arranged in a matrix in the X-axis direction and the Y-axis direction. Here, the pixel positions are represented by a pixel coordinate system (X, Y) represented by "X" indicating the position of the pixel in the X-axis direction and "Y" indicating the position of the pixel in the Y-axis direction. expressed. Further, the pixel at the upper left end in the figure of the captured image G is set to the origin pixel P0 (0,0) of the image coordinate system (X, Y).

例えば、ユニークパターン画像22Aに対応するテンプレート画像TAを生成する場合、第1アーム120を基台110に対して適宜回動させ、ユニークパターン画像22Aを撮像画像G内の所定位置、例えば図11では、X軸方向での撮像画像Gの中央に設定された中心線LY上に位置させる。 For example, when generating the template image TA corresponding to the unique pattern image 22A, the first arm 120 is appropriately rotated with respect to the base 110, and the unique pattern image 22A is placed at a predetermined position in the captured image G, for example, FIG. , Positioned on the center line LY set in the center of the captured image G in the X-axis direction.

このような図11に示す撮像画像Gを、ユニークパターン画像22Aを包含する必要最小限の範囲となるような矩形の画素範囲でトリミングすることにより、ユニークパターンUPを検出するためのテンプレート画像TAを得る。得られたテンプレート画像TAは、記憶部6に記憶させる。このとき、テンプレート画像TAは、図11のテンプレート画像TAの左上端の画素の座標である基準座標(XA0,YA0)に関する座標情報とともに、これらに対応付けられて記憶される。これにより、テンプレート画像TA、角度情報および座標情報は、テンプレートマッチングに用いる1つのテンプレートセットとなる。 By trimming the captured image G shown in FIG. 11 in a rectangular pixel range that is the minimum necessary range including the unique pattern image 22A, a template image TA for detecting the unique pattern UP can be obtained. obtain. The obtained template image TA is stored in the storage unit 6. At this time, the template image TA is stored in association with the coordinate information related to the reference coordinates (XA0, YA0) which are the coordinates of the upper left pixel of the template image TA of FIG. As a result, the template image TA, the angle information, and the coordinate information become one template set used for template matching.

図12は、図11に示す撮像画像内に設定される探索領域でのテンプレートマッチングを説明するための図である。図13は、テンプレートマッチングの際に相関値が最大または最小となる状態から1画素分ずれた状態を示す図である。図14は、テンプレートマッチングの際に相関値が最大または最小となる状態を示す図である。図15は、テンプレートマッチングの際に相関値が最大または最小となる状態から図13に示す状態とは反対側に1画素分ずれた状態を示す図である。 FIG. 12 is a diagram for explaining template matching in the search region set in the captured image shown in FIG. FIG. 13 is a diagram showing a state in which the correlation value is deviated by one pixel from the state in which the correlation value is the maximum or the minimum at the time of template matching. FIG. 14 is a diagram showing a state in which the correlation value becomes the maximum or the minimum during template matching. FIG. 15 is a diagram showing a state in which the correlation value is deviated by one pixel from the state in which the correlation value is maximum or minimum during template matching to the side opposite to the state shown in FIG.

図12に示すように、撮像画像G内にユニークパターン画像22Aが存在しているとき、テンプレート画像TAを用いて撮像画像Gの画像に対してテンプレートマッチングを行う。本実施形態では、撮像画像G全域を探索領域RSとし、探索領域RSにテンプレート画像TAを重ね、探索領域RSに対してテンプレート画像TAを一画素ずつずらしながら、探索領域RSとテンプレート画像TAとの重なり部分の相関値を算出する。ここで、テンプレート画像TAは、その画素座標を開始座標PS(原点画素P0)から終了画素PEまで1画素ずつ移動し、探索領域RS全域の画素について、探索領域RSとテンプレート画像TAとの重なり部分の相関値がテンプレート画像TAの画素座標ごとに算出される。そして、算出された相関値は、テンプレート画像TAの画素座標に対応付けされて記憶部6に一時的に記憶される。 As shown in FIG. 12, when the unique pattern image 22A exists in the captured image G, template matching is performed on the image of the captured image G using the template image TA. In the present embodiment, the entire area of the captured image G is set as the search area RS, the template image TA is superimposed on the search area RS, and the template image TA is shifted by one pixel from the search area RS, and the search area RS and the template image TA are combined. Calculate the correlation value of the overlapping part. Here, the template image TA moves its pixel coordinates from the start coordinate PS (origin pixel P0) to the end pixel PE one by one, and for the pixels in the entire search area RS, the overlapping portion of the search area RS and the template image TA. Correlation value is calculated for each pixel coordinate of the template image TA. Then, the calculated correlation value is associated with the pixel coordinates of the template image TA and temporarily stored in the storage unit 6.

次に、記憶部6に記憶されている画素座標ごとの複数の相関値のうち、最大値となる相関値を選択し、その選択された相関値となるテンプレート画像TAの画素座標(XA1,YA1)をユニークパターン画像22Aの画素座標として決定する。このようにして、撮像画像G内でのユニークパターン画像22Aの位置を検出することができる。そして、この画素座標(XA1,YA1)が前述した「合致座標」となる。 Next, the maximum correlation value is selected from the plurality of correlation values stored in the storage unit 6 for each pixel coordinate, and the pixel coordinates (XA1, YA1) of the template image TA that becomes the selected correlation value. ) Is determined as the pixel coordinates of the unique pattern image 22A. In this way, the position of the unique pattern image 22A in the captured image G can be detected. Then, the pixel coordinates (XA1, YA1) become the above-mentioned "matching coordinates".

ここで、ユニークパターン画像22Aの画素座標を求める際、サブピクセル推定法を用いることが好ましい。相関値が最大となる近傍では、図13ないし図15に示すように、ユニークパターン画像22Aに対してテンプレート画像TAが重なる。図14に示す状態は、図13および図15に示す状態、つまり図14に示す状態から1画素ずれた状態よりも相関値が大きく、相関値が最も大きくなる。しかし、図14に示す状態のように、ユニークパターン画像22Aに対してテンプレート画像TAが完全に一致せずにずれて重なる場合、図14に示す状態をユニークパターン画像22Aの画素座標を前述した合致座標と判断すると、そのずれが誤差となる。このずれは、最大で1画素あたりの視野サイズBXとなる。すなわち、サブピクセル推定法を用いない場合、1画素あたりの視野サイズBXが最小の分解能(精度)となる。これに対し、サブピクセル推定法を用いると、1画素あたりの視野サイズBXごとの相関値を放物線や等角直線等でフィッティングし、これらの相関値間(画素ピッチ間)を補完(近似)することができる。そのため、より高精度にユニークパターン画像22Aの画素座標を求めることができる。なお、前述した説明では、相関値が最大となる画素座標がユニークパターン画像22Aの画素位置となる場合を例に説明したが、相関値が最小となる画素座標がユニークパターン画像22Aの画素位置となるようにテンプレートマッチングを行うことも可能である。 Here, when obtaining the pixel coordinates of the unique pattern image 22A, it is preferable to use the sub-pixel estimation method. In the vicinity where the correlation value is maximum, the template image TA overlaps with the unique pattern image 22A, as shown in FIGS. 13 to 15. The state shown in FIG. 14 has a larger correlation value and the largest correlation value than the state shown in FIGS. 13 and 15, that is, the state deviated by one pixel from the state shown in FIG. However, as in the state shown in FIG. 14, when the template image TA does not completely match the unique pattern image 22A and overlaps with each other, the state shown in FIG. 14 is the same as the pixel coordinates of the unique pattern image 22A described above. If it is judged as the coordinates, the deviation becomes an error. This deviation is the field of view size BX per pixel at the maximum. That is, when the sub-pixel estimation method is not used, the field of view size BX per pixel is the minimum resolution (accuracy). On the other hand, when the sub-pixel estimation method is used, the correlation values for each field size BX per pixel are fitted by a parabola, an equiangular straight line, or the like, and the correlation values (between pixel pitches) are complemented (approximate). be able to. Therefore, the pixel coordinates of the unique pattern image 22A can be obtained with higher accuracy. In the above description, the case where the pixel coordinate having the maximum correlation value is the pixel position of the unique pattern image 22A has been described as an example, but the pixel coordinate having the minimum correlation value is the pixel position of the unique pattern image 22A. It is also possible to perform template matching so that

次のステップS108では、校正角θ[i2−1](第1位置)と、校正角θ[i2](第2位置)と、基準座標[i2−1](第1基準座標)と、合致座標[i2−1](第1合致座標)と、の間に成り立つ相関関係を求める。ここでは、変数i2として1を設定しているため、校正角θ[0]と、校正角θ[1]と、基準座標[0]と、合致座標[0]と、の間に成り立つ相関関係を求める。この相関関係は、スケール部2の回動角度と撮像画像G内の距離との相関関係を示すものであり、どのような形態で表されたものであってもよいが、後述するステップS2において、テンプレートマッチングによる合致座標[i2−1]および基準座標[i2−1]から回動角度θを逆算することができる形態とされる。 In the next step S108, the calibration angle θ [i2-1] (first position), the calibration angle θ [i2] (second position), and the reference coordinates [i2-1] (first reference coordinates) are matched. The correlation established between the coordinates [i2-1] (first matching coordinates) and the coordinates [i2-1] is obtained. Here, since 1 is set as the variable i2, the correlation established between the calibration angle θ [0], the calibration angle θ [1], the reference coordinate [0], and the matching coordinate [0]. Ask for. This correlation shows the correlation between the rotation angle of the scale unit 2 and the distance in the captured image G, and may be expressed in any form, but in step S2 described later. , The rotation angle θ can be calculated back from the matching coordinates [i2-1] and the reference coordinates [i2-1] by template matching.

相関関係の具体的な形態としては、例えば、基準座標[i2−1](第1基準座標)から合致座標[i2−1](第1合致座標)までの移動量、に対する、校正角θ[i2−1](第1位置)から校正角θ[i2](第2位置)までの変化量、の比として求められる係数[i2−1]が挙げられる。相関関係の形態としては、例えば合致座標および基準座標から回動角度θを逆算して求める一覧表(計算テーブル)という形態も考えられるが、この場合、回動角度θの算出に時間を要する場合もある。これに対し、このような係数[i2−1]を算出し、記憶部6に記憶させておくことにより、後述するステップS2において回動角度θを逆算する際、計算の高速化を図ることができる。
この係数[i2−1]は、式化すると、以下のようになる。
As a specific form of the correlation, for example, the calibration angle θ [with respect to the amount of movement from the reference coordinate [i2-1] (first reference coordinate) to the matching coordinate [i2-1] (first matching coordinate). The coefficient [i2-1] obtained as the ratio of the amount of change from the i2-1] (first position) to the calibration angle θ [i2] (second position) can be mentioned. As a form of correlation, for example, a list (calculation table) obtained by back-calculating the rotation angle θ from the matching coordinates and the reference coordinates can be considered, but in this case, when it takes time to calculate the rotation angle θ. There is also. On the other hand, by calculating such a coefficient [i2-1] and storing it in the storage unit 6, when the rotation angle θ is back-calculated in step S2 described later, the calculation speed can be increased. it can.
This coefficient [i2-1] is as follows when formulated.

Figure 2021089224
Figure 2021089224

ステップS108の終了後、2回目のステップS109に移行する。
2回目のステップS109でも、前述したように、変数i2がn以下であるか否かを判断する。ここでは、変数i2が1であるため、ステップS110に移行する。
After the end of step S108, the process proceeds to the second step S109.
Also in the second step S109, as described above, it is determined whether or not the variable i2 is n or less. Here, since the variable i2 is 1, the process proceeds to step S110.

2回目のステップS110では、記憶部6から撮像画像[i2](第2基準画像)を読み出し、ユニークパターンUPが欠けることなく含まれるように、撮像画像[i2]の切り出し位置を決定する。ここでは、変数i2として1を設定しているため、撮像画像[1]の切り出し位置を決定する。 In the second step S110, the captured image [i2] (second reference image) is read from the storage unit 6, and the cutout position of the captured image [i2] is determined so that the unique pattern UP is included without being chipped. Here, since 1 is set as the variable i2, the cutout position of the captured image [1] is determined.

2回目のステップS111では、撮像画像[i2]における切り出し位置の左上端の座標を基準座標[i2](第2基準座標)とする。ここでは、変数i2として1を設定しているため、撮像画像[i2]における切り出し位置の左上端の座標を基準座標[1]とする。 In the second step S111, the coordinates of the upper left end of the cutout position in the captured image [i2] are set as the reference coordinates [i2] (second reference coordinates). Here, since 1 is set as the variable i2, the coordinates of the upper left end of the cutout position in the captured image [i2] are set as the reference coordinates [1].

2回目のステップS112では、撮像画像[i2]の基準座標[i2]に基づいて、ユニークパターンUPの画像を切り出す。これにより、テンプレート画像[i2](第2テンプレート画像)を取得する。ここでは、変数i2として1を設定しているため、テンプレート画像[1]を取得する。取得したテンプレート画像[1]および基準座標[1]は、記憶部6に記憶させる。 In the second step S112, an image of the unique pattern UP is cut out based on the reference coordinates [i2] of the captured image [i2]. As a result, the template image [i2] (second template image) is acquired. Here, since 1 is set as the variable i2, the template image [1] is acquired. The acquired template image [1] and reference coordinates [1] are stored in the storage unit 6.

図9には、スケール部2が校正角θ[1]にあるときに撮像された撮像画像[1]の例が示されている。そして、撮像画像[1]から、切り出し位置の左上端の座標を求め、これを基準座標[1]として求める。また、切り出し位置に含まれるユニークパターンUPの画像を図10に示すようなテンプレート画像[1]として切り出す。 FIG. 9 shows an example of the captured image [1] captured when the scale unit 2 is at the calibration angle θ [1]. Then, the coordinates of the upper left end of the cutout position are obtained from the captured image [1], and this is obtained as the reference coordinate [1]. Further, the image of the unique pattern UP included in the cutout position is cut out as a template image [1] as shown in FIG.

次に、2回目のステップS113でも、エンコーダー1の回動軸を所定の角度進める。
次に、2回目のステップS114では、変数i2としてi2+1を設定する(変数i2を更新する)。ここでは、更新前の変数i2と更新後の変数i2とを区別するため、更新後の変数i2を「i3」と表記する。なお、各フローチャートでは、図示の便宜上、更新前および更新後を区別することなく変数iを使用している。
Next, also in the second step S113, the rotation axis of the encoder 1 is advanced by a predetermined angle.
Next, in the second step S114, i2 + 1 is set as the variable i2 (the variable i2 is updated). Here, in order to distinguish between the variable i2 before the update and the variable i2 after the update, the variable i2 after the update is referred to as "i3". In each flowchart, the variable i is used without distinguishing between before and after the update for convenience of illustration.

本ステップS114の直前では、変数i2として1を設定していたので、本ステップS114では変数i3として2が設定されることになる。ステップS114が終了すると、ステップフローは、ステップS104に戻る。 Immediately before this step S114, 1 was set as the variable i2, so that 2 is set as the variable i3 in this step S114. When step S114 is completed, the step flow returns to step S104.

3回目のステップS104でも、記憶部6に校正角θ[i3](第3位置)を記憶させる。ここでは、変数i3として2を設定しているため、校正角θ[2]を記憶させる。 Also in the third step S104, the storage unit 6 stores the calibration angle θ [i3] (third position). Here, since 2 is set as the variable i3, the calibration angle θ [2] is stored.

3回目のステップS105でも、撮像素子31にマーク21を撮像させる。これにより、撮像画像[i3](第3基準画像)を生成する。ここでは、変数i3として2を設定しているため、撮像画像[2]を生成する。撮像画像[2]には、校正角θ[2]に対応するマーク21に含まれたユニークパターンUPが捉えられている。生成した撮像画像[2]は、記憶部6に一時的に記憶させる。 Also in the third step S105, the image sensor 31 is made to image the mark 21. As a result, the captured image [i3] (third reference image) is generated. Here, since 2 is set as the variable i3, the captured image [2] is generated. In the captured image [2], the unique pattern UP included in the mark 21 corresponding to the calibration angle θ [2] is captured. The generated captured image [2] is temporarily stored in the storage unit 6.

3回目のステップS106でも、変数i3が0より大きいか否かを判断する。変数i3が0より大きい場合、ステップS107、S108に移行する。この説明の例では、この時点で変数i3が2であるため、以下、ステップS107、S108について説明する。 Also in the third step S106, it is determined whether or not the variable i3 is larger than 0. If the variable i3 is larger than 0, the process proceeds to steps S107 and S108. In the example of this explanation, since the variable i3 is 2 at this point, steps S107 and S108 will be described below.

2回目のステップS107では、記憶部6からテンプレート画像[i3−1](第2テンプレート画像)を読み出し、生成した撮像画像[i3](第3基準画像)に対してテンプレートマッチングを行う。そうすると、撮像画像[i3]において、テンプレート画像[i3−1]と合致するユニークパターンUPが捉えられるので、捉えたユニークパターンUPの左上端の座標を、合致座標[i3−1](第2合致座標)とする。ここでは、変数i3として2を設定しているため、テンプレート画像[1]を読み出し、生成した撮像画像[2]に対してテンプレートマッチングを行う。そうすると、合致座標[1]が求められる。求めた合致座標[1]は、記憶部6に一時的に記憶させる。 In the second step S107, the template image [i3-1] (second template image) is read out from the storage unit 6, and template matching is performed with the generated captured image [i3] (third reference image). Then, in the captured image [i3], the unique pattern UP that matches the template image [i3-1] is captured. Therefore, the coordinates of the upper left end of the captured unique pattern UP are set to the matching coordinates [i3-1] (second match). Coordinates). Here, since 2 is set as the variable i3, the template image [1] is read out, and template matching is performed on the generated captured image [2]. Then, the matching coordinates [1] are obtained. The obtained matching coordinates [1] are temporarily stored in the storage unit 6.

2回目のステップS108では、校正角θ[i3−1](第2位置)と、校正角θ[i3](第3位置)と、基準座標[i3−1](第2基準座標)と、合致座標[i3−1](第2合致座標)と、の間に成り立つ相関関係を求める。 In the second step S108, the calibration angle θ [i3-1] (second position), the calibration angle θ [i3] (third position), the reference coordinates [i3-1] (second reference coordinates), and the like. The correlation established between the matching coordinates [i3-1] (second matching coordinates) and the matching coordinates is obtained.

相関関係の具体的な形態としては、例えば、基準座標[i3−1](第2基準座標)から合致座標[i3−1](第2合致座標)までの移動量、に対する、校正角θ[i3−1](第2位置)から校正角θ[i3](第3位置)までの変化量、の比として求められる係数[i3−1]が挙げられる。
この係数[i3−1]は、式化すると、以下のようになる。
As a specific form of the correlation, for example, the calibration angle θ [with respect to the movement amount from the reference coordinate [i3-1] (second reference coordinate) to the match coordinate [i3-1] (second match coordinate). The coefficient [i3-1] obtained as the ratio of the amount of change from the i3-1] (second position) to the calibration angle θ [i3] (third position) can be mentioned.
This coefficient [i3-1] is as follows when formulated.

Figure 2021089224
Figure 2021089224

2回目のステップS108の終了後、3回目のステップS109に移行する。
3回目のステップS109でも、前述したように、変数i3がn以下であるか否かを判断する。ここでは、変数i3が2であるため、ステップS110に移行する。そして、これ以降は、上述したステップS110〜S114と同様にしてステップフローを進めた後、ステップS104に戻る。なお、ステップS114では、変数i3としてi3+1を設定する(変数i3を更新する)。更新後の変数i3を「i4」と表記する。
After the completion of the second step S108, the process proceeds to the third step S109.
Also in the third step S109, as described above, it is determined whether or not the variable i3 is n or less. Here, since the variable i3 is 2, the process proceeds to step S110. After that, the step flow is advanced in the same manner as in steps S110 to S114 described above, and then the process returns to step S104. In step S114, i3 + 1 is set as the variable i3 (the variable i3 is updated). The updated variable i3 is referred to as "i4".

以降、同様にして、4回目のステップS104〜S106、および、3回目のステップS107、S108を行い、係数[i4−1]を求めることができる。 Subsequently, in the same manner, the fourth steps S104 to S106 and the third steps S107 and S108 can be performed to obtain the coefficient [i4-1].

さらにその後、同様にして、係数[i5−1]、係数[i6−1]、・・・、係数[i(n+1)−1]を求めることができる。これにより、全てのマーク21について、係数による相関関係を求め、記憶部6に記憶することができる。そして、これらの相関関係を用いることにより、後述するステップS2において、エンコーダー1の回動軸の回動角度によらず、精度の高い回動角度を求めることができる。 After that, the coefficient [i5-1], the coefficient [i6-1], ..., The coefficient [i (n + 1) -1] can be obtained in the same manner. As a result, for all the marks 21, the correlation by the coefficient can be obtained and stored in the storage unit 6. Then, by using these correlations, it is possible to obtain a highly accurate rotation angle in step S2, which will be described later, regardless of the rotation angle of the rotation shaft of the encoder 1.

その後、再び、ステップS109に移行する。ステップS109では、前述したように、変数i(n+2)がn以下であるか否かを判断する。全てのマーク21(全ての校正角θ[i])について相関関係を求めた後では、変数i(n+2)としてn+1が設定されているため、図8に示すステップフローを終了する。このとき、校正用エンコーダーは不要となるため、ステップS109の判断後、校正用エンコーダーを取り外す(ステップS120)。 After that, the process proceeds to step S109 again. In step S109, as described above, it is determined whether or not the variable i (n + 2) is n or less. After obtaining the correlation for all the marks 21 (all calibration angles θ [i]), since n + 1 is set as the variable i (n + 2), the step flow shown in FIG. 8 ends. At this time, since the calibration encoder is unnecessary, the calibration encoder is removed after the determination in step S109 (step S120).

以上のようにして、後述するステップS2で回動角度を検出するために必要な校正角、テンプレート画像、基準座標および係数で構成されるデータセットを得ることができる。 As described above, it is possible to obtain a data set composed of the calibration angle, the template image, the reference coordinates, and the coefficients necessary for detecting the rotation angle in step S2 described later.

2.2.2.回動角度の検出
図7に示すステップS2では、ステップS1で取得したデータセットを用いて、エンコーダー1の回動軸の回動角度を検出する。
2.2.2. Detection of Rotation Angle In step S2 shown in FIG. 7, the rotation angle of the rotation shaft of the encoder 1 is detected using the data set acquired in step S1.

ステップS2は、図7に示すように、ステップS201〜S203を含んでいる。以下、各ステップについて説明する。 Step S2 includes steps S201 to S203, as shown in FIG. Hereinafter, each step will be described.

このステップS2では、まず、ステップS201として、エンコーダー1の回動軸が未知の回動角度θ(計測位置)にあるとき、撮像素子31にマーク21を撮像させる。これにより、測角画像(測位画像)を生成する。生成した測角画像は、記憶部6に記憶させる。
なお、回動角度θは、校正角θ[i]と校正角θ[i2]との間にあるものとする。
In step S2, first, in step S201, when the rotation axis of the encoder 1 is at an unknown rotation angle θ (measurement position), the image sensor 31 is made to image the mark 21. As a result, an angle measurement image (positioning image) is generated. The generated angle measurement image is stored in the storage unit 6.
The rotation angle θ is assumed to be between the calibration angle θ [i] and the calibration angle θ [i2].

次のステップS202では、記憶部6から測角画像およびステップS1で取得したテンプレート画像[i]を読み出し、測角画像に対してテンプレートマッチングを行う。なお、テンプレートマッチングの際には、必要に応じて、サブピクセル推定を行う。テンプレートマッチングを行うことにより、測角画像において、テンプレート画像[i]と合致するユニークパターンUPが捉えられるので、捉えたユニークパターンUPの左上端の座標を、測角合致座標とする。求めた測角合致座標は、記憶部6に記憶させる。 In the next step S202, the angle measurement image and the template image [i] acquired in step S1 are read out from the storage unit 6, and template matching is performed on the angle measurement image. At the time of template matching, sub-pixel estimation is performed as necessary. By performing template matching, the unique pattern UP that matches the template image [i] is captured in the angled image, so the coordinates of the upper left end of the captured unique pattern UP are set as the angled matching coordinates. The obtained angle measurement matching coordinates are stored in the storage unit 6.

次のステップS203では、記憶部6から測角合致座標を読み出す。また、ステップS1で取得した基準座標[i]および係数[i]を読み出す。そして、以下の式により、回動角度θを算出する。
回動角度θ=校正角θ[i]+(測角合致座標−基準座標[i])×係数[i]
In the next step S203, the angle measurement matching coordinates are read from the storage unit 6. Further, the reference coordinates [i] and the coefficients [i] acquired in step S1 are read out. Then, the rotation angle θ is calculated by the following formula.
Rotation angle θ = Calibration angle θ [i] + (angle measurement matching coordinates-reference coordinates [i]) × coefficient [i]

以上のようにして、回動角度θを算出することができる。算出した回動角度θは、回路部4から出力され、例えばロボット100の制御装置においてアームの駆動制御に用いられる。なお、本実施形態では、S2において生成した測角画像を記憶部6に記憶させた後、テンプレートマッチングを用いて測角合致座標を取得する例を示したが、処理部5に複数の処理装置を設け、撮像素子31から処理部5に測角画素が転送される度に処理部5がテンプレートマッチング処理を行い、測角画像の生成と測角合致座標の取得を並列処理させることが好ましい。 As described above, the rotation angle θ can be calculated. The calculated rotation angle θ is output from the circuit unit 4, and is used, for example, in the control device of the robot 100 for driving control of the arm. In the present embodiment, an example is shown in which the angle measurement image generated in S2 is stored in the storage unit 6 and then the angle measurement matching coordinates are acquired by using template matching, but the processing unit 5 has a plurality of processing devices. It is preferable that the processing unit 5 performs template matching processing every time the angle measuring pixel is transferred from the image sensor 31 to the processing unit 5, and causes the generation of the angled image and the acquisition of the angled matching coordinates to be processed in parallel.

以上のように、本実施形態に係る位置検出方法は、スケール部2と撮像素子31とを有するエンコーダー1を用いて、スケール部2の位置、例えばスケール部2の回動角度を検出する方法である。このうち、スケール部2は、複数のマーク21を有する。また、撮像素子31は、マーク21を撮像する素子である。そして、エンコーダー1は、撮像素子31に対してスケール部2が相対的に移動するように構成されている。 As described above, the position detection method according to the present embodiment is a method of detecting the position of the scale unit 2, for example, the rotation angle of the scale unit 2 by using the encoder 1 having the scale unit 2 and the image sensor 31. is there. Of these, the scale unit 2 has a plurality of marks 21. The image sensor 31 is an element that captures the mark 21. The encoder 1 is configured such that the scale unit 2 moves relative to the image sensor 31.

このような位置検出方法は、前述したステップS101〜S114を含むステップS1と、前述したステップS201〜S203を含むステップS2と、を有する。 Such a position detection method includes a step S1 including the above-mentioned steps S101 to S114 and a step S2 including the above-mentioned steps S201 to S203.

このうち、ステップS104、S105、S110〜S112は、スケール部2が校正角θ[i](第1位置)にあるとき、撮像素子31にマーク21を撮像させて撮像画像[i](第1基準画像)を生成して、テンプレート画像[i](第1テンプレート画像)、および、撮像画像[i]におけるマーク21の基準座標[i](第1基準座標)を取得するステップである。 Of these, in steps S104, S105, and S110 to S112, when the scale unit 2 is at the calibration angle θ [i] (first position), the image sensor 31 is made to image the mark 21 and the captured image [i] (first position). This is a step of generating a reference image) and acquiring the template image [i] (first template image) and the reference coordinates [i] (first reference coordinates) of the mark 21 in the captured image [i].

ステップS104、S105、S107は、スケール部2が校正角θ[i2](第2位置)にあるとき、撮像素子31にマーク21を撮像させて撮像画像[i2](第2基準画像)を生成し、テンプレート画像[i2−1](第1テンプレート画像)に基づくテンプレートマッチングにより、撮像画像[i2]においてテンプレート画像[i2−1]と合致するマーク21の合致座標[i2−1](第1合致座標)を取得するステップである。 In steps S104, S105, and S107, when the scale unit 2 is at the calibration angle θ [i2] (second position), the image sensor 31 is made to image the mark 21 to generate an image [i2] (second reference image). Then, by template matching based on the template image [i2-1] (first template image), the matching coordinates [i2-1] (first) of the mark 21 that matches the template image [i2-1] in the captured image [i2]. It is a step to acquire the matching coordinates).

ステップS108は、スケール部2の回動角度と撮像画像G内の距離との相関関係として、校正角θ[i2−1](第1位置)と、校正角θ[i2](第2位置)と、基準座標[i2−1](第1基準座標)と、合致座標[i2−1](第1合致座標)と、の間に成り立つ相関関係、例えば係数[i2−1]を求めるステップである。 In step S108, the calibration angle θ [i2-1] (first position) and the calibration angle θ [i2] (second position) are correlated with the rotation angle of the scale unit 2 and the distance in the captured image G. In the step of finding the correlation that holds between the reference coordinate [i2-1] (first reference coordinate) and the matching coordinate [i2-1] (first matching coordinate), for example, the coefficient [i2-1]. is there.

ステップS201、S202は、エンコーダー1の回動角が回動角度θ(計測位置)にあるとき、撮像素子31にマーク21を撮像させて測角画像(測位画像)を生成する。そして、テンプレート画像[i2−1](第1テンプレート画像)に基づくテンプレートマッチングにより、測角画像におけるマーク21の測角合致座標(測位合致座標)を取得するステップである。 In steps S201 and S202, when the rotation angle of the encoder 1 is at the rotation angle θ (measurement position), the image sensor 31 is made to image the mark 21 to generate an angle measurement image (positioning image). Then, it is a step of acquiring the angle measurement matching coordinates (positioning matching coordinates) of the mark 21 in the angle measurement image by template matching based on the template image [i2-1] (first template image).

そして、ステップS203は、校正角θ[i2−1](第1位置)、基準座標[i2−1](第1基準座標)、測角合致座標、および相関関係(係数[i2−1])に基づいて、回動角度θ(計測位置)を求めるステップである。 Then, in step S203, the calibration angle θ [i2-1] (first position), the reference coordinates [i2-1] (first reference coordinates), the angle measurement matching coordinates, and the correlation (coefficient [i2-1]). This is a step of obtaining the rotation angle θ (measurement position) based on.

このような位置検出方法では、あらかじめ取得したテンプレート画像を用い、計測時にはテンプレートマッチングを用いて回動角度θを算出するため、スケール部2の形成時におけるマーク21の位置ずれが、回動角度θの精度に影響を及ぼしにくい。このため、検出精度を容易に高めることができ、かつ、製造容易性が高く低コストのエンコーダーユニット10が得られる。 In such a position detection method, since the rotation angle θ is calculated by using the template image acquired in advance and template matching at the time of measurement, the positional deviation of the mark 21 at the time of forming the scale portion 2 is the rotation angle θ. It does not easily affect the accuracy of. Therefore, the encoder unit 10 which can easily improve the detection accuracy, is easy to manufacture, and is low in cost can be obtained.

また、従来の撮像式ロータリーエンコーダーでは、回動角度θを検出するために、撮像素子(カメラ)の撮像倍率や回動するスケール部の回動軸とマークとの距離といったパラメーターを事前に計測しておく必要がある。これらのパラメーターの計測値が実際の値とずれている場合、検出する回動角度θの誤差が大きくなる。しかしながら、これらのパラメーターを厳密に実測するのは難しく、また、製造ばらつきによる個体差も無視できない。 Further, in the conventional image pickup type rotary encoder, in order to detect the rotation angle θ, parameters such as the image pickup magnification of the image sensor (camera) and the distance between the rotation axis of the rotating scale portion and the mark are measured in advance. It is necessary to keep it. If the measured values of these parameters deviate from the actual values, the error of the detected rotation angle θ becomes large. However, it is difficult to measure these parameters exactly, and individual differences due to manufacturing variations cannot be ignored.

これに対し、本実施形態では、回動角度と撮像画像内の距離との相関関係およびテンプレートマッチングを用いることによって、これらのパラメーターが反映された画像に基づいて回動角度θを算出するため、これらのパラメーターを事前に実測しておかなくても、回動角度θを高精度に検出することができる。また、テンプレート画像を取得し、前述した相関関係を導く校正作業も、テンプレートマッチングを用いて行うため、比較的短時間で行うことができる。したがって、本実施形態によれば、製造が容易で低コスト化が可能なエンコーダーユニット10を用いても、回動角度θを高精度に検出可能な位置検出方法を実現することができる。 On the other hand, in the present embodiment, the rotation angle θ is calculated based on the image in which these parameters are reflected by using the correlation between the rotation angle and the distance in the captured image and template matching. The rotation angle θ can be detected with high accuracy without actually measuring these parameters in advance. Further, since the proofreading work of acquiring the template image and deriving the above-mentioned correlation is also performed by using template matching, it can be performed in a relatively short time. Therefore, according to the present embodiment, it is possible to realize a position detection method capable of detecting the rotation angle θ with high accuracy even by using the encoder unit 10 which is easy to manufacture and can reduce the cost.

なお、前述したように、本発明に係るエンコーダーはリニアエンコーダーにも適用可能であるが、本実施形態に係るエンコーダー1はロータリーエンコーダーである。これにより、回動角度θを高精度に検出可能なエンコーダーユニット10を実現することができる。 As described above, the encoder according to the present invention can also be applied to a linear encoder, but the encoder 1 according to the present embodiment is a rotary encoder. As a result, the encoder unit 10 capable of detecting the rotation angle θ with high accuracy can be realized.

また、本実施形態に係るエンコーダーユニット10は、エンコーダー1と処理部5と記憶部6とを有する。このうち、エンコーダー1は、スケール部2と撮像素子31とを有しており、撮像素子31に対してスケール部2が相対的に回動する(移動する)ように構成されている。スケール部2は、複数のマーク21を有する。撮像素子31は、マーク21を撮像する素子である。処理部5は、撮像素子31の撮像結果に基づいて、スケール部2の位置、例えばスケール部2の回動角度を求める処理を実行する。記憶部6は、処理部5で読み取り可能な指示を記憶する。 Further, the encoder unit 10 according to the present embodiment includes an encoder 1, a processing unit 5, and a storage unit 6. Of these, the encoder 1 has a scale unit 2 and an image sensor 31, and the scale unit 2 is configured to rotate (move) relative to the image sensor 31. The scale unit 2 has a plurality of marks 21. The image sensor 31 is an element that captures the mark 21. The processing unit 5 executes a process of obtaining the position of the scale unit 2, for example, the rotation angle of the scale unit 2 based on the image pickup result of the image sensor 31. The storage unit 6 stores an instruction that can be read by the processing unit 5.

このようなエンコーダーユニット10では、スケール部2が校正角θ[i](第1位置)にあるとき、撮像素子31にマーク21を撮像させて撮像画像[i](第1基準画像)を生成し、テンプレート画像[i](第1テンプレート画像)、および、撮像画像[i]におけるマーク21の基準座標[i](第1基準座標)を取得する。 In such an encoder unit 10, when the scale unit 2 is at the calibration angle θ [i] (first position), the image sensor 31 is made to image the mark 21 to generate an captured image [i] (first reference image). Then, the template image [i] (first template image) and the reference coordinates [i] (first reference coordinates) of the mark 21 in the captured image [i] are acquired.

また、エンコーダーユニット10は、スケール部2が校正角θ[i2](第2位置)にあるとき、撮像素子31にマーク21を撮像させて撮像画像[i2](第2基準画像)を生成し、テンプレート画像[i2−1](第1テンプレート画像)に基づくテンプレートマッチングにより、撮像画像[i2]においてテンプレート画像[i2−1]と合致するマーク21の合致座標[i2−1](第1合致座標)を取得する。 Further, when the scale unit 2 is at the calibration angle θ [i2] (second position), the encoder unit 10 causes the image pickup element 31 to image the mark 21 to generate an image pickup image [i2] (second reference image). , Matching coordinates [i2-1] (first matching) of the mark 21 that matches the template image [i2-1] in the captured image [i2] by template matching based on the template image [i2-1] (first template image). Coordinates).

さらに、エンコーダーユニット10は、スケール部2の回動角度と撮像画像G内の距離との相関関係として、校正角θ[i2−1](第1位置)と、校正角θ[i2](第2位置)と、基準座標[i2−1](第1基準座標)と、合致座標[i2−1](第1合致座標)と、の間に成り立つ相関関係、例えば係数[i2−1]を求める。 Further, the encoder unit 10 has a calibration angle θ [i2-1] (first position) and a calibration angle θ [i2] (first position) as a correlation between the rotation angle of the scale unit 2 and the distance in the captured image G. 2 positions), the reference coordinates [i2-1] (first reference coordinates), and the matching coordinates [i2-1] (first matching coordinates), for example, the coefficient [i2-1]. Ask.

また、エンコーダーユニット10は、エンコーダー1の回動角が回動角度θ(計測位置)にあるとき、撮像素子31にマーク21を撮像させて測角画像(測位画像)を生成する。そして、テンプレート画像[i2−1](第1テンプレート画像)に基づくテンプレートマッチングにより、測角画像におけるマーク21の測角合致座標(測位合致座標)を取得する。 Further, when the rotation angle of the encoder 1 is at the rotation angle θ (measurement position), the encoder unit 10 causes the image pickup element 31 to image the mark 21 to generate an angle measurement image (positioning image). Then, by template matching based on the template image [i2-1] (first template image), the angle measurement matching coordinates (positioning matching coordinates) of the mark 21 in the angle measurement image are acquired.

さらに、エンコーダーユニット10は、校正角θ[i2−1](第1位置)、基準座標[i2−1](第1基準座標)、合致座標[i2−1](第1合致座標)、および相関関係(係数[i2−1])に基づいて、回動角度θ(計測位置)を求める。 Further, the encoder unit 10 has a calibration angle θ [i2-1] (first position), reference coordinates [i2-1] (first reference coordinates), matching coordinates [i2-1] (first matching coordinates), and The rotation angle θ (measurement position) is obtained based on the correlation (coefficient [i2-1]).

このようなエンコーダーユニット10では、あらかじめ取得したテンプレート画像を用い、計測時にはテンプレートマッチングを用いて回動角度θを算出するため、スケール部2の形成時におけるマーク21の位置ずれが、回動角度θの精度に影響を及ぼしにくい。このため、検出精度を容易に高めることができ、かつ、製造容易性が高く低コストのエンコーダーユニット10が得られる。 In such an encoder unit 10, since the rotation angle θ is calculated by using the template image acquired in advance and template matching at the time of measurement, the positional deviation of the mark 21 at the time of forming the scale portion 2 is the rotation angle θ. It does not easily affect the accuracy of. Therefore, the encoder unit 10 which can easily improve the detection accuracy, is easy to manufacture, and is low in cost can be obtained.

また、本実施形態に係るロボット100は、第1部材である基台110と、基台110に対して移動する第2部材である第1アーム120と、エンコーダーユニット10と、を備えている。そして、スケール部2が第1アーム120に設けられ、撮像素子31が基台110に設けられている。 Further, the robot 100 according to the present embodiment includes a base 110 which is a first member, a first arm 120 which is a second member which moves with respect to the base 110, and an encoder unit 10. The scale unit 2 is provided on the first arm 120, and the image sensor 31 is provided on the base 110.

このようなロボット100によれば、エンコーダーユニット10において検出される第1アーム120の回動角度の精度が高いため、第1アーム120を高精度に制御することができる。これにより、より正確で繊細な作業を行い得る信頼性の高いロボット100を実現することができる。 According to such a robot 100, since the accuracy of the rotation angle of the first arm 120 detected by the encoder unit 10 is high, the first arm 120 can be controlled with high accuracy. As a result, it is possible to realize a highly reliable robot 100 capable of performing more accurate and delicate work.

3.第2実施形態
次に、第2実施形態に係る位置検出方法について説明する。
3. 3. Second Embodiment Next, the position detection method according to the second embodiment will be described.

図16は、第2実施形態に係る位置検出方法のうち、ステップS1を詳細に示すフローチャートである。図17は、図16に示す位置検出方法で取得される、校正角、テンプレート画像、基準座標、および、係数を示す一覧表である。 FIG. 16 is a flowchart showing step S1 in detail in the position detection method according to the second embodiment. FIG. 17 is a list showing calibration angles, template images, reference coordinates, and coefficients acquired by the position detection method shown in FIG.

以下、第2実施形態について説明するが、以下の説明では、第1実施形態との相違点を中心に説明し、同様の事項についてはその説明を省略する。また、図16および図17において、前記第1実施形態と同様の構成については、同一の符号を付している。 Hereinafter, the second embodiment will be described, but in the following description, the differences from the first embodiment will be mainly described, and the same matters will be omitted. Further, in FIGS. 16 and 17, the same reference numerals are given to the same configurations as those in the first embodiment.

第2実施形態は、係数が異なる以外、第1実施形態と同様である。具体的には、前述した第1実施形態では、校正角ごとに係数を算出し、回動角度θの算出に用いている。これに対し、第2実施形態では、複数の校正角で平均の係数を算出し、校正角によらず、回動角度θの算出に用いている。 The second embodiment is the same as the first embodiment except that the coefficients are different. Specifically, in the first embodiment described above, a coefficient is calculated for each calibration angle and used for calculating the rotation angle θ. On the other hand, in the second embodiment, the average coefficient is calculated at a plurality of calibration angles and used for calculating the rotation angle θ regardless of the calibration angle.

3.1.テンプレート画像等の取得
図16に示す位置検出方法は、図8に示すステップS108に代えて、ステップS108Aを有している。
3.1. Acquisition of template image and the like The position detection method shown in FIG. 16 includes step S108A instead of step S108 shown in FIG.

ステップS108Aでは、第1実施形態に係るステップS108と同様、まず、全てのマーク21、つまり、校正角θ[i]のi=0からi=nまでの全てについて、それぞれ、
移動量[i]=合致座標[i]−基準座標[i]
で定義される移動量[i]を算出する。
そして、次の式により、これらの移動量[i]を合算して、累積移動量を求める。
In step S108A, as in step S108 according to the first embodiment, first, all the marks 21, that is, all of the calibration angles θ [i] from i = 0 to i = n, are respectively.
Movement amount [i] = Match coordinates [i] -Reference coordinates [i]
Calculate the movement amount [i] defined in.
Then, these movement amounts [i] are added up by the following equation to obtain the cumulative movement amount.

Figure 2021089224
Figure 2021089224

上式において、mは、m≦nの任意の整数である。
続いて、次の式で定義される平均係数を求める。
In the above equation, m is an arbitrary integer of m ≦ n.
Then, the average coefficient defined by the following equation is obtained.

Figure 2021089224
Figure 2021089224

このようにして求めた平均係数は、第1実施形態において校正角θ[i]ごとに設定されていた係数を、図17に示すように、全ての校正角θ[i]に共通して置き換えることができる。これにより、校正角θ[i]ごとに個別の係数を算出し、記憶部6に記憶させておく必要がなく、1つの平均係数のみを記憶させておけばよいことになる。その結果、計算の省力化と、記憶部6の使用量の削減と、を図ることができる。 The average coefficient thus obtained replaces the coefficient set for each calibration angle θ [i] in the first embodiment in common with all calibration angles θ [i] as shown in FIG. be able to. As a result, it is not necessary to calculate individual coefficients for each calibration angle θ [i] and store them in the storage unit 6, and only one average coefficient needs to be stored. As a result, it is possible to save labor in calculation and reduce the amount of use of the storage unit 6.

なお、前述した平均係数は、全ての校正角θ[i]について移動量[i]を合算した累積移動量を用いて算出されているが、全てには限定されず、一部のみについて累積移動量を求めるようにしてもよい。つまり、前述した平均係数を算出する際の整数mは、n未満であってもよい。また、前述した累積移動量は、全ての移動量[i]を求めてから算出されてもよいが、以下のように、随時、移動量[i]を積算することによって累積移動量を更新する方法で算出されてもよい。 The above-mentioned average coefficient is calculated using the cumulative movement amount obtained by adding the movement amounts [i] for all the calibration angles θ [i], but is not limited to all, and the cumulative movement is limited to only a part. You may ask for the quantity. That is, the integer m when calculating the above-mentioned average coefficient may be less than n. Further, the above-mentioned cumulative movement amount may be calculated after obtaining all the movement amounts [i], but the cumulative movement amount is updated by accumulating the movement amount [i] at any time as described below. It may be calculated by a method.

ここで、本実施形態に係る位置検出方法のステップフローについて、図16を参照しつつ説明する。 Here, the step flow of the position detection method according to the present embodiment will be described with reference to FIG.

まず、ステップS103では、変数iを0とするほか、累積移動量も0にリセットする。 First, in step S103, the variable i is set to 0, and the cumulative movement amount is also reset to 0.

1回目のステップS108Aでは、変数iから変数i2への更新を経ているので、校正角θ[i2−1](第1位置)と、校正角θ[i2](第2位置)と、基準座標[i2−1](第1基準座標)と、合致座標[i2−1](第1合致座標)と、を求める。そして、以下の式により、累積移動量を更新する。
更新後の累積移動量=更新前の累積移動量+合致座標[i2−1]−基準座標[i2−1]
In the first step S108A, since the variable i is updated to the variable i2, the calibration angle θ [i2-1] (first position), the calibration angle θ [i2] (second position), and the reference coordinates. [I2-1] (first reference coordinates) and matching coordinates [i2-1] (first matching coordinates) are obtained. Then, the cumulative movement amount is updated by the following formula.
Cumulative movement amount after update = Cumulative movement amount before update + Match coordinates [i2-1] -Reference coordinates [i2-1]

ここでは、変数i2として1を設定しているので、校正角θ[0]と、校正角θ[1]と、基準座標[0]と、合致座標[0]と、を求める。そして、更新前の累積移動量は0としていることから、更新後の累積移動量は、合致座標[0]−基準座標[0]で求められる。 Here, since 1 is set as the variable i2, the calibration angle θ [0], the calibration angle θ [1], the reference coordinate [0], and the matching coordinate [0] are obtained. Since the cumulative movement amount before the update is 0, the cumulative movement amount after the update is obtained by the matching coordinate [0] -reference coordinate [0].

2回目のステップS108Aでは、変数i2から変数i3への更新を経ているので、校正角θ[i3−1](第2位置)と、校正角θ[i3](第3位置)と、基準座標[i3−1](第2基準座標)と、合致座標[i3−1](第2合致座標)と、を求める。そして、以下の式により、累積移動量を更新する。
更新後の累積移動量=更新前の累積移動量+合致座標[i3−1]−基準座標[i3−1]
In the second step S108A, since the variable i2 has been updated to the variable i3, the calibration angle θ [i3-1] (second position), the calibration angle θ [i3] (third position), and the reference coordinates. [I3-1] (second reference coordinates) and matching coordinates [i3-1] (second matching coordinates) are obtained. Then, the cumulative movement amount is updated by the following formula.
Cumulative movement amount after update = Cumulative movement amount before update + Match coordinates [i3-1] -Reference coordinates [i3-1]

ここでは、変数i3として2を設定しているので、校正角θ[1]と、校正角θ[2]と、基準座標[1]と、合致座標[1]と、を求める。そして、更新後の累積移動量は、更新前の累積移動量+合致座標[1]−基準座標[1]で求められる。 Here, since 2 is set as the variable i3, the calibration angle θ [1], the calibration angle θ [2], the reference coordinate [1], and the matching coordinate [1] are obtained. Then, the cumulative movement amount after the update is obtained by the cumulative movement amount before the update + the matching coordinate [1] -reference coordinate [1].

そして、変数を更新するたびに、以上のようなステップS108Aを繰り返すことにより、累積移動量を随時更新することができる。そして、最終的に得られる累積移動量から前述した平均係数を求めることができる。 Then, each time the variable is updated, the cumulative movement amount can be updated at any time by repeating step S108A as described above. Then, the above-mentioned average coefficient can be obtained from the cumulative movement amount finally obtained.

具体的には、第1実施形態において、最後のステップS109の移行後には、ステップフローを終了させるが、本実施形態では、最後のステップS109の後に、ステップS115を追加している。 Specifically, in the first embodiment, the step flow is terminated after the transition of the final step S109, but in the present embodiment, the step S115 is added after the final step S109.

ステップS115では、まず、テンプレート画像を取得するときの最初の校正角θ[0]から最後の校正角θ[m+1]までの合計変化量を、校正角θ[m+1]−校正角θ[0]により求める。そして、前述した式により、平均係数を算出する。このとき、校正用エンコーダーは不要となるため、ステップS115の後、校正用エンコーダーを取り外す(ステップS120)。 In step S115, first, the total amount of change from the first calibration angle θ [0] to the last calibration angle θ [m + 1] when the template image is acquired is set to the calibration angle θ [m + 1] − calibration angle θ [0]. Obtained by. Then, the average coefficient is calculated by the above-mentioned formula. At this time, since the calibration encoder is unnecessary, the calibration encoder is removed after step S115 (step S120).

3.2.回動角度の検出
前述した第1実施形態では、校正角θ[i]に固有の係数[i]と、測位合致座標と基準座標[i]との差と、を用いて回動角度θを算出する。一方、各係数[i]の算出には、撮像素子31が撮像した基準画像や測角画像が用いられるが、これらの画像には、不可避的に発生するランダムノイズが含まれている。このため、各係数[i]には、ランダムノイズに起因する測定誤差が含まれている。
3.2. Detection of rotation angle In the first embodiment described above, the rotation angle θ is determined by using the coefficient [i] peculiar to the calibration angle θ [i] and the difference between the positioning matching coordinates and the reference coordinates [i]. calculate. On the other hand, the reference image and the angle measurement image captured by the image sensor 31 are used for the calculation of each coefficient [i], and these images include random noise that is inevitably generated. Therefore, each coefficient [i] includes a measurement error due to random noise.

一方、本実施形態では、累積の移動量から平均係数を求め、これを用いて回動角度θを算出する。具体的には、以下の式により、回動角度θを算出する。
回動角度θ=校正角θ[i]+(測角合致座標−基準座標[i])×平均係数
On the other hand, in the present embodiment, the average coefficient is obtained from the cumulative amount of movement, and the rotation angle θ is calculated using this. Specifically, the rotation angle θ is calculated by the following formula.
Rotation angle θ = Calibration angle θ [i] + (angle measurement matching coordinates-reference coordinates [i]) × average coefficient

ここで、前述したランダムノイズは、正規分布に従うことが知られている。このため、ステップS1において累積の移動量を求めるという平均係数の算出過程は、正規分布に従うランダムノイズに起因した測定誤差を、その平均値であるゼロに収斂させるという効果を有する。このため、上記式により算出された回動角度θでは、ランダムノイズに起因した測定誤差の発生が抑えられている。したがって、本実施形態によれば、第1実施形態に比べて、測定誤差が少なく、より高精度な回動角度θを検出することができる。 Here, it is known that the above-mentioned random noise follows a normal distribution. Therefore, the process of calculating the average coefficient of obtaining the cumulative movement amount in step S1 has an effect of converging the measurement error caused by the random noise following the normal distribution to the average value of zero. Therefore, in the rotation angle θ calculated by the above formula, the occurrence of measurement error due to random noise is suppressed. Therefore, according to the present embodiment, the measurement error is smaller than that of the first embodiment, and the rotation angle θ can be detected with higher accuracy.

以上のように、本実施形態に係る位置検出方法は、少なくとも2つの校正角の合計変化量と、少なくとも2つの移動量を累積した累積移動量と、を求めるとともに、これらの比である平均係数を用いて回動角度θを算出する方法と言い換えることができる。 As described above, in the position detection method according to the present embodiment, the total change amount of at least two calibration angles and the cumulative movement amount obtained by accumulating at least two movement amounts are obtained, and the average coefficient which is the ratio of these is obtained. In other words, it can be rephrased as a method of calculating the rotation angle θ using.

具体的には、1回目のステップS104、S105、S110〜S112では、スケール部2が校正角θ[i](第1位置)にあるとき、撮像素子31にマーク21を撮像させて撮像画像[i](第1基準画像)を生成し、テンプレート画像[i](第1テンプレート画像)、および、撮像画像[i]におけるマーク21の基準座標[i](第1基準座標)を取得する。 Specifically, in the first steps S104, S105, and S110 to S112, when the scale unit 2 is at the calibration angle θ [i] (first position), the image sensor 31 is made to image the mark 21 and the captured image [ i] (first reference image) is generated, and the template image [i] (first template image) and the reference coordinates [i] (first reference coordinates) of the mark 21 in the captured image [i] are acquired.

また、2回目のステップS104、S105、S110〜S112では、スケール部2が校正角θ[i2](第2位置)にあるとき、撮像素子31にマーク21を撮像させて撮像画像[i2](第2基準画像)を生成し、テンプレート画像[i2](第2テンプレート画像)、および、撮像画像[i2]におけるマーク21の基準座標[i2](第2基準座標)を取得する。 Further, in the second steps S104, S105, and S110 to S112, when the scale unit 2 is at the calibration angle θ [i2] (second position), the image sensor 31 is made to image the mark 21 and the captured image [i2] ( The second reference image) is generated, and the template image [i2] (second template image) and the reference coordinates [i2] (second reference coordinates) of the mark 21 in the captured image [i2] are acquired.

さらに、3回目のステップS104、S105、S110〜S112では、スケール部2が校正角θ[i3](第3位置)にあるとき、撮像素子31にマーク21を撮像させて撮像画像[i3](第3基準画像)を生成する。なお、撮像画像[i3]に含まれるマーク21は、撮像画像[i2]に含まれるマーク21の、撮像画像[i]に含まれるマーク21とは反対側に位置するものである。そして、テンプレート画像[i3−1](第2テンプレート画像)に基づくテンプレートマッチングにより、撮像画像[i3]においてテンプレート画像[i3−1]と合致するマーク21の合致座標[i3−1](第2合致座標)を取得する。 Further, in the third step S104, S105, S110 to S112, when the scale unit 2 is at the calibration angle θ [i3] (third position), the image sensor 31 is made to image the mark 21 and the captured image [i3] ( Third reference image) is generated. The mark 21 included in the captured image [i3] is located on the opposite side of the mark 21 included in the captured image [i2] to the mark 21 included in the captured image [i]. Then, by template matching based on the template image [i3-1] (second template image), the matching coordinates [i3-1] (second) of the mark 21 that matches the template image [i3-1] in the captured image [i3]. Match coordinates) is acquired.

本実施形態に係る位置検出方法は、以上のような各ステップを有している。そうすると、少なくとも2つの校正角の合計変化量は、校正角θ[i](第1位置)から校正角θ[i3](第3位置)までの合計変化量として求められる。また、少なくとも2つの移動量を累積した累積移動量は、基準座標[i](第1基準座標)から合致座標[i3−1](第2合致座標)までの累積移動量として求められる。そして、本実施形態では、回動角度θを逆算するために用いる相関関係として、上記の累積移動量に対する上記の合計変化量の比として求められる平均係数を用いている。 The position detection method according to the present embodiment has the above steps. Then, the total change amount of at least two calibration angles is obtained as the total change amount from the calibration angle θ [i] (first position) to the calibration angle θ [i3] (third position). Further, the cumulative movement amount obtained by accumulating at least two movement amounts is obtained as the cumulative movement amount from the reference coordinate [i] (first reference coordinate) to the matching coordinate [i3-1] (second matching coordinate). Then, in the present embodiment, as the correlation used for back-calculating the rotation angle θ, the average coefficient obtained as the ratio of the total change amount to the cumulative movement amount is used.

このような方法によれば、前述したように、校正角iごとに個別の係数を算出し、記憶部6に記憶させておく必要がなく、1つの平均係数のみを記憶させておけばよいため、計算の省力化と、記憶部6の使用量の削減と、を図ることができる。また、第1実施形態に比べて、ランダムノイズに起因した測定誤差の影響を軽減することができる。
なお、以上のような第2実施形態においても、第1実施形態と同様の効果が得られる。
According to such a method, as described above, it is not necessary to calculate individual coefficients for each calibration angle i and store them in the storage unit 6, and only one average coefficient needs to be stored. It is possible to save labor in calculation and reduce the amount of use of the storage unit 6. Further, as compared with the first embodiment, the influence of the measurement error due to the random noise can be reduced.
In the second embodiment as described above, the same effect as that of the first embodiment can be obtained.

以上、本発明の位置検出方法、エンコーダーユニットおよびロボットを図示の好適な実施形態に基づいて説明したが、本発明はこれに限定されるものではなく、各部の構成は、同様の機能を有する任意の構成のものに置換することができる。また、他の任意の構成物が付加されていてもよい。 Although the position detection method, the encoder unit, and the robot of the present invention have been described above based on the preferred embodiments shown in the drawings, the present invention is not limited thereto, and the configuration of each part is arbitrary having the same function. Can be replaced with the one of the configuration of. Moreover, other arbitrary components may be added.

また、本発明のエンコーダーユニットは、アブソリュート型およびインクリメンタル型のいずれの形式にも適用可能である。 Further, the encoder unit of the present invention can be applied to both absolute type and incremental type.

さらに、前述した実施形態では、ロボットの基台を「第1部材」とし、第1アームを「第2部材」とした場合を例に説明したが、これに限定されず、相対的に回動する任意の2つの部材の一方を「第1部材」とし、他方を「第2部材」とすることができる。すなわち、エンコーダーの設置箇所は、基台と第1アームとの関節部に限定されず、相対的に回動する任意の2つのアームの関節部であってもよい。また、エンコーダーの設置箇所は、ロボットが有する関節部に限定されない。 Further, in the above-described embodiment, the case where the base of the robot is the “first member” and the first arm is the “second member” has been described as an example, but the present invention is not limited to this, and the robot rotates relatively. One of any two members can be referred to as a "first member" and the other can be referred to as a "second member". That is, the location where the encoder is installed is not limited to the joint between the base and the first arm, and may be the joint of any two arms that rotate relative to each other. Further, the installation location of the encoder is not limited to the joint portion of the robot.

また、前述した実施形態では、ロボットアームの数は1つであるが、ロボットアームの数は2つ以上でもよい。すなわち、本発明のロボットは、例えば、双腕ロボット等の複数腕ロボットであってもよい。 Further, in the above-described embodiment, the number of robot arms is one, but the number of robot arms may be two or more. That is, the robot of the present invention may be a multi-arm robot such as a dual-arm robot, for example.

さらに、前述した実施形態では、ロボットアームが有するアームの数は、6つであったが、アームの数は、これに限定されず、1つでもよいし、2つ以上5つ以下または7つ以上でもよい。 Further, in the above-described embodiment, the number of arms possessed by the robot arm is six, but the number of arms is not limited to this, and may be one, or two or more and five or less or seven. The above may be sufficient.

また、ロボットの設置箇所は、床面に限定されず、例えば、天井面や側壁面等でもよいし、AGV(Automatic Guided Vehicle)等の移動体でもよい。 Further, the installation location of the robot is not limited to the floor surface, and may be, for example, a ceiling surface, a side wall surface, or a moving body such as an AGV (Automatic Guided Vehicle).

1…エンコーダー、2…スケール部、3…検出部、4…回路部、5…処理部、6…記憶部、10…エンコーダーユニット、20…ドット、21…マーク、22A…ユニークパターン画像、22B…ユニークパターン画像、22X…ユニークパターン画像、31…撮像素子、32…光学系、100…ロボット、110…基台、111…モーター、112…減速機、114…支持部材、115…軸受、120…第1アーム、121…アーム本体部、122…軸部、130…第2アーム、140…作業ヘッド、141…スプラインシャフト、150…エンドエフェクター、160…配線引き回し部、1111…回動軸、BX…視野サイズ、C1…円弧、C2…円弧、DC…周方向、DR…半径方向、G…撮像画像、J1…第1軸、J2…第2軸、J3…第3軸、LY…中心線、P0…原点画素、PE…終了画素、PS…開始座標、RI…撮像領域、RS…探索領域、S1…ステップ、S101…ステップ、S102…ステップ、S103…ステップ、S104…ステップ、S105…ステップ、S106…ステップ、S107…ステップ、S108…ステップ、S108A…ステップ、S109…ステップ、S110…ステップ、S111…ステップ、S112…ステップ、S113…ステップ、S114…ステップ、S115…ステップ、S120…ステップ、S2…ステップ、S201…ステップ、S202…ステップ、S203…ステップ、TA…テンプレート画像、UP…ユニークパターン 1 ... Encoder, 2 ... Scale unit, 3 ... Detection unit, 4 ... Circuit unit, 5 ... Processing unit, 6 ... Storage unit, 10 ... Encoder unit, 20 ... Dot, 21 ... Mark, 22A ... Unique pattern image, 22B ... Unique pattern image, 22X ... Unique pattern image, 31 ... Image sensor, 32 ... Optical system, 100 ... Robot, 110 ... Base, 111 ... Motor, 112 ... Reducer, 114 ... Support member, 115 ... Bearing, 120 ... No. 1 arm, 121 ... arm body, 122 ... shaft, 130 ... second arm, 140 ... work head, 141 ... spline shaft, 150 ... end effector, 160 ... wiring routing, 1111 ... rotation axis, BX ... field of view Size, C1 ... Arc, C2 ... Arc, DC ... Circumferential, DR ... Radial, G ... Image, J1 ... 1st axis, J2 ... 2nd axis, J3 ... 3rd axis, LY ... Centerline, P0 ... Origin pixel, PE ... End pixel, PS ... Start coordinate, RI ... Image area, RS ... Search area, S1 ... Step, S101 ... Step, S102 ... Step, S103 ... Step, S104 ... Step, S105 ... Step, S106 ... Step , S107 ... step, S108 ... step, S108A ... step, S109 ... step, S110 ... step, S111 ... step, S112 ... step, S113 ... step, S114 ... step, S115 ... step, S120 ... step, S2 ... step, S201 ... step, S202 ... step, S203 ... step, TA ... template image, UP ... unique pattern

Claims (7)

複数のマークを有するスケール部と、前記マークを撮像する撮像素子と、を有し、前記撮像素子に対して前記スケール部が相対的に移動するエンコーダーを用いて、前記スケール部の位置を検出する位置検出方法であって、
前記スケール部が第1位置にあるとき、前記撮像素子により前記マークを撮像して第1基準画像を生成し、第1テンプレート画像、および、前記第1基準画像における前記マークの第1基準座標を取得するステップと、
前記スケール部が第2位置にあるとき、前記撮像素子により前記マークを撮像して第2基準画像を生成し、前記第1テンプレート画像に基づくテンプレートマッチングにより、前記第2基準画像において前記第1テンプレート画像と合致する前記マークの第1合致座標を取得するステップと、
前記第1位置と、前記第2位置と、前記第1基準座標と、前記第1合致座標と、の間に成り立つ相関関係を求めるステップと、
前記スケール部が計測位置にあるとき、前記撮像素子により前記マークを撮像して測位画像を生成し、前記第1テンプレート画像に基づくテンプレートマッチングにより、前記測位画像における前記マークの測位合致座標を取得するステップと、
前記第1位置、前記第1基準座標、前記測位合致座標、および前記相関関係に基づいて、前記計測位置を求めるステップと、
を有することを特徴とする位置検出方法。
The position of the scale unit is detected by using an encoder having a scale unit having a plurality of marks and an image sensor that images the mark, and the scale unit moves relative to the image sensor. It is a position detection method
When the scale unit is in the first position, the mark is imaged by the image sensor to generate a first reference image, and the first template image and the first reference coordinates of the mark in the first reference image are obtained. Steps to get and
When the scale unit is in the second position, the mark is imaged by the image sensor to generate a second reference image, and template matching based on the first template image results in the first template in the second reference image. The step of acquiring the first matching coordinates of the mark that matches the image, and
A step of finding a correlation established between the first position, the second position, the first reference coordinate, and the first matching coordinate.
When the scale unit is at the measurement position, the mark is imaged by the image sensor to generate a positioning image, and the positioning matching coordinates of the mark in the positioning image are acquired by template matching based on the first template image. Steps and
A step of obtaining the measurement position based on the first position, the first reference coordinate, the positioning matching coordinate, and the correlation.
A position detection method comprising.
前記相関関係は、前記第1基準座標から前記第1合致座標までの移動量、に対する、前記第1位置から前記第2位置までの変化量、の比として求められる係数である請求項1に記載の位置検出方法。 The correlation is the coefficient obtained as a ratio of the amount of movement from the first reference coordinate to the first matching coordinate, and the amount of change from the first position to the second position, according to claim 1. Position detection method. 前記スケール部が前記第2位置にあるとき、第2テンプレート画像、および、前記第2基準画像における前記マークの第2基準座標を取得するステップと、
前記スケール部が第3位置にあるとき、前記撮像素子により前記マークを撮像して第3基準画像を生成し、前記第2テンプレート画像に基づくテンプレートマッチングにより、前記第3基準画像において前記第2テンプレート画像と合致する前記マークの第2合致座標を取得するステップと、
を有し、
前記相関関係は、前記第1基準座標から前記第2合致座標までの累積移動量、に対する、前記第1位置から前記第3位置までの合計変化量、の比として求められる平均係数である請求項1に記載の位置検出方法。
When the scale portion is in the second position, the step of acquiring the second template image and the second reference coordinates of the mark in the second reference image, and
When the scale unit is in the third position, the mark is imaged by the image sensor to generate a third reference image, and template matching based on the second template image results in the second template in the third reference image. The step of acquiring the second matching coordinates of the mark that matches the image, and
Have,
The correlation is an average coefficient obtained as a ratio of the cumulative movement amount from the first reference coordinate to the second matching coordinate and the total change amount from the first position to the third position. The position detection method according to 1.
前記テンプレートマッチングは、サブピクセル推定を行う処理である請求項1ないし3のいずれか1項に記載の位置検出方法。 The position detection method according to any one of claims 1 to 3, wherein the template matching is a process of estimating sub-pixels. 複数のマークを有するスケール部と、前記マークを撮像する撮像素子と、を有し、前記撮像素子に対して前記スケール部が相対的に移動するエンコーダーと、
前記撮像素子の撮像結果に基づいて、前記スケール部の位置を求める処理を実行する処理部と、
前記処理部で読み取り可能な指示を記憶する記憶部と、
を有し、
前記処理部は、前記記憶部に記憶されている前記指示に基づき、
前記スケール部が第1位置にあるとき、前記撮像素子に前記マークを撮像させて第1基準画像を生成し、第1テンプレート画像、および、前記第1基準画像における前記マークの第1基準座標を取得し、
前記スケール部が第2位置にあるとき、前記撮像素子に前記マークを撮像させて第2基準画像を生成し、前記第1テンプレート画像に基づくテンプレートマッチングにより、前記第2基準画像において前記第1テンプレート画像と合致する前記マークの第1合致座標を取得し、
前記第1位置と、前記第2位置と、前記第1基準座標と、前記第1合致座標と、の間に成り立つ相関関係を求め、
前記スケール部が計測位置にあるとき、前記撮像素子に前記マークを撮像させて測位画像を生成し、前記第1テンプレート画像に基づくテンプレートマッチングにより、前記測位画像における前記マークの測位合致座標を取得し、
前記第1位置、前記第1基準座標、前記測位合致座標、および前記相関関係に基づいて、前記計測位置を求める処理を実行することを特徴とするエンコーダーユニット。
An encoder having a scale unit having a plurality of marks, an image pickup element for capturing the mark, and the scale portion moving relative to the image pickup element.
A processing unit that executes a process of obtaining the position of the scale unit based on the image pickup result of the image sensor, and a processing unit.
A storage unit that stores instructions that can be read by the processing unit,
Have,
The processing unit is based on the instruction stored in the storage unit.
When the scale unit is in the first position, the image sensor is made to image the mark to generate a first reference image, and the first template image and the first reference coordinates of the mark in the first reference image are obtained. Acquired,
When the scale unit is in the second position, the image sensor is made to image the mark to generate a second reference image, and template matching based on the first template image is performed to obtain the first template in the second reference image. Obtain the first matching coordinates of the mark that matches the image,
The correlation established between the first position, the second position, the first reference coordinate, and the first matching coordinate is obtained.
When the scale unit is in the measurement position, the image sensor is made to image the mark to generate a positioning image, and the positioning matching coordinates of the mark in the positioning image are acquired by template matching based on the first template image. ,
An encoder unit characterized by executing a process of obtaining the measurement position based on the first position, the first reference coordinate, the positioning matching coordinate, and the correlation.
前記エンコーダーは、ロータリーエンコーダーである請求項5に記載のエンコーダーユニット。 The encoder unit according to claim 5, wherein the encoder is a rotary encoder. 第1部材と、
前記第1部材に対して移動する第2部材と、
請求項5または6に記載のエンコーダーユニットと、
を備え、
前記スケール部が前記第2部材に設けられ、前記撮像素子が前記第1部材に設けられていることを特徴とするロボット。
The first member and
A second member that moves with respect to the first member,
The encoder unit according to claim 5 or 6, and the encoder unit.
With
A robot characterized in that the scale portion is provided on the second member and the image pickup element is provided on the first member.
JP2019220159A 2019-12-05 2019-12-05 Position detection method, encoder unit, and robot Pending JP2021089224A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2019220159A JP2021089224A (en) 2019-12-05 2019-12-05 Position detection method, encoder unit, and robot

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2019220159A JP2021089224A (en) 2019-12-05 2019-12-05 Position detection method, encoder unit, and robot

Publications (1)

Publication Number Publication Date
JP2021089224A true JP2021089224A (en) 2021-06-10

Family

ID=76220066

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2019220159A Pending JP2021089224A (en) 2019-12-05 2019-12-05 Position detection method, encoder unit, and robot

Country Status (1)

Country Link
JP (1) JP2021089224A (en)

Similar Documents

Publication Publication Date Title
US10775204B2 (en) Encoder unit, angle measuring method, and robot
JP6809245B2 (en) robot
CN103453848B (en) Device and method for measuring shape, position and dimension features of machine elements
JP5561260B2 (en) Robot system and imaging method
US10088301B2 (en) Image measurement device
JP6838278B2 (en) robot
JP6836571B2 (en) Robot device
CN102735166A (en) Three-dimensional scanner and robot system
US10088302B2 (en) Image measurement device
KR20090009172A (en) Method and apparatus for measuring position of the mobile robot
JP2009511881A (en) Method and apparatus for practical 3D vision system
WO2004007150A1 (en) Carriage robot system and its controlling method
US10020216B1 (en) Robot diagnosing method
JP6878908B2 (en) Encoders, robots and printers
JP2009526211A (en) Apparatus and method for tracking tool movement of a handling device
JP2012213840A (en) Machine tool
KR20180012789A (en) Assembly device of gear mechanism and assembly method
CN111095518B (en) Substrate conveying device and method for obtaining positional relationship between robot and placement unit
JP5088186B2 (en) Robot apparatus and control method of robot apparatus
JP2021089224A (en) Position detection method, encoder unit, and robot
JP4284765B2 (en) Robot hand position measuring device
US20190057288A1 (en) Encoder, robot and printer
JP2008294065A (en) Mounting method and mounting device for electronic component
JP2021089206A (en) Angle detection method, encoder unit, and robot
US20190077013A1 (en) Robot Diagnosing Method

Legal Events

Date Code Title Description
RD07 Notification of extinguishment of power of attorney

Free format text: JAPANESE INTERMEDIATE CODE: A7427

Effective date: 20200817

RD04 Notification of resignation of power of attorney

Free format text: JAPANESE INTERMEDIATE CODE: A7424

Effective date: 20210914

RD03 Notification of appointment of power of attorney

Free format text: JAPANESE INTERMEDIATE CODE: A7423

Effective date: 20211101