JP5445233B2 - Robot controller - Google Patents

Robot controller Download PDF

Info

Publication number
JP5445233B2
JP5445233B2 JP2010050446A JP2010050446A JP5445233B2 JP 5445233 B2 JP5445233 B2 JP 5445233B2 JP 2010050446 A JP2010050446 A JP 2010050446A JP 2010050446 A JP2010050446 A JP 2010050446A JP 5445233 B2 JP5445233 B2 JP 5445233B2
Authority
JP
Japan
Prior art keywords
packet
address
header
footer
data
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
JP2010050446A
Other languages
Japanese (ja)
Other versions
JP2011183498A (en
Inventor
昇吾 壁谷
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Denso Wave Inc
Original Assignee
Denso Wave Inc
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 Denso Wave Inc filed Critical Denso Wave Inc
Priority to JP2010050446A priority Critical patent/JP5445233B2/en
Publication of JP2011183498A publication Critical patent/JP2011183498A/en
Application granted granted Critical
Publication of JP5445233B2 publication Critical patent/JP5445233B2/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Description

本発明は、外部から与えられる制御命令に従ってロボットの動作を制御するロボットのコントローラに関する。   The present invention relates to a robot controller that controls the operation of a robot in accordance with a control command given from the outside.

ロボットを制御するためのコントローラは、外部から与えられる制御命令(コマンド)に従い、ロボットの各軸の駆動制御やI/Oの切替制御などを行うようになっている。このコマンドは、ユーザが任意に作成したプログラムなどに基づいて例えばパソコンから送信される。また、コマンドは、制御情報(ヘッダ、フッタ、シリアル番号など)が付加されたパケット単位で送信される。このパケットのデータ構造は予め定められている。そして、プログラムについてのデバッグ作業は、ユーザ自身が行う。従って、ユーザがプログラムの作成を誤った場合などには、送信されるパケットが正規のデータ構造でないことも考えられる。一方、ロボットがユーザの意図しない動作を行うことは危険な事態を招くおそれがある。このため、ユーザのプログラムが原因で上記事態を招くことがないようにコントローラ側でその対策を行う必要がある。   A controller for controlling the robot performs drive control of each axis of the robot, I / O switching control, and the like according to a control command (command) given from the outside. This command is transmitted from, for example, a personal computer based on a program arbitrarily created by the user. The command is transmitted in units of packets to which control information (header, footer, serial number, etc.) is added. The data structure of this packet is predetermined. The user himself debugs the program. Therefore, when the user makes a mistake in creating the program, the transmitted packet may not have a regular data structure. On the other hand, if the robot performs an operation unintended by the user, it may cause a dangerous situation. For this reason, it is necessary to take countermeasures on the controller side so that the above situation is not caused by the user's program.

このような事情から、コントローラでは、受信したパケットが正規のデータ構造を有していなかった場合など、コマンドを適切に受信できなかった場合には、当該コマンドはデータ長自体が正しくない可能性があるので、そのパケットおよびそれ以降のパケットを全て破棄(リセット)する。その後、パソコン側から同じパケットを再度送信させて、コントローラ側で再度受信動作を行う。これにより、誤った構造のパケットが送信されたとしても、コントローラはこれに応じることがないので、ロボットがユーザの意図しない動作を行う事態を未然に防止できるようになっている。   For this reason, if the controller cannot receive the command properly, such as when the received packet does not have a regular data structure, the command may have an incorrect data length. Since there is, the packet and all subsequent packets are discarded (reset). Thereafter, the same packet is transmitted again from the personal computer side, and the receiving operation is performed again on the controller side. As a result, even if a packet with an incorrect structure is transmitted, the controller does not respond to this, so that it is possible to prevent a situation where the robot performs an operation not intended by the user.

上記したようにデータ受信に関する問題が生じたときにリセットを行う技術は、例えば特許文献1にも開示されている。すなわち、特許文献1には、外部との間にて非接触でデータを入出力する非接触入力手段に異常が発生した場合に、これをリセットして再度データの送受信を行う技術が開示されている。   As described above, for example, Patent Document 1 discloses a technique for performing a reset when a problem relating to data reception occurs. That is, Patent Document 1 discloses a technique for resetting and transmitting / receiving data again when an abnormality occurs in non-contact input means for inputting / outputting data without contact with the outside. Yes.

特開平5−143791号公報JP-A-5-143791

上記したコマンドの受信方法では以下のような問題が生じる可能性がある。すなわち、パソコンから連続してパケットが送信され、そのうちの1つに問題(非正規のデータ構造になっているなど)があった場合、連続して送信されたパケットの全てがリセットされる。このため、ユーザは、どのパケットに問題があってリセットがかけられたのかを認識することができず、同じミスを繰り返してしまう可能性があった。   The above-described command receiving method may cause the following problems. In other words, if packets are continuously transmitted from the personal computer and one of them has a problem (such as an irregular data structure), all of the continuously transmitted packets are reset. For this reason, the user cannot recognize which packet has a problem and has been reset, and may repeat the same mistake.

本発明は上記事情に鑑みてなされたものであり、その目的は、制御命令を適切に受信できなかった場合に、どこに問題があるのかを特定することができるロボットのコントローラを提供することにある。   The present invention has been made in view of the above circumstances, and an object of the present invention is to provide a robot controller that can identify where the problem is when a control command cannot be properly received. .

請求項1記載の手段によれば、制御部は、外部から与えられる制御命令をパケット単位で受信する。制御部は、受信したパケットを受信した順にパケット格納用メモリの開始アドレスから終了アドレスに向けて順次格納させる。このパケットは、所定のデータ構造を有するものであり、固定長のヘッダ、メッセージ長、シリアル番号およびフッタと、可変長のデータ部とから構成される。ヘッダは、パケットの先頭に設けられる固定値のデータである。メッセージ長は、ヘッダの直後に設けられ、パケットの全データ長を示すデータである。シリアル番号は、パケット毎に特有の値となるデータである。データ部は、制御内容を示すデータである。フッタは、パケットの最後尾に設けられる固定値のデータである。制御部は、パケット格納用メモリに格納されたパケットが正常であるか否か、すなわち、上記したような正規のデータ構造を有しているか否かを判断する。そして、制御部は、正常であると判断したパケットのデータ部が示す制御内容に基づいてロボットの動作制御を行う。   According to the first aspect of the present invention, the control unit receives a control command given from the outside in units of packets. The control unit sequentially stores the received packets from the start address to the end address of the packet storage memory in the order received. This packet has a predetermined data structure, and is composed of a fixed length header, a message length, a serial number and a footer, and a variable length data portion. The header is fixed value data provided at the beginning of the packet. The message length is data that is provided immediately after the header and indicates the total data length of the packet. The serial number is data that is a unique value for each packet. The data part is data indicating control contents. The footer is fixed value data provided at the end of the packet. The control unit determines whether or not the packet stored in the packet storage memory is normal, that is, whether or not it has a normal data structure as described above. And a control part performs operation control of a robot based on the control content which the data part of the packet judged to be normal shows.

制御部は、パケットが正常であるか否かを判断する際に次のような処理を行う。すなわち、制御部は、パケット格納用メモリにパケットが格納されると、パケットが格納されたアドレスのうち最後尾のアドレスを基準アドレスとした上で第1の確認処理を実行する。この第1の確認処理において、制御部は、上記基準アドレスから開始アドレスに向けてヘッダを探索する(ヘッダ探索処理)。そして、制御部は、ヘッダが発見されるとそのヘッダの直後に設けられたメッセージ長が示す全データ長を取得する(全データ長取得処理)。また、制御部は、発見したヘッダが格納されたヘッダアドレスおよび取得した全データ長を用いてフッタが格納されたフッタアドレスを検出する(フッタアドレス検出処理)。具体的には、ヘッダアドレスに全データ長を加算したものがフッタアドレスとなる。なお、ここで言うヘッダアドレスは、ヘッダが占有する最初のアドレス(開始アドレス)でもよいし、最後のアドレス(終了アドレス)でもよい。また、ヘッダが占有する開始から終了までの各アドレス(つまり、ヘッダ自身が占有するメモリ領域の各アドレス=アドレスの量)でもよい。また、フッタアドレスについては、ヘッダアドレスと同様のものを表すことになる。そして、制御部は、検出したフッタアドレスにフッタが存在するか否かを判断する(フッタ確認処理)。   The control unit performs the following process when determining whether or not the packet is normal. That is, when the packet is stored in the packet storage memory, the control unit executes the first confirmation process with the last address among the addresses where the packet is stored as the reference address. In the first confirmation process, the control unit searches for a header from the reference address toward the start address (header search process). Then, when the header is found, the control unit acquires the total data length indicated by the message length provided immediately after the header (total data length acquisition process). In addition, the control unit detects the footer address where the footer is stored using the header address where the found header is stored and the acquired total data length (footer address detection process). Specifically, the footer address is obtained by adding the total data length to the header address. The header address mentioned here may be the first address (start address) occupied by the header or the last address (end address). Alternatively, each address from the start to the end occupied by the header (that is, each address of the memory area occupied by the header itself = the amount of addresses) may be used. Also, the footer address represents the same as the header address. Then, the control unit determines whether or not a footer exists at the detected footer address (footer confirmation processing).

フッタ確認処理においてフッタが存在しないと判断された場合には、そのフッタを含むパケットが異常であるということになる。この場合、制御部は、発見したヘッダのヘッダアドレスから開始アドレスに向けてヘッダ探索処理を再度実行する。すなわち、制御部は、次のパケットのヘッダを探索すべくヘッダ探索処理を再実行する。一方、フッタ確認処理においてフッタが存在すると判断された場合には、そのフッタを含むパケットが正常であるということになる。この場合、制御部は、第2の確認処理を実行する。   If it is determined in the footer confirmation process that there is no footer, the packet including the footer is abnormal. In this case, the control unit performs the header search process again from the header address of the found header toward the start address. That is, the control unit re-executes the header search process to search for the header of the next packet. On the other hand, when it is determined in the footer confirmation process that a footer exists, the packet including the footer is normal. In this case, the control unit executes a second confirmation process.

この第2の確認処理において、制御部は、基準アドレスからヘッダアドレスの先頭アドレスまでのデータ長と、取得した全データ長とが一致するか否かを確認する。このような第2の確認処理を行う理由は以下のとおりである。すなわち、正規のデータ構造を有するパケット(正常なパケット)が連続している場合であれば、上記各データ長は一致する。これに対し、異常なパケットに続いて正常なパケット(例えば、ヘッダが存在しない、フッタが存在しない、データ長が間違っているなど)を受信した場合には、上記各データ長が一致しない。   In the second confirmation process, the control unit confirms whether or not the data length from the reference address to the head address of the header address matches the acquired total data length. The reason for performing such second confirmation processing is as follows. That is, if the packets having normal data structures (normal packets) are continuous, the data lengths match. On the other hand, when a normal packet (for example, no header, no footer, wrong data length, etc.) is received after an abnormal packet, the data lengths do not match.

このため、制御部は、第2の確認処理において各データ長が一致すると判断した場合には、フッタ確認処理により確認されたフッタを含むパケットが正常であると判断し、そのシリアル番号を記憶する(正常データ記憶処理)。また、制御部は、第2の確認処理において各データが一致しないと判断された場合には、フッタ確認処理により確認されたフッタを含むパケットよりも1つ後に格納されたパケット(確認されたフッタを含むパケットの終了アドレス側の隣に格納されたパケット)が異常であると判断し、その旨を示す異常データを記憶する(異常データ記憶処理)。なお、この際、制御部は、確認されたフッタを含むパケットのシリアル番号を用いて、上記異常であると判断したパケットを特定する異常データを記憶する。例えば、この異常データは、「パケット(シリアル番号:XXXX)より1つ後に格納されたパケット(シリアル番号:不明)に異常がある」といった内容のものである。   For this reason, when it is determined that the data lengths match in the second confirmation process, the control unit determines that the packet including the footer confirmed by the footer confirmation process is normal, and stores the serial number. (Normal data storage processing). In addition, when it is determined in the second confirmation process that the data does not match, the control unit stores a packet stored after the packet including the footer confirmed by the footer confirmation process (confirmed footer). The packet stored next to the end address side of the packet including) is abnormal, and stores abnormal data indicating that (abnormal data storage processing). At this time, the control unit stores the abnormal data for identifying the packet determined to be abnormal using the serial number of the packet including the confirmed footer. For example, the abnormal data has contents such as “the packet (serial number: unknown) stored immediately after the packet (serial number: XXXX) has an abnormality”.

正常データ記憶処理が実行されると、そのパケットは正規なデータ構造を有しているという判断がなされたことになる。この場合には、次のパケット(正常であると判断されたパケットの開始アドレス側の隣に格納されたパケット)が正常であるか否かの確認を行う。すなわち、制御部は、正常データ記憶処理が実行されると、記憶したシリアル番号を含むパケットのヘッダの先頭アドレスから開始アドレス側に向けて1アドレス(例えば1バイト)進んだアドレスを基準アドレスとした上で第1の確認処理を実行する。一方、異常データ記憶処理が実行されると、異常なパケットが存在していることが確認されたため、これ以降のパケットが正常であるか否かの確認を行うことができない。従って、制御部は、異常データ記憶処理が実行されると、その時点で記憶されているシリアル番号および異常データを外部に対して出力する(通知処理)。   When the normal data storage process is executed, it is determined that the packet has a normal data structure. In this case, it is confirmed whether or not the next packet (packet stored next to the start address side of the packet determined to be normal) is normal. That is, when the normal data storage process is executed, the control unit uses the address advanced by one address (for example, 1 byte) from the head address of the header of the packet including the stored serial number toward the start address side as the reference address. The first confirmation process is executed above. On the other hand, when the abnormal data storage process is executed, since it is confirmed that an abnormal packet exists, it is not possible to check whether or not the subsequent packets are normal. Therefore, when the abnormal data storage process is executed, the control unit outputs the serial number and the abnormal data stored at that time to the outside (notification process).

また、上記各処理が繰り返された結果、全てのパケットに異常が見つからなかった場合には、第1の確認処理のヘッダ探索処理において開始アドレスを超えることになる。この場合、制御部は、記憶されているシリアル番号を外部に対して出力する通知処理を行う。なお、この場合、任意のシリアル番号(例えば最後に記憶されたシリアル番号)だけを出力してもよいし、全てのシリアル番号を出力してもよい。このように、ヘッダ探索処理は、開始アドレスを終点としてその処理が終了される。開始アドレス(例えば0000番地)を終点とすれば、開始アドレスよりも先の(若い番号の)アドレスが存在しないため、どのような状況であっても、ヘッダ探索処理が確実に終了されることになる。従って、無限ループに陥る可能性が極めて低くなる。   If no abnormality is found in all the packets as a result of repeating the above processes, the start address is exceeded in the header search process of the first confirmation process. In this case, the control unit performs notification processing for outputting the stored serial number to the outside. In this case, only an arbitrary serial number (for example, the last stored serial number) may be output, or all serial numbers may be output. Thus, the header search process is terminated with the start address as the end point. If the start address (for example, address 0000) is set as the end point, there is no address that is earlier (the younger number) than the start address, so that the header search process is surely terminated in any situation. Become. Therefore, the possibility of falling into an infinite loop is extremely low.

このように、制御部は、受信したパケットに対し、正常であるか否かについての確認を行い、その結果、正常であると判断したパケットのシリアル番号を外部に出力するとともに、異常であると判断したパケットを特定するための異常データを外部に出力する。このような構成によれば、制御命令(プログラム)を作成するユーザは、制御命令の受信エラーが発生した場合、コントローラ側から出力されたシリアル番号および異常データに基づいて、どのパケットに異常があったのかを容易に確認することができる。そして、ユーザは、この情報に基づいてプログラムのデバッグ作業を正確に且つ効率よく行うことが可能となり、以降において同様の受信エラーが発生してしまう事態が防止される。   In this way, the control unit confirms whether or not the received packet is normal, and as a result, outputs the serial number of the packet determined to be normal to the outside and is abnormal. Abnormal data for specifying the determined packet is output to the outside. According to such a configuration, when a control command reception error occurs, a user who creates a control command (program) has an error in which packet based on the serial number and error data output from the controller side. You can easily check if The user can accurately and efficiently debug the program based on this information, and a situation in which a similar reception error occurs thereafter is prevented.

上述したように、制御部は、パケット格納用メモリの最終アドレスに最も近いところに格納された最後尾のパケットから開始アドレスに最も近いところに格納された先頭のパケットに向けて順番に正常であるか否かの確認を行う。このような確認中、新たなパケットを受信した場合、新たに受信したパケットは、その時点で最後尾だったパケットの後ろに格納される。このため、パケットの確認は、その確認の開始時点で格納されていたパケットに対してのみ行われる。従って、パケットが正常であるか否かの確認は、その確認中に新たなパケットを受信したか否かにかかわらず、当初確認対象とされたパケットに対する確認が完了し次第終了となる。そして、その終了した時点で、確認が完了しているパケットのデータ部が示す制御内容に基づく制御を実行することが可能となる。このような構成によれば、パケットを受信してから、そのパケットに基づくロボットの動作制御が開始されるまでの遅延時間を極力短くすることができる。   As described above, the control unit is normal in order from the last packet stored closest to the final address of the packet storage memory to the first packet stored closest to the start address. Confirm whether or not. When a new packet is received during such confirmation, the newly received packet is stored after the last packet at that time. For this reason, the packet is confirmed only for the packet stored at the start of the confirmation. Therefore, the confirmation as to whether or not the packet is normal ends as soon as the confirmation of the packet that has been initially confirmed is completed, regardless of whether or not a new packet is received during the confirmation. Then, at the time of completion, it is possible to execute control based on the control content indicated by the data portion of the packet that has been confirmed. According to such a configuration, the delay time from when a packet is received until the robot operation control based on the packet is started can be shortened as much as possible.

請求項2記載の手段によれば、制御部は、第2の確認処理において、データ長と全データ長とが一致しないと判断された際、データ長が全データ長よりも大である場合には、請求項1記載の手段と同様に異常データ記憶処理を実行する。さて、パケットのフッタ、ヘッダ以外の部分に、偶然これらと同一のデータが存在した場合には、第2の確認処理におけるデータ長が全データ長よりも小さくなる。本手段では、このような稀なケースを想定し、第2の確認処理において、データ長が全データ長よりも小である場合には、発見したヘッダのヘッダアドレスから開始アドレスに向けてヘッダ探索処理を実行する。つまり、この時点で発見したヘッダは正しいものではないため、正しいヘッダを発見するまでヘッダ探索処理を継続させる。このような構成によれば、上記した稀なケースであっても、パケットが正常であるか否かを正確に判断することが可能となる。   According to the means described in claim 2, when it is determined in the second confirmation process that the data length does not match the total data length, the control unit determines that the data length is larger than the total data length. Performs the abnormal data storage processing in the same manner as the means described in claim 1. If the same data is accidentally present in portions other than the footer and header of the packet, the data length in the second confirmation process becomes smaller than the total data length. In this means, assuming such a rare case, in the second confirmation process, if the data length is smaller than the total data length, the header search from the header address of the found header toward the start address is performed. Execute the process. That is, since the header found at this time is not correct, the header search process is continued until a correct header is found. According to such a configuration, it is possible to accurately determine whether or not a packet is normal even in the rare case described above.

本発明の一実施形態を示すロボットシステムの構成を概略的に示す図The figure which shows schematically the structure of the robot system which shows one Embodiment of this invention. パケットのデータ構造を示す図Diagram showing data structure of packet 受信処理の流れを説明するための図Diagram for explaining the flow of reception processing パケット確認処理の流れを示すフローチャートFlow chart showing the flow of packet confirmation processing ヘッダが存在しないパケットを受信した場合を示す図Diagram showing a case where a packet with no header is received フッタが存在しないパケットを受信した場合を示す図The figure which shows the case where the packet which does not have the footer is received メッセージ長が誤ったデータであるパケットを受信した場合を示す図Figure showing a case where a packet with incorrect message length is received 先頭のパケットから順番にパケット確認処理を行う場合を示す図The figure which shows the case where packet confirmation processing is done in order from the first packet 最後のパケットから順番にパケット確認処理を行う場合を示す図The figure which shows the case where packet confirmation processing is done in order from the last packet

以下、本発明の一実施形態について図面を参照しながら説明する。
図1は、一般的な産業用ロボットのシステム構成を示している。図1に示すロボットシステム1は、ロボット2およびロボット2を制御するコントローラ3を備えている。ロボット2は、例えば部品の組み立て用あるいは部品の検査用など、任意の構成のロボットである。コントローラ3は、周辺機器としてティーチングペンダント4およびパーソナルコンピュータ5(以下、パソコン5と称す)などが接続されている。なお、パソコン5は、必要に応じて接続されるものであり、常時接続されているとは限らない。
Hereinafter, an embodiment of the present invention will be described with reference to the drawings.
FIG. 1 shows a system configuration of a general industrial robot. A robot system 1 shown in FIG. 1 includes a robot 2 and a controller 3 that controls the robot 2. The robot 2 is a robot having an arbitrary configuration, for example, for assembling parts or for inspecting parts. The controller 3 is connected to a teaching pendant 4 and a personal computer 5 (hereinafter referred to as a personal computer 5) as peripheral devices. Note that the personal computer 5 is connected as necessary, and is not always connected.

ロボット2は、例えば6軸の垂直多関節型ロボットとして構成されている。ロボット2は、ベース6と、このベース6に水平方向に回転可能に支持されたショルダ部7と、このショルダ部7に上下方向に回転可能に支持された下アーム8と、この下アーム8に上下方向に回転可能に支持された第1の上アーム9と、この第1の上アーム9に捻り回転可能に支持された第2の上アーム10と、この第2の上アーム10に上下方向に回転可能に支持された手首11と、この手首11に捻り回転可能に支持されたフランジ12とから構成されている。   The robot 2 is configured as, for example, a 6-axis vertical articulated robot. The robot 2 includes a base 6, a shoulder portion 7 that is rotatably supported by the base 6 in the horizontal direction, a lower arm 8 that is rotatably supported by the shoulder portion 7 in the vertical direction, and the lower arm 8. A first upper arm 9 rotatably supported in the vertical direction, a second upper arm 10 rotatably supported by the first upper arm 9, and a vertical direction supported by the second upper arm 10 The wrist 11 is rotatably supported on the wrist 11, and the flange 12 is rotatably supported on the wrist 11 by twisting.

ベース6、ショルダ部7、下アーム8、第1の上アーム9、第2の上アーム10、手首11およびフランジ12は、ロボット2のアームとして機能し、アーム先端であるフランジ12には、図示はしないが、エンドエフェクタ(手先)が取り付けられる。ロボット2に設けられる複数の軸はそれぞれに対応して設けられるサーボモータ(図示せず)により駆動される。ロボット2とコントローラ3との間は、接続ケーブル13によって接続されている。これにより、ロボット2の各軸を駆動するサーボモータの駆動がコントローラ3によって制御される。   The base 6, the shoulder portion 7, the lower arm 8, the first upper arm 9, the second upper arm 10, the wrist 11 and the flange 12 function as the arm of the robot 2. Although not, an end effector (hand) is attached. A plurality of axes provided in the robot 2 are driven by servo motors (not shown) provided corresponding to the respective axes. The robot 2 and the controller 3 are connected by a connection cable 13. Thus, the controller 3 controls the drive of the servo motor that drives each axis of the robot 2.

ティーチングペンダント4は、例えば使用者が携帯あるいは手に所持して操作可能な程度の大きさで、例えば薄型の略矩形箱状に形成されている。ティーチングペンダント4には、各種のキースイッチ14が設けられており、使用者は、キースイッチ14により種々の入力操作を行う。ティーチングペンダント4は、ケーブル15を経由してコントローラ3に接続され、通信インターフェイスを介してコントローラ3との間で高速のデータ転送を実行する。キースイッチ14の操作により入力された操作信号等の情報は、ティーチングペンダント4からコントローラ3へ送信される。また、コントローラ3は、ティーチングペンダント4へ制御信号や表示用の信号などと共に駆動用の電力を供給する。   The teaching pendant 4 is, for example, a size that can be operated by being carried by a user or carried by a hand, and is formed in, for example, a thin, substantially rectangular box shape. The teaching pendant 4 is provided with various key switches 14, and the user performs various input operations using the key switches 14. The teaching pendant 4 is connected to the controller 3 via a cable 15 and executes high-speed data transfer with the controller 3 via a communication interface. Information such as an operation signal input by operating the key switch 14 is transmitted from the teaching pendant 4 to the controller 3. The controller 3 supplies driving power to the teaching pendant 4 together with a control signal and a display signal.

使用者は、上記のティーチングペンダント4を用いてロボット2の運転や設定などの各種の機能を実行可能であり、例えばキースイッチ14を操作することで、予め記憶されている制御プログラムを呼び出して、ロボット2の起動や各種のパラメータの設定などを実行できる。また、ロボット2をマニュアル操作で動作させて各種の教示作業も実行可能である。   The user can execute various functions such as operation and setting of the robot 2 using the teaching pendant 4 described above. For example, by operating the key switch 14, a user can call a control program stored in advance, The robot 2 can be activated and various parameters can be set. Also, various teaching operations can be executed by operating the robot 2 by manual operation.

パソコン5は、例えば汎用のノートパソコンなどである。使用者は、パソコン5を用いて、ロボット2の各軸の駆動制御やI/Oの切替制御などを行うための制御命令(コマンド)を記述したプログラムを作成できる。パソコン5は、ケーブル16を経由してコントローラ3に接続されている。これにより、パソコン5は、作成された上記プログラムに基づく各種のコマンドをコントローラ3に送信可能となっている。また、このコマンドは、予め定められたデータ構造を持つパケット単位で送信される。   The personal computer 5 is, for example, a general-purpose notebook personal computer. The user can use the personal computer 5 to create a program in which control commands (commands) for performing drive control of each axis of the robot 2 and I / O switching control are described. The personal computer 5 is connected to the controller 3 via the cable 16. Thereby, the personal computer 5 can transmit various commands based on the created program to the controller 3. This command is transmitted in packet units having a predetermined data structure.

コントローラ3(ロボットのコントローラに相当)は、パソコン5から送信されるパケットを受信すると、パケット確認処理および受信処理(詳細は後述する)を行う。コントローラ3は、これらの処理を行った後、受信したパケットのうち正規のデータ構造を持つパケットに含まれるデータの内容(コマンド)を解釈し、その内容に基づいてロボット2の動作を制御する。   When the controller 3 (corresponding to the controller of the robot) receives a packet transmitted from the personal computer 5, it performs packet confirmation processing and reception processing (details will be described later). After performing these processes, the controller 3 interprets the content (command) of data included in a packet having a normal data structure among the received packets, and controls the operation of the robot 2 based on the content.

図2は、本実施形態におけるパケットの正規のデータ構造を示している。図2に示すように、パケットPは、ヘッダH、メッセージ長M、シリアル番号S、データ部DおよびフッタFにより、この順番で構成されている。ヘッダHは、固定長(例えば1バイト)のデータであり、本実施形態のデータ構造特有の値となっている。メッセージ長Mは、固定長(例えば4バイト)のデータである。メッセージ長Mは、パケットP全体(ヘッダHの最初のビットからフッタFの最後のビットまで)の長さ(バイト数)を示すデータである。   FIG. 2 shows a regular data structure of a packet in this embodiment. As shown in FIG. 2, the packet P is composed of a header H, a message length M, a serial number S, a data part D, and a footer F in this order. The header H is data of a fixed length (for example, 1 byte), and has a value specific to the data structure of the present embodiment. The message length M is fixed-length data (for example, 4 bytes). The message length M is data indicating the length (number of bytes) of the entire packet P (from the first bit of the header H to the last bit of the footer F).

シリアル番号Sは、固定長(例えば4バイト)のデータである。シリアル番号Sは、通し番号を示すデータであり、それぞれのパケットP毎に特有の値となっている。データ部Dは、可変長(例えば0〜12バイト)のデータである。データ部Dは、ロボット2の動作などを命令するためのコマンド(制御命令)を示すデータである。フッタFは、固定長(本実施形態では1バイト)のデータであり、本実施形態のデータ構造特有の値となっている。図2に示す構造のパケットPは、正規なデータ構造を持つものであり、これ以外のデータ構造のパケットは、非正規なデータ構造を持つパケットということになる。   The serial number S is data having a fixed length (for example, 4 bytes). The serial number S is data indicating a serial number and has a unique value for each packet P. The data part D is variable length data (for example, 0 to 12 bytes). The data part D is data indicating a command (control instruction) for instructing the operation of the robot 2 or the like. The footer F is data of a fixed length (1 byte in the present embodiment), and has a value specific to the data structure of the present embodiment. The packet P having the structure shown in FIG. 2 has a normal data structure, and a packet having a data structure other than this has a non-normal data structure.

図3は、パソコンから送信されるパケットを受信するための構成を示している。図3において、(a)はパケットを受信した直後の状態であり、(b)は1つのパケットの受信処理が終了した状態である。図3(a)に示すように、パソコン5から送信されたパケットP1〜P4は、コントローラ3のパケット格納用メモリ21に一時的に格納される。この際、パケットP1〜P4は、受信した順に、パケット格納用メモリ21に格納される。すなわち、受信したパケットP1〜P4は、その順にパケット格納用メモリ21の開始アドレス側から終了アドレス側に向けて順次格納される。   FIG. 3 shows a configuration for receiving a packet transmitted from a personal computer. In FIG. 3, (a) shows a state immediately after receiving a packet, and (b) shows a state where reception processing for one packet is completed. As shown in FIG. 3A, the packets P <b> 1 to P <b> 4 transmitted from the personal computer 5 are temporarily stored in the packet storage memory 21 of the controller 3. At this time, the packets P1 to P4 are stored in the packet storage memory 21 in the order received. In other words, the received packets P1 to P4 are sequentially stored from the start address side to the end address side of the packet storage memory 21 in that order.

制御部22は、例えばマイクロコンピュータを主体として構成されたものであり、パソコン5から送信されるコマンドに基づいてロボット2の動作制御を行う。制御部22は、パケット格納用メモリ21にパケットが格納されると、格納された全てのパケットに対してパケット確認処理を実行する(詳細は後述する)。制御部22は、パケット確認処理において「異常無し」と判断した場合、最も開始アドレスに近いところに格納されたパケット、つまり先頭のパケットP1に対する受信処理を行う。一方、制御部22は、パケット確認処理において「異常有り」と判断した場合、詳細は後述するが、どのパケットに異常があったかなどを示すデータをパソコン5に対して送信する。   The control unit 22 is configured mainly with a microcomputer, for example, and controls the operation of the robot 2 based on a command transmitted from the personal computer 5. When a packet is stored in the packet storage memory 21, the control unit 22 performs a packet confirmation process on all the stored packets (details will be described later). When determining that there is no abnormality in the packet confirmation process, the control unit 22 performs a reception process on the packet stored closest to the start address, that is, the first packet P1. On the other hand, when it is determined that “abnormality exists” in the packet confirmation process, the control unit 22 transmits to the personal computer 5 data indicating which packet is abnormal, as will be described in detail later.

さて、制御部22は、受信処理において、パケットP1のデータ部D1の内容を解析し、その解析により得られた制御内容(コマンド)に応じた所定の動作を実行する。この受信処理が完了したパケットP1は、パケット格納用メモリ21内から消去され、次のパケットP2が開始アドレス側に移動される。すなわち、図3(b)に示すように、パケットP1の受信処理が終了した後は、次のパケットP2が最も開始アドレスに近いところに格納された状態となる。その後、パケットP2に対する受信処理が行われ、以降は、格納された全てのパケットに対する受信処理が完了するまで、同様の処理が繰り返し行われる。   Now, in the reception process, the control unit 22 analyzes the content of the data portion D1 of the packet P1, and executes a predetermined operation according to the control content (command) obtained by the analysis. The packet P1 for which the reception process has been completed is erased from the packet storage memory 21, and the next packet P2 is moved to the start address side. That is, as shown in FIG. 3B, after the reception process of the packet P1 is completed, the next packet P2 is stored in a place closest to the start address. Thereafter, reception processing for the packet P2 is performed, and thereafter, similar processing is repeatedly performed until reception processing for all stored packets is completed.

次に、パケット確認処理の内容について図4〜図7も参照して説明する。
図4は、制御部22によるパケット確認処理の内容を示すフローチャートである。まず、受信したパケットが、図3(a)に示すように、正規のデータ構造を有している場合におけるパケット確認処理の流れについて説明する。パケット確認処理が開始されると、パケットP1〜P4が格納されているアドレスのうち、最後尾のアドレス、つまり最も終了アドレスに近いアドレスであるパケットP4のフッタF4の最後のビットが格納されたアドレスに移動する(ステップA1)。なお、ここで言う「移動」とは、制御部22がパケット格納用メモリ21からデータを読み出して確認するアドレスを変化させることを表している。続くステップA2では、この時点での移動先のアドレスが基準アドレスとして記憶される。この場合、フッタF4の最後のビットが格納されたアドレスが基準アドレスとして記憶される。
Next, the contents of the packet confirmation process will be described with reference to FIGS.
FIG. 4 is a flowchart showing the contents of the packet confirmation processing by the control unit 22. First, the flow of packet confirmation processing when the received packet has a regular data structure as shown in FIG. When the packet confirmation process is started, the address at which the last bit of the footer F4 of the packet P4, which is the address closest to the end address among the addresses where the packets P1 to P4 are stored, is stored. (Step A1). Here, “move” means that the control unit 22 changes the address that is read from the packet storage memory 21 and checked. In the subsequent step A2, the destination address at this point is stored as a reference address. In this case, the address where the last bit of the footer F4 is stored is stored as the reference address.

続くステップA3では、最後尾のアドレスからパケットの最小データサイズ分だけ遡る。つまり、最後尾のアドレスから本実施形態におけるパケットPの最小データサイズ分だけ開始アドレス側に移動する。なお、パケットPの最小データサイズとは、ヘッダHのデータ長(固定)、メッセージ長Mのデータ長(固定)、データ部Dのデータ長(可変)およびフッタFのデータ長(固定)を全て加算したものである。ただし、データ部Dのデータ長は、想定される最も小さい値(例えば0バイト)とする。続くステップA4では、移動した先のアドレス(遡ったアドレス)がパケット格納用メモリ21の開始アドレスを超えたか否かが判断される。   In the subsequent step A3, the packet is traced back from the last address by the minimum data size of the packet. That is, it moves to the start address side by the minimum data size of the packet P in this embodiment from the last address. The minimum data size of the packet P includes all the data length of the header H (fixed), the data length of the message length M (fixed), the data length of the data part D (variable), and the data length of the footer F (fixed). It is an addition. However, the data length of the data part D is assumed to be the smallest possible value (for example, 0 bytes). In the subsequent step A4, it is determined whether or not the moved destination address (the retroactive address) has exceeded the start address of the packet storage memory 21.

この場合、受信したパケットが全て正規のデータ構造を有しているため、開始アドレスを超えることはなく、ステップA4では「NO」となり、ステップA5に進む。ステップA5では、その移動先のアドレスから始まるデータがヘッダであるか否かが判断される。データ部Dが特にコマンドを表さないものであり、そのデータ長が0バイトであった場合には移動先のアドレスから始まるデータはヘッダであるため(YES)、ステップA7に進む。一方、データ部Dが何らかのコマンドを表すものであり、そのデータ長が0バイトを超える場合には移動先のアドレスから始まるデータはヘッダではないため(NO)、ステップA6に進む。ステップA6では、さらに1バイトだけ開始アドレス側に移動してステップA4に戻る。その後、移動先のアドレスから始まるデータがヘッダとなるまで(ステップA5で「YES」となるまで)、つまりヘッダが見つかるまでステップA4〜A6が繰り返し実行される。   In this case, since all received packets have a regular data structure, the start address is not exceeded, and “NO” is determined in the step A4, and the process proceeds to the step A5. In step A5, it is determined whether or not the data starting from the destination address is a header. If the data part D does not particularly represent a command and the data length is 0 byte, the data starting from the destination address is a header (YES), so the process proceeds to step A7. On the other hand, if the data part D represents some command and the data length exceeds 0 bytes, the data starting from the destination address is not a header (NO), so the process proceeds to step A6. In step A6, the program further moves to the start address side by 1 byte and returns to step A4. Thereafter, steps A4 to A6 are repeatedly executed until the data starting from the destination address becomes the header (until “YES” in step A5), that is, until the header is found.

ステップA4〜A6が繰り返し実行された結果、移動先のアドレスから始まるデータがヘッダであることが確認されると(ステップA5で「YES」になると)、ステップA7に進む。ステップA7では、ヘッダH4の後ろに位置するメッセージ長M4のデータを取得し、ステップA8に進む。ステップA8では、移動先のアドレス(ヘッダH4が格納されたアドレスであり、ヘッダアドレスに相当)と、メッセージ長M4が表すパケットP4のデータ長とからフッタF4のアドレス(フッタアドレスに相当)を求め、ステップA9に進む。ステップA9では、ステップA8で求めたアドレスに格納されたデータが実際にフッタであるか否かが判断される。この場合、全てのパケットが正規のデータ構造を有しているため、求めたアドレスと実際のフッタF4のアドレスとは一致している。従って、求めたアドレスに格納されたデータはフッタF4であるため(YES)、ステップA10に進む。   As a result of the repeated execution of steps A4 to A6, if it is confirmed that the data starting from the destination address is a header ("YES" in step A5), the process proceeds to step A7. In step A7, data of the message length M4 located after the header H4 is acquired, and the process proceeds to step A8. In step A8, the address of the footer F4 (corresponding to the footer address) is obtained from the destination address (the address where the header H4 is stored and corresponding to the header address) and the data length of the packet P4 represented by the message length M4. The process proceeds to step A9. In step A9, it is determined whether or not the data stored at the address obtained in step A8 is actually a footer. In this case, since all packets have a regular data structure, the obtained address matches the actual footer F4 address. Accordingly, since the data stored at the obtained address is the footer F4 (YES), the process proceeds to step A10.

ステップA10では、ステップA2で求めた基準アドレスからステップA5で求めたヘッダH4の開始アドレスまでの移動量(データ長)と、メッセージ長M4が表すデータ長とが一致するか否かが判断される。この場合、全てのパケットが正規のデータ構造を有しているため、上記移動量とデータ長とが一致するので(YES)、ステップA11に進む。ステップA11では、パケットP4が正常である(正規のデータ構造を有している)と判断されてパケットP4のシリアル番号S4が記憶され、ステップA12に進む。   In step A10, it is determined whether or not the movement amount (data length) from the reference address obtained in step A2 to the start address of the header H4 obtained in step A5 matches the data length represented by the message length M4. . In this case, since all packets have a regular data structure, the amount of movement matches the data length (YES), the process proceeds to step A11. In step A11, it is determined that the packet P4 is normal (has a regular data structure), the serial number S4 of the packet P4 is stored, and the process proceeds to step A12.

ステップA12では、さらに1バイトだけ開始アドレス側に移動してステップA2に戻る。この場合、パケットP4よりも1つ前のパケットであるパケットP3のフッタF3の最後のビットが格納されたアドレスに移動してステップA2に戻る。その後、パケットP3、P2、P1について、上記したパケットP1の場合と同様の手順で異常がないか否かが確認される(ステップA2〜A12)。そして、パケットP1が正常であることが確認された後、ステップA12でさらに1バイトだけ遡ると、移動先のアドレスはパケット格納用メモリ21の開始アドレスを超える。従って、ステップA4で「YES」となり、ステップA13に進む。ステップA13では通知処理が行われ、その後に処理終了となる。この通知処理では、正常であると判断されたパケットP4〜P1のシリアル番号S4〜S1が、正常に受信した旨を表すデータとともにパソコン5に送信される。なお、この通知処理では、上記シリアル番号S4〜S1のうち任意のシリアル番号のみを送信してもよい。すなわち、例えば先頭のパケットP1のシリアル番号S1や、最後尾のパケットP4のシリアル番号S4のみを送信してもよい。   In step A12, the program further moves to the start address side by 1 byte and returns to step A2. In this case, the process moves to the address where the last bit of the footer F3 of the packet P3, which is the packet immediately before the packet P4, is stored, and returns to step A2. Thereafter, it is confirmed whether or not there is an abnormality in the packets P3, P2, and P1 by the same procedure as that of the packet P1 described above (steps A2 to A12). Then, after it is confirmed that the packet P1 is normal, the destination address exceeds the start address of the packet storage memory 21 when going back one more byte in step A12. Accordingly, “YES” is determined in the step A4, and the process proceeds to the step A13. In step A13, a notification process is performed, and then the process ends. In this notification process, the serial numbers S4 to S1 of the packets P4 to P1 determined to be normal are transmitted to the personal computer 5 together with data indicating that the packets are normally received. In this notification process, only an arbitrary serial number among the serial numbers S4 to S1 may be transmitted. That is, for example, only the serial number S1 of the first packet P1 or the serial number S4 of the last packet P4 may be transmitted.

続いて、受信したパケットが正規のデータ構造を有していなかった場合におけるパケット確認処理の流れについて説明する。ここでは、下記の3通りのパターンについて説明する。
(1)ヘッダが存在しない場合
図5は、2番目に受信したパケットP2にヘッダ(H2)が存在しなかったパターンを示している。図5に示すようなヘッダ(H2)が存在しないパケットP2を含む3つのパケットP1〜P3を受信した場合のパケット確認処理の流れは以下のとおりとなる。すなわち、図4のパケット確認処理が開始され、最初にステップA1〜A10が実行された結果、パケット格納用メモリ21の最終アドレスに最も近いところに格納されたパケットP3が正常であることが確認される(ステップA9、A10でいずれも「YES」)。
Next, the flow of packet confirmation processing when the received packet does not have a regular data structure will be described. Here, the following three patterns will be described.
(1) When there is no header FIG. 5 shows a pattern in which the header (H2) does not exist in the second received packet P2. The flow of packet confirmation processing when receiving three packets P1 to P3 including a packet P2 having no header (H2) as shown in FIG. 5 is as follows. That is, the packet confirmation process of FIG. 4 is started, and as a result of first executing steps A1 to A10, it is confirmed that the packet P3 stored at the location closest to the final address of the packet storage memory 21 is normal. (Both “YES” in steps A9 and A10).

続くステップA11では、パケットP3のシリアル番号S3が記憶され、ステップA12に進む。ステップA12では、パケットP3よりも1つ前のパケットであるパケットP2のフッタF2の最後のビットが格納されたアドレスに移動し、ステップA2に戻る。ステップA2では、この時点での移動先のアドレスが基準アドレスとして記憶される。この場合、フッタF2の最後のビットが格納されたアドレスが基準アドレスとして記憶され、ステップA3に進む。   In the subsequent step A11, the serial number S3 of the packet P3 is stored, and the process proceeds to step A12. In step A12, the process moves to the address where the last bit of the footer F2 of the packet P2, which is the packet immediately before the packet P3, is stored, and the process returns to step A2. In step A2, the destination address at this point is stored as a reference address. In this case, the address where the last bit of the footer F2 is stored is stored as the reference address, and the process proceeds to Step A3.

ステップA3では、パケットの最小データサイズ分だけ遡り、ステップA4に進む。その後、移動先のアドレスから始まるデータがヘッダであることが確認されるまで、ステップA4〜A6が繰り返される。しかし、この場合、パケットP2にはヘッダが存在しない。このため、移動先のアドレスから始まるデータがヘッダであることが確認されるのは、パケットP1のヘッダH1の最初のビットが格納されたアドレス(=開始アドレス)まで移動したときである。つまり、パケットP2のヘッダを探していたはずが、パケットP1のヘッダを発見してしまったことになる。   In step A3, the process goes back by the minimum data size of the packet and proceeds to step A4. Thereafter, steps A4 to A6 are repeated until it is confirmed that the data starting from the destination address is a header. In this case, however, the packet P2 has no header. For this reason, it is confirmed that the data starting from the destination address is the header when the data has moved to the address (= start address) where the first bit of the header H1 of the packet P1 is stored. That is, although it should have been searching for the header of the packet P2, it has found the header of the packet P1.

このように、移動先のアドレスから開始されるデータがヘッダH1であることが確認されると(ステップA5で「YES」)、ステップA7に進む。ステップA7では、ヘッダH1の後ろに位置するメッセージ長M1のデータを取得し、ステップA8に進む。ステップA8では、移動先のアドレス(ヘッダH1が格納されたアドレス)と、メッセージ長M1が表すパケットP1のデータ長とからフッタF1のアドレスを求め、ステップA9に進む。   Thus, when it is confirmed that the data starting from the destination address is the header H1 (“YES” in step A5), the process proceeds to step A7. In step A7, data of the message length M1 located after the header H1 is acquired, and the process proceeds to step A8. In step A8, the address of the footer F1 is obtained from the destination address (address where the header H1 is stored) and the data length of the packet P1 represented by the message length M1, and the process proceeds to step A9.

ステップA9では、ステップA8で求めたアドレスに格納されたデータが、実際にフッタであるか否かを判断する。この場合、ステップA8で求めたアドレスにはパケットP1のフッタF1が格納されている。従って、ステップA8で求めたアドレスにフッタが格納されていると判断され(YES)、ステップA10に進む。   In step A9, it is determined whether or not the data stored at the address obtained in step A8 is actually a footer. In this case, the footer F1 of the packet P1 is stored at the address obtained in step A8. Accordingly, it is determined that the footer is stored at the address obtained in step A8 (YES), and the process proceeds to step A10.

ステップA10では、ステップA2で記憶した基準アドレスから、ステップA5で求めたヘッダH1の開始アドレスまでの移動量(データ長)と、メッセージ長M1が表すデータ長とが一致するか否かが判断される。この場合、上記移動量は、フッタF2の最後のビットが格納されたアドレスからヘッダH1の最初のビットが格納されたアドレスまでのデータ長となる。つまり、上記移動量は、パケットP2全体のデータ長とパケットP1全体のデータ長とを加算した長さとなる。一方、メッセージ長M1が表すデータ長は、パケットP1全体のデータ長である。このため、上記移動量とデータ長とが一致しないと判断し(ステップA10で「NO」)、ステップA14に進む。   In step A10, it is determined whether or not the movement amount (data length) from the reference address stored in step A2 to the start address of the header H1 obtained in step A5 matches the data length represented by the message length M1. The In this case, the movement amount is the data length from the address where the last bit of the footer F2 is stored to the address where the first bit of the header H1 is stored. That is, the movement amount is a length obtained by adding the data length of the entire packet P2 and the data length of the entire packet P1. On the other hand, the data length represented by the message length M1 is the data length of the entire packet P1. Therefore, it is determined that the amount of movement does not match the data length (“NO” in step A10), and the process proceeds to step A14.

ステップA14では、上記移動量が、メッセージ長M1の表すデータ長よりも長いか否かが判断される。この場合、上記移動量は、メッセージ長M1が表すデータ長よりも長いと判断され(YES)、ステップA15に進む。ステップA15では、メッセージ長M1を含むパケットP1が正常であるとともに、パケットP1より1つ前のパケット(P2)が異常であると判断される。また、この際、パケットP1のシリアル番号S1を記憶する。そして、ステップA13の通知処理が行われた後、処理終了となる。この通知処理では、パケットP3、P1のシリアル番号S3、S1が正常に受信した旨を表すデータとともにパソコン5に送信される。また、この際、パケットP1の1つ後に受信したパケット(P2)が異常であるという内容を表す異常データもパソコン5に送信される。   In step A14, it is determined whether the amount of movement is longer than the data length represented by the message length M1. In this case, it is determined that the moving amount is longer than the data length represented by the message length M1 (YES), and the process proceeds to step A15. In step A15, it is determined that the packet P1 including the message length M1 is normal and the packet (P2) immediately before the packet P1 is abnormal. At this time, the serial number S1 of the packet P1 is stored. Then, after the notification process in step A13 is performed, the process ends. In this notification process, the serial numbers S3 and S1 of the packets P3 and P1 are transmitted to the personal computer 5 together with data indicating that the packets are normally received. At this time, abnormal data indicating that the packet (P2) received immediately after the packet P1 is abnormal is also transmitted to the personal computer 5.

(2)フッタが存在しない場合
図6は、2番目に受信したパケットP2にフッタF2が存在しなかったパターンを示している。図6に示すようなフッタF2が存在しないパケットP2を含む3つのパケットP1〜P3を受信した場合のパケット確認処理の流れは以下のとおりとなる。すなわち、図4のパケット確認処理が開始され、最初にステップA1〜A10が実行された結果、パケット格納用メモリ21の最終アドレスに最も近いところに格納されたパケットP3が正常であることが確認される(ステップA9、A10でいずれも「YES」)。
(2) When no footer exists FIG. 6 shows a pattern in which the footer F2 does not exist in the second received packet P2. The flow of the packet confirmation process when receiving three packets P1 to P3 including the packet P2 without the footer F2 as shown in FIG. 6 is as follows. That is, the packet confirmation process of FIG. 4 is started, and as a result of first executing steps A1 to A10, it is confirmed that the packet P3 stored at the location closest to the final address of the packet storage memory 21 is normal. (Both “YES” in steps A9 and A10).

続くステップA11では、パケットP3のシリアル番号S3が記憶され、ステップA12に進む。ステップA12では、パケットP3よりも1つ前のパケットであるパケットP2のデータ部D2の最後のビットが格納されたアドレスに移動し、ステップA2に戻る。ステップA2では、データ部D2の最後のビットが格納されたアドレスが基準アドレスとして記憶され、ステップA3に進む。   In the subsequent step A11, the serial number S3 of the packet P3 is stored, and the process proceeds to step A12. In step A12, the process moves to the address where the last bit of the data part D2 of the packet P2, which is the packet immediately before the packet P3, is stored, and the process returns to step A2. In step A2, the address where the last bit of the data part D2 is stored is stored as a reference address, and the process proceeds to step A3.

ステップA3では、パケットの最小データサイズ分だけ遡り、ステップA4に進む。その後、移動先のアドレスから始まるデータがヘッダであることが確認されるまで、ステップA4〜A6が繰り返される。その結果、移動先のアドレスから開始されるデータがヘッダH2であることが確認されると(ステップA5で「YES」)、ステップA7に進む。ステップA7では、ヘッダH2の後ろに位置するメッセージ長M2のデータを取得し、ステップA8に進む。ステップA8では、ヘッダH2が格納されたアドレスと、メッセージ長M2が表すパケットP2のデータ長とからフッタF2のアドレスを求め、ステップA9に進む。   In step A3, the process goes back by the minimum data size of the packet and proceeds to step A4. Thereafter, steps A4 to A6 are repeated until it is confirmed that the data starting from the destination address is a header. As a result, if it is confirmed that the data starting from the destination address is the header H2 (“YES” in step A5), the process proceeds to step A7. In step A7, data of the message length M2 located after the header H2 is acquired, and the process proceeds to step A8. In step A8, the address of the footer F2 is obtained from the address where the header H2 is stored and the data length of the packet P2 represented by the message length M2, and the process proceeds to step A9.

ステップA9では、ステップA8で求めたアドレスに格納されたデータが、実際にフッタであるか否かが判断される。この場合、パケットP2にはフッタが存在せず、ステップA8で求めたアドレスにはデータ部D2の一部が格納されている。従って、ステップA8で求めたアドレスにフッタが格納されていないと判断され(NO)、ステップA6に進む。ステップA6では、パケットP2よりも1つ前のパケットであるパケットP1のフッタF1の最後のビットが格納されたアドレスに移動し、ステップA4に戻る。その後、移動先のアドレスから始まるデータがヘッダであることが確認されるまで、つまり次のヘッダが見つかるまでステップA4〜A6が繰り返し実行される。   In step A9, it is determined whether or not the data stored at the address obtained in step A8 is actually a footer. In this case, there is no footer in the packet P2, and a part of the data part D2 is stored at the address obtained in step A8. Therefore, it is determined that the footer is not stored at the address obtained in step A8 (NO), and the process proceeds to step A6. In step A6, the process moves to the address where the last bit of the footer F1 of the packet P1, which is the packet immediately before the packet P2, is stored, and returns to step A4. Thereafter, steps A4 to A6 are repeatedly executed until it is confirmed that the data starting from the destination address is a header, that is, until the next header is found.

ステップA4〜A6が繰り返し実行された結果、移動先のアドレスから開始されるデータがヘッダH1であることが確認されると(ステップA5で「YES」)、ステップA7に進む。ステップA7では、ヘッダH1の後ろに位置するメッセージ長M1のデータを取得し、ステップA8に進む。ステップA8では、ヘッダH1が格納されたアドレスと、メッセージ長M1が表すパケットP1のデータ長とからフッタF1のアドレスを求め、ステップA9に進む。この場合、ステップA8で求めたアドレスにはパケットP1のフッタF1が格納されている。従って、ステップA9では、ステップA8で求めたアドレスにフッタが格納されていると判断され(YES)、ステップA10に進む。   As a result of the repeated execution of steps A4 to A6, if it is confirmed that the data starting from the destination address is the header H1 (“YES” in step A5), the process proceeds to step A7. In step A7, data of the message length M1 located after the header H1 is acquired, and the process proceeds to step A8. In step A8, the address of the footer F1 is obtained from the address where the header H1 is stored and the data length of the packet P1 represented by the message length M1, and the process proceeds to step A9. In this case, the footer F1 of the packet P1 is stored at the address obtained in step A8. Accordingly, in step A9, it is determined that the footer is stored at the address obtained in step A8 (YES), and the process proceeds to step A10.

ステップA10では、ステップA2で記憶した基準アドレスから、ステップA5で求めたヘッダH1の開始アドレスまでの移動量(データ長)と、メッセージ長M1が表すデータ長とが一致するか否かを判断する。この場合、上記移動量は、データ部D2の最後のビットが格納されたアドレスからヘッダH1の最初のビットが格納されたアドレスまでのデータ長となる。つまり、上記移動量は、パケットP2全体のデータ長とパケットP1全体のデータ長とを加算した長さとなる。一方、メッセージ長M1が表すデータ長は、パケットP1全体のデータ長である。このため、上記移動量とデータ長とが一致しないと判断され(ステップA10で「NO」)、ステップA14に進む。   In Step A10, it is determined whether or not the movement amount (data length) from the reference address stored in Step A2 to the start address of the header H1 obtained in Step A5 matches the data length represented by the message length M1. . In this case, the amount of movement is the data length from the address where the last bit of the data part D2 is stored to the address where the first bit of the header H1 is stored. That is, the movement amount is a length obtained by adding the data length of the entire packet P2 and the data length of the entire packet P1. On the other hand, the data length represented by the message length M1 is the data length of the entire packet P1. Therefore, it is determined that the amount of movement does not match the data length (“NO” in step A10), and the process proceeds to step A14.

ステップA14では、上記移動量が、メッセージ長M1が表すデータ長よりも長いと判断され(YES)、ステップA15に進む。ステップA15では、メッセージ長M1を含むパケットP1が正常であるとともに、パケットP1より1つ前のパケット(P2)が異常であると判断される。また、この際、パケットP1のシリアル番号S1が記憶される。そして、ステップA13の通知処理を行われた後、処理終了となる。この通知処理では、パケットP3、P1のシリアル番号S3、S1が正常に受信した旨を表すデータとともにパソコン5に送信される。また、この際、パケットP1の1つ後に受信したパケット(P2)が異常であるという内容を表す異常データもパソコン5に送信される。   In step A14, it is determined that the amount of movement is longer than the data length represented by the message length M1 (YES), and the process proceeds to step A15. In step A15, it is determined that the packet P1 including the message length M1 is normal and the packet (P2) immediately before the packet P1 is abnormal. At this time, the serial number S1 of the packet P1 is stored. Then, after the notification process in step A13 is performed, the process ends. In this notification process, the serial numbers S3 and S1 of the packets P3 and P1 are transmitted to the personal computer 5 together with data indicating that the packets are normally received. At this time, abnormal data indicating that the packet (P2) received immediately after the packet P1 is abnormal is also transmitted to the personal computer 5.

(3)メッセージ長が一致しない場合
図7は、2番目に受信したパケットP2のメッセージ長M2が誤ったデータ(パケットP2全体のデータ長を正しく表していないデータ)であるパターンを示している。図7に示すようなメッセージ長M2が誤ったデータであるパケットP2を含む3つのパケットP1〜P3を受信した場合のパケット確認処理の流れは以下のとおりとなる。すなわち、図4のパケット確認処理が開始され、最初にステップA1〜A10が実行された結果、パケット格納用メモリ21の最終アドレスに最も近いところに格納されたパケットP3が正常であることが確認される(ステップA9、A10でいずれも「YES」)。
(3) When the message lengths do not match FIG. 7 shows a pattern in which the message length M2 of the second received packet P2 is incorrect data (data that does not correctly represent the data length of the entire packet P2). The flow of packet confirmation processing when receiving three packets P1 to P3 including a packet P2 whose message length M2 is incorrect data as shown in FIG. 7 is as follows. That is, the packet confirmation process of FIG. 4 is started, and as a result of first executing steps A1 to A10, it is confirmed that the packet P3 stored at the location closest to the final address of the packet storage memory 21 is normal. (Both “YES” in steps A9 and A10).

続くステップA11では、パケットP3のシリアル番号S3が記憶され、ステップA12に進む。ステップA12では、パケットP3よりも1つ前のパケットであるパケットP2のフッタF2の最後のビットが格納されたアドレスに移動し、ステップA2に戻る。ステップA2では、フッタF2の最後のビットが格納されたアドレスが基準アドレスとして記憶され、ステップA3に進む。   In the subsequent step A11, the serial number S3 of the packet P3 is stored, and the process proceeds to step A12. In step A12, the process moves to the address where the last bit of the footer F2 of the packet P2, which is the packet immediately before the packet P3, is stored, and the process returns to step A2. In step A2, the address where the last bit of the footer F2 is stored is stored as the reference address, and the process proceeds to step A3.

ステップA3では、パケットの最小データサイズ分だけ遡り、ステップA4に進む。その後、移動先のアドレスから始まるデータがヘッダであることが確認されるまで、ステップA4〜A6が繰り返される。その結果、移動先のアドレスから開始されるデータがヘッダH2であることが確認されると(ステップA5で「YES」)、ステップA7に進む。ステップA7では、ヘッダH2の後ろに位置するメッセージ長M2のデータを取得し、ステップA8に進む。ステップA8では、ヘッダH2が格納されたアドレスと、メッセージ長M2が表すパケットP2のデータ長とからフッタF2のアドレスを求め、ステップA9に進む。   In step A3, the process goes back by the minimum data size of the packet and proceeds to step A4. Thereafter, steps A4 to A6 are repeated until it is confirmed that the data starting from the destination address is a header. As a result, if it is confirmed that the data starting from the destination address is the header H2 (“YES” in step A5), the process proceeds to step A7. In step A7, data of the message length M2 located after the header H2 is acquired, and the process proceeds to step A8. In step A8, the address of the footer F2 is obtained from the address where the header H2 is stored and the data length of the packet P2 represented by the message length M2, and the process proceeds to step A9.

ステップA9では、ステップA8で求めたアドレスに格納されたデータが、実際にフッタであるか否かが判断される。この場合、メッセージ長M2が誤ったデータであるため、ステップA8で求めたアドレスにはフッタF2は格納されていない。従って、ステップA8で求めたアドレスにフッタが格納されていないと判断され(NO)、ステップA6に進む。ステップA6では、パケットP2よりも1つ前のパケットであるパケットP1のフッタF1の最後のビットが格納されたアドレスに移動し、ステップA4に戻る。その後、移動先のアドレスから始まるデータがヘッダであることが確認されるまで、つまり次のヘッダが見つかるまでステップA4〜A6が繰り返し実行される。   In step A9, it is determined whether or not the data stored at the address obtained in step A8 is actually a footer. In this case, since the message length M2 is incorrect data, the footer F2 is not stored in the address obtained in step A8. Therefore, it is determined that the footer is not stored at the address obtained in step A8 (NO), and the process proceeds to step A6. In step A6, the process moves to the address where the last bit of the footer F1 of the packet P1, which is the packet immediately before the packet P2, is stored, and returns to step A4. Thereafter, steps A4 to A6 are repeatedly executed until it is confirmed that the data starting from the destination address is a header, that is, until the next header is found.

ステップA4〜A6が繰り返し実行された結果、移動先のアドレスから開始されるデータがヘッダH1であることが確認されると(ステップA5で「YES」)、ステップA7に進む。ステップA7では、ヘッダH1の後ろに位置するメッセージ長M1のデータを取得し、ステップA8に進む。ステップA8では、ヘッダH1が格納されたアドレスと、メッセージ長M1が表すパケットP1のデータ長とからフッタF1のアドレスを求め、ステップA9に進む。この場合、ステップA8で求めたアドレスにはパケットP1のフッタF1が格納されている。従って、ステップA9では、ステップA8で求めたアドレスにフッタが格納されていると判断され(YES)、ステップA10に進む。   As a result of the repeated execution of steps A4 to A6, if it is confirmed that the data starting from the destination address is the header H1 (“YES” in step A5), the process proceeds to step A7. In step A7, data of the message length M1 located after the header H1 is acquired, and the process proceeds to step A8. In step A8, the address of the footer F1 is obtained from the address where the header H1 is stored and the data length of the packet P1 represented by the message length M1, and the process proceeds to step A9. In this case, the footer F1 of the packet P1 is stored at the address obtained in step A8. Accordingly, in step A9, it is determined that the footer is stored at the address obtained in step A8 (YES), and the process proceeds to step A10.

ステップA10では、ステップA2で記憶した基準アドレスから、ステップA5で求めたヘッダH1の開始アドレスまでの移動量(データ長)と、メッセージ長M1が表すデータ長とが一致するか否かが判断される。この場合、上記移動量は、データ部D2の最後のビットが格納されたアドレスからヘッダH1の最初のビットが格納されたアドレスまでのデータ長となる。つまり、上記移動量は、パケットP2全体のデータ長とパケットP1全体のデータ長とを加算した長さとなる。一方、メッセージ長M1が表すデータ長は、パケットP1全体のデータ長である。このため、上記移動量とデータ長とが一致しないと判断され(ステップA10で「NO」)、ステップA14に進む。   In step A10, it is determined whether or not the movement amount (data length) from the reference address stored in step A2 to the start address of the header H1 obtained in step A5 matches the data length represented by the message length M1. The In this case, the amount of movement is the data length from the address where the last bit of the data part D2 is stored to the address where the first bit of the header H1 is stored. That is, the movement amount is a length obtained by adding the data length of the entire packet P2 and the data length of the entire packet P1. On the other hand, the data length represented by the message length M1 is the data length of the entire packet P1. Therefore, it is determined that the amount of movement does not match the data length (“NO” in step A10), and the process proceeds to step A14.

ステップA14では、上記移動量が、メッセージ長M1が表すデータ長よりも長いと判断され(YES)、ステップA15に進む。ステップA15では、メッセージ長M1を含むパケットP1が正常であるとともに、パケットP1より1つ前のパケット(P2)が異常であると判断される。また、この際、パケットP1のシリアル番号S1が記憶される。そして、ステップA13の通知処理を行われた後、処理終了となる。この通知処理では、パケットP3、P1のシリアル番号S3、S1が正常に受信した旨を表すデータとともにパソコン5に送信される。また、この際、パケットP1の1つ後に受信したパケット(P2)が異常であるという内容を表す異常データもパソコン5に送信される。   In step A14, it is determined that the amount of movement is longer than the data length represented by the message length M1 (YES), and the process proceeds to step A15. In step A15, it is determined that the packet P1 including the message length M1 is normal and the packet (P2) immediately before the packet P1 is abnormal. At this time, the serial number S1 of the packet P1 is stored. Then, after the notification process in step A13 is performed, the process ends. In this notification process, the serial numbers S3 and S1 of the packets P3 and P1 are transmitted to the personal computer 5 together with data indicating that the packets are normally received. At this time, abnormal data indicating that the packet (P2) received immediately after the packet P1 is abnormal is also transmitted to the personal computer 5.

なお、上記(1)〜(3)のケースおよび全パケットが正規のデータ構造を有しているケースのいずれにおいても、ヘッダと同じデータが例えばデータ部などに存在した場合には、ステップA5の判断においてヘッダではないデータをヘッダであると誤判定する可能性がある。しかし、このような場合、通常は、その誤判定したヘッダの後ろにはメッセージ長が存在しないため、ステップA9の判断において「NO」になる。これにより、正規のヘッダを見つけるまでステップA4〜A6が繰り返し実行される。   In any of the above cases (1) to (3) and the case where all packets have a regular data structure, if the same data as the header is present in the data portion, for example, step A5 There is a possibility that data that is not a header is erroneously determined to be a header in the determination. However, in such a case, since there is usually no message length behind the erroneously determined header, “NO” is determined in the determination of step A9. Thus, steps A4 to A6 are repeatedly executed until a regular header is found.

ただし、上記誤判定したヘッダの後ろのデータが偶然にもデータ長と同形式のデータであり、ステップA8においてこれらから求められるアドレスに偶然にもフッタが存在した場合には、誤って判断したヘッダに基づいてパケットのデータ構造が正しいか否かの判断が行われてしまう可能性がある。しかし、このような場合、基準アドレスから誤判定したヘッダの開始アドレスまでの移動量と、メッセージ長が表すデータ長とが一致しないため、ステップA10の判断で必ず「NO」となる。また、上記移動量は、メッセージ長が表すデータ長よりも短いため、続くステップA11の判断で「NO」となる。これにより、正規のヘッダを見つけるまでステップA4〜A6が繰り返し実行される。   However, if the data after the erroneously determined header is accidentally the data having the same format as the data length, and the footer is accidentally present at the address obtained from these in step A8, the erroneously determined header May determine whether the data structure of the packet is correct. However, in such a case, since the amount of movement from the reference address to the erroneously determined header start address does not match the data length represented by the message length, the determination in step A10 is always “NO”. Further, since the movement amount is shorter than the data length represented by the message length, “NO” is determined in the subsequent determination of Step A11. Thus, steps A4 to A6 are repeatedly executed until a regular header is found.

なお、本実施形態では、ステップA2〜A6がヘッダ探索処理に相当し、ステップA7が全データ長取得処理に相当し、ステップA8がフッタアドレス検出処理に相当し、ステップA9がフッタ確認処理に相当する。また、ステップA2〜A9が第1の確認処理に相当し、ステップA10、A14が第2の確認処理に相当し、ステップA11が正常データ記憶処理に相当し、ステップA15が異常データ記憶処理に相当し、ステップA13が通知処理に相当する。   In this embodiment, steps A2 to A6 correspond to header search processing, step A7 corresponds to total data length acquisition processing, step A8 corresponds to footer address detection processing, and step A9 corresponds to footer confirmation processing. To do. Steps A2 to A9 correspond to the first confirmation process, Steps A10 and A14 correspond to the second confirmation process, Step A11 corresponds to the normal data storage process, and Step A15 corresponds to the abnormal data storage process. Step A13 corresponds to notification processing.

以上説明したように、本実施形態によれば次のような効果が得られる。
パソコン5から送信されるパケットは、コントローラ3のパケット格納用メモリ21に一時的に格納される。コントローラ3の制御部22は、パケット格納用メモリ21に格納された全てのパケットに対してパケット確認処理を実行する。このパケット確認処理では、各パケットのそれぞれについて、個別に正常または異常という判断がなされる。そして、制御部22は、正常であると判断したパケットのシリアル番号を、正常に受信した旨を表すデータとともにパソコン5に送信する。正常でないと判断したパケットについては、そのシリアル番号を取得することができないし、また取得できたとしてもそれが正しいか否かは不明である。このため、制御部22は、正常でないと判断したパケットを、例えば正常であると判断したパケットの1つ後に受信したパケットという形で特定し、その旨を表す異常データをパソコン5に送信する。
As described above, according to the present embodiment, the following effects can be obtained.
Packets transmitted from the personal computer 5 are temporarily stored in the packet storage memory 21 of the controller 3. The control unit 22 of the controller 3 executes packet confirmation processing for all packets stored in the packet storage memory 21. In this packet confirmation process, each packet is individually judged as normal or abnormal. Then, the control unit 22 transmits the serial number of the packet determined to be normal to the personal computer 5 together with data indicating that the packet has been normally received. For a packet that is determined not to be normal, its serial number cannot be acquired, and even if it can be acquired, it is unknown whether it is correct. For this reason, the control unit 22 identifies the packet determined to be not normal, for example, in the form of a packet received immediately after the packet determined to be normal, and transmits abnormal data indicating that fact to the personal computer 5.

このように、本実施形態では、パソコン5から送信されたコマンドを適切に受信できなかった場合には、そのコマンドを構成するパケットのどこに問題があったか(どのパケットが異常であったか)を表すデータがパソコン5に送信されることになる。これにより、パソコン5を操作するユーザは、送信したコマンドに受信エラーが生じた場合、その送信したコマンドのうち、どの部分に問題があったのかを容易に把握することができ、以ってプログラムのデバッグ作業を容易に行い得るようになる。   As described above, in this embodiment, when the command transmitted from the personal computer 5 cannot be properly received, the data indicating where the problem occurred in the packet constituting the command (which packet was abnormal) is displayed. It is transmitted to the personal computer 5. As a result, when a reception error occurs in the transmitted command, the user operating the personal computer 5 can easily grasp which part of the transmitted command has a problem, and thus the program Can be easily debugged.

制御部22は、パケット確認処理を行う際、パケット格納用メモリ21の最終アドレスに最も近いところに格納された最後のパケットから順番に正常であるか否かの確認を行うようにしている。この理由について、先頭のパケット(開始アドレスに最も近いところに格納されたパケット)から順番にパケット確認処理を行う場合(以下、比較例と称す)と比較しながら説明する。図8は、比較例のパケット確認処理が行われる際におけるパケット格納用メモリ21の状態を示す図である。図9は、本実施形態のパケット確認処理が行われる際におけるパケット格納用メモリ21の状態を示す図である。   When performing the packet confirmation process, the control unit 22 confirms whether or not the packet is normal in order from the last packet stored at a location closest to the final address of the packet storage memory 21. The reason for this will be described in comparison with a case where packet confirmation processing is performed in order from the first packet (packet stored closest to the start address) (hereinafter referred to as a comparative example). FIG. 8 is a diagram illustrating a state of the packet storage memory 21 when the packet confirmation process of the comparative example is performed. FIG. 9 is a diagram illustrating a state of the packet storage memory 21 when the packet confirmation process of the present embodiment is performed.

比較例では、図8(a)に示すように、パケットP1、P2をこの順に受信した場合、パケットP1からチェックが行われる。このチェック中に、図8(b)に示すように、新たにパケットP3を受信すると、パケットP2の後にパケットP3が格納される。このため、このパケット確認処理は、パケットP3のチェックが終了するまで継続されることになる。さらに、このチェック中に、図8(c)に示すように、新たにパケットP4を受信すると、パケットP3の後ろにパケットP4が格納され、そのパケットP4のチェックが終了するまでパケット確認処理が継続することになる。従って、比較例の場合、所定のパケットに対するパケット確認処理が実行されている途中で新たにパケットを受信すると、その度にパケット確認処理の終了が先に延びることになる。このような場合、パケットを受信してから、そのパケットに対する受信処理が実行されるまでに長い時間を要してしまう可能性がある。つまり、パケットの受信から、そのパケットのデータ部が表す制御内容に基づくロボット2の動作制御が開始されるまでの遅延時間が長くなる可能性がある。   In the comparative example, as shown in FIG. 8A, when the packets P1 and P2 are received in this order, the check is performed from the packet P1. During this check, when a new packet P3 is received as shown in FIG. 8B, the packet P3 is stored after the packet P2. For this reason, this packet confirmation processing is continued until the check of the packet P3 is completed. Further, during this check, as shown in FIG. 8C, when a new packet P4 is received, the packet P4 is stored after the packet P3, and the packet confirmation process continues until the check of the packet P4 is completed. Will do. Therefore, in the case of the comparative example, when a new packet is received while the packet confirmation process for a predetermined packet is being performed, the end of the packet confirmation process is extended each time. In such a case, there is a possibility that it takes a long time from when a packet is received until reception processing for that packet is executed. That is, there is a possibility that the delay time from the reception of the packet to the start of the operation control of the robot 2 based on the control content represented by the data portion of the packet may be increased.

一方、本実施形態では、図9(a)に示すように、パケットP1、P2をこの順に受信した場合、パケットP2から先に正常であるか否かの確認(以下、チェックと称す)が行われる。このチェック中に、図9(b)に示すように、新たにパケットP3、P4をこの順に受信すると、パケットP2の後にパケットP3、P4の順に格納される。この場合、本実施形態のパケット確認処理では、新たに格納されたパケットP3、P4の影響を受けることなく、パケットP2のチェックが引き続き実行され、その後、パケットP1のチェックが行われる。   On the other hand, in the present embodiment, as shown in FIG. 9A, when packets P1 and P2 are received in this order, whether or not the packet P2 is normal is checked (hereinafter referred to as a check). Is called. During this check, when new packets P3 and P4 are received in this order as shown in FIG. 9B, the packets are stored in the order of packets P3 and P4 after the packet P2. In this case, in the packet confirmation processing of this embodiment, the packet P2 is continuously checked without being affected by the newly stored packets P3 and P4, and then the packet P1 is checked.

このように、パケットP1、P2のチェックが完了した後、その時点において、パケット格納用メモリ21に格納されているパケットのうち、未だチェックが行われていないパケットP3、P4に対するチェックが実行されることになる。従って、本実施形態のパケット確認処理は、所定のパケットに対するパケット確認処理が実行されると、当該パケットに対するチェックが完了し次第、パケット確認処理は一旦終了される。従って、この時点でパケット確認処理が完了しているパケットに対する受信処理を実行することが可能となる。このような構成によれば、パケットを受信してから、そのパケットに対する受信処理が実行されるまでに長い時間を要することなく、パケットの受信から、そのパケットのデータ部が表す制御内容に基づくロボット2の動作制御が開始されるまでの遅延時間を極力短くすることができる。   In this way, after the check of the packets P1 and P2 is completed, at that time, among the packets stored in the packet storage memory 21, the check is performed on the packets P3 and P4 that have not been checked yet. It will be. Therefore, in the packet confirmation process of the present embodiment, when the packet confirmation process for a predetermined packet is executed, the packet confirmation process is temporarily ended as soon as the check for the packet is completed. Therefore, it is possible to execute reception processing for a packet for which packet confirmation processing has been completed at this point. According to such a configuration, the robot based on the control content represented by the data portion of the packet from the reception of the packet without receiving a long time from the reception of the packet until the reception processing for the packet is executed. The delay time until the second operation control is started can be shortened as much as possible.

また、ヘッダ探索処理を実行する際、基準アドレスを記憶した後、基準アドレスから想定されるパケットの最小データサイズ分だけ開始アドレス側に一括して移動するように構成した。基準アドレス(パケットの最後尾のアドレス)からパケットの最小データサイズ分だけ開始アドレス側に移動した場合、そのパケットのデータサイズが最小のデータサイズであれば、移動先のアドレスにヘッダが存在する。また、そのパケットのデータサイズが最小のデータサイズよりも大であれば、移動先のアドレスは、ヘッダよりも後のデータ(メッセージ長、シリアル番号、データ部)が存在することになる。つまり、いずれにしても、そのパケットのヘッダを発見し損ねてしまうことはない。さらに、このように構成することで、基準アドレスから開始アドレス側に1バイトずつ移動してヘッダを探すだけの構成と比較して、ヘッダを発見するために要する制御部22の負荷を軽くできるとともに処理時間を短縮することができる。   In addition, when executing the header search process, after the reference address is stored, it is configured to move to the start address side as much as the minimum data size of the packet assumed from the reference address. When moving from the reference address (the last address of the packet) to the start address side by the minimum data size of the packet, if the data size of the packet is the minimum data size, a header exists at the destination address. If the data size of the packet is larger than the minimum data size, the destination address has data (message length, serial number, data portion) after the header. That is, in any case, the packet header is not missed. Furthermore, with this configuration, the load on the control unit 22 required to find the header can be reduced as compared with a configuration in which the header is searched by moving one byte at a time from the reference address to the start address side. Processing time can be shortened.

さて、いずれも正規のデータ構造を有していない2つのパケットを連続して受信した場合であって、これら2つが組み合わさると正規のデータ構造を有する1つのパケットとみなされる場合を考えてみる。例えば、ヘッダ、メッセージ長、シリアル番号のみを有するパケットPaの後にデータ部、フッタのみを有するパケットPbを受信した場合であって、パケットPaのメッセージ長が示すデータ長がパケットPa全体のデータ長とパケットPb全体のデータ長とを加算したものと同一であった場合には、結果的に1つの正規なデータ構造を有したパケットを受信したことと同じ状態になる。この場合には、本実施形態の構成では、各パケットPa、Pbに異常があることを検出できない。しかしながら、上記ケースは非常に稀な場合であって、通常はほとんど起こりえないため、問題とはならない。このため、本実施形態では、このような極めて稀なケースを対象とはしていない。   Now, let us consider a case in which two packets that do not have a regular data structure are received in succession, and when these two are combined, they are regarded as one packet having a regular data structure. . For example, when a packet Pb having only a data portion and a footer is received after a packet Pa having only a header, a message length, and a serial number, the data length indicated by the message length of the packet Pa is the data length of the entire packet Pa. If it is the same as the sum of the data length of the entire packet Pb, the result is the same as receiving a packet having one regular data structure. In this case, the configuration of the present embodiment cannot detect that there is an abnormality in each packet Pa and Pb. However, this is not a problem because the above cases are very rare and usually rarely occur. For this reason, this embodiment does not target such an extremely rare case.

なお、本発明は上記し且つ図面に記載した実施形態に限定されるものではなく、次のような変形または拡張が可能である。
パケットPのデータ構造としては、シリアル番号Sとデータ部Dとが入れ替わったものであってもよい。
図4におけるステップA14の判断ステップは、パケット内のヘッダ、フッタ以外の部分にヘッダ、フッタと同一のデータが偶然存在するといった稀なケースを想定する必要がない場合には省略可能である。この場合、ステップA10で「NO」の場合にステップA15に進むように構成すればよい。
図4におけるステップA3に代えて、基準アドレスから開始アドレス側に1バイト移動するステップを設けてもよい。
上記実施形態では、本発明を6軸の垂直多関節型のロボットの制御を行うコントローラ3に適用した例を説明したが、本発明は、外部から与えられる制御命令に従ってロボットの動作制御を行うロボットのコントローラ全般に適用可能である。
The present invention is not limited to the embodiment described above and illustrated in the drawings, and the following modifications or expansions are possible.
As the data structure of the packet P, the serial number S and the data part D may be interchanged.
The determination step of step A14 in FIG. 4 can be omitted when it is not necessary to assume a rare case where the same data as the header and footer exists in a part other than the header and footer in the packet. In this case, it may be configured to proceed to step A15 when “NO” in step A10.
Instead of step A3 in FIG. 4, a step of moving 1 byte from the reference address to the start address may be provided.
In the above embodiment, the example in which the present invention is applied to the controller 3 that controls the six-axis vertical articulated robot has been described. However, the present invention is a robot that controls the operation of the robot according to a control command given from the outside. It is applicable to all controllers.

図面中、2はロボット、3はコントローラ(ロボットのコントローラ)、21はパケット格納用メモリ、22は制御部を示す。   In the drawing, 2 is a robot, 3 is a controller (controller of the robot), 21 is a packet storage memory, and 22 is a control unit.

Claims (2)

外部から与えられる制御命令に従ってロボットの動作制御を行うロボットのコントローラであって、
前記制御命令は、所定のデータ構造を有するパケット単位で与えられるものであり、
前記パケットは、当該パケットの先頭に設けられた固定値のヘッダと、このヘッダの直後に設けられ当該パケットの全データ長を示すメッセージ長と、当該パケット毎に特有の値となるシリアル番号と、前記制御内容を示すデータ部と、当該パケットの最後尾に設けられた固定値のフッタとから構成され、
前記ヘッダ、前記メッセージ長、前記シリアル番号および前記フッタは固定長であり、
前記データ部は可変長であり、
前記パケットを一時的に格納するためのパケット格納用メモリと、
受信した前記パケットを受信した順に前記パケット格納用メモリの開始アドレスから終了アドレスに向けて順次格納させ、前記パケット格納用メモリに格納されたパケットが正常であるか否かを判断し、正常であると判断したパケットのデータ部が示す制御内容に基づいて前記ロボットの動作制御を行う制御部とを備え、
前記制御部は、
所定の基準アドレスから前記開始アドレスに向けて前記ヘッダを探索するヘッダ探索処理と、前記ヘッダ探索処理により前記ヘッダが発見されると当該ヘッダの直後に設けられた前記メッセージ長が示す前記全データ長を取得する全データ長取得処理と、前記ヘッダ探索処理により発見された前記ヘッダが格納されたヘッダアドレスおよび前記全データ長取得処理により取得された全データ長を用いて前記フッタが格納されたフッタアドレスを検出するフッタアドレス検出処理と、前記フッタアドレス検出処理により検出された前記フッタアドレスに前記フッタが存在するか否かを判断するフッタ確認処理とからなる第1の確認処理と、
前記基準アドレスから前記ヘッダアドレスの先頭アドレスまでのデータ長と前記全データ長取得処理により取得された前記全データ長とが一致するか否かを確認する第2の確認処理と、
前記フッタ確認処理により確認された前記フッタを含む前記パケットの前記シリアル番号を記憶する正常データ記憶処理と、
前記フッタ確認処理により確認された前記フッタを含む前記パケットの前記シリアル番号に基づいて当該シリアル番号を含む前記パケットの前記終了アドレス側の隣に格納された前記パケットが異常である旨を示す異常データを記憶する異常データ記憶処理と、
記憶された前記シリアル番号および前記異常データを外部に対して出力する通知処理とを実行可能に構成され、
前記制御部は、
前記パケット格納用メモリにパケットが格納されると、当該パケットの最後尾のアドレスを前記基準アドレスとした上で前記第1の確認処理を実行し、
前記第1の確認処理において、前記ヘッダ探索処理により前記開始アドレスを超えた場合には前記通知処理を実行し、前記フッタ確認処理により前記フッタが存在しないと判断された場合には前記発見したヘッダの前記ヘッダアドレスから前記開始アドレスに向けて前記ヘッダ探索処理を実行し、前記フッタ確認処理により前記フッタが存在すると判断された場合には前記第2の確認処理を実行し、
前記第2の確認処理において、前記データ長と前記全データ長とが一致すると判断された場合には前記正常データ記憶処理を実行し、前記データ長と前記全データ長とが一致しないと判断された場合には前記異常データ記憶処理を実行し、
前記正常データ記憶処理が実行されると、記憶した前記シリアル番号を含む前記パケットの前記ヘッダの先頭アドレスから前記開始アドレス側に向けて1アドレス進んだアドレスを前記基準アドレスとした上で前記第1の確認処理を実行し、
前記異常データ記憶処理が実行されると、前記通知処理を実行することを特徴とするロボットのコントローラ。
A controller for a robot that controls the operation of the robot according to a control command given from the outside,
The control command is given in packet units having a predetermined data structure,
The packet includes a fixed value header provided at the beginning of the packet, a message length indicating the total data length of the packet provided immediately after the header, a serial number that is a unique value for each packet, It is composed of a data part indicating the control content and a fixed value footer provided at the end of the packet,
The header, the message length, the serial number and the footer are fixed length,
The data portion is of variable length;
A packet storage memory for temporarily storing the packet;
The received packets are sequentially stored from the start address to the end address of the packet storage memory in the order received, and it is determined whether or not the packet stored in the packet storage memory is normal. A control unit that controls the operation of the robot based on the control content indicated by the data part of the packet determined as
The controller is
A header search process for searching the header from a predetermined reference address toward the start address, and the total data length indicated by the message length provided immediately after the header when the header is found by the header search process And a footer in which the footer is stored using the header address in which the header found in the header search process is stored and the total data length acquired in the total data length acquisition process. A first confirmation process comprising a footer address detection process for detecting an address and a footer confirmation process for determining whether or not the footer exists in the footer address detected by the footer address detection process;
A second confirmation process for confirming whether or not the data length from the reference address to the head address of the header address matches the total data length acquired by the total data length acquisition process;
A normal data storage process for storing the serial number of the packet including the footer confirmed by the footer confirmation process;
Abnormal data indicating that the packet stored next to the end address side of the packet including the serial number is abnormal based on the serial number of the packet including the footer confirmed by the footer confirmation processing Abnormal data storage processing for storing
The stored serial number and the notification process for outputting the abnormal data to the outside are configured to be executable.
The controller is
When a packet is stored in the packet storage memory, the first confirmation process is executed with the last address of the packet as the reference address,
In the first confirmation process, when the header search process exceeds the start address, the notification process is executed, and when the footer confirmation process determines that the footer does not exist, the found header The header search process is performed from the header address toward the start address, and when the footer confirmation process determines that the footer exists, the second confirmation process is performed.
In the second confirmation process, when it is determined that the data length and the total data length match, the normal data storage process is executed, and it is determined that the data length and the total data length do not match. If the error data storage process is executed,
When the normal data storage process is executed, an address that is advanced by one address from the start address of the header of the packet including the stored serial number toward the start address side is used as the reference address. Execute the confirmation process
A controller for a robot, wherein the notification process is executed when the abnormal data storage process is executed.
前記制御部は、前記第2の確認処理において、前記データ長と前記全データ長とが一致しないと判断されると、前記データ長が前記全データ長よりも大である場合には前記異常データ記憶処理を実行し、前記データ長が前記全データ長よりも小である場合には前記発見したヘッダの前記ヘッダアドレスから前記開始アドレスに向けて前記ヘッダ探索処理を実行することを特徴とする請求項1記載のロボットのコントローラ。   In the second confirmation process, when it is determined that the data length and the total data length do not match, the control unit determines that the abnormal data if the data length is greater than the total data length. A storage process is executed, and when the data length is smaller than the total data length, the header search process is executed from the header address of the found header toward the start address. Item 2. The robot controller according to item 1.
JP2010050446A 2010-03-08 2010-03-08 Robot controller Active JP5445233B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2010050446A JP5445233B2 (en) 2010-03-08 2010-03-08 Robot controller

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2010050446A JP5445233B2 (en) 2010-03-08 2010-03-08 Robot controller

Publications (2)

Publication Number Publication Date
JP2011183498A JP2011183498A (en) 2011-09-22
JP5445233B2 true JP5445233B2 (en) 2014-03-19

Family

ID=44790389

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2010050446A Active JP5445233B2 (en) 2010-03-08 2010-03-08 Robot controller

Country Status (1)

Country Link
JP (1) JP5445233B2 (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP6426781B2 (en) * 2017-03-08 2018-11-21 ファナック株式会社 Mechanical system

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPS6244808A (en) * 1985-08-23 1987-02-26 Amada Co Ltd Control method for nc working machine group
JPH0483439A (en) * 1990-07-25 1992-03-17 Fujitsu Ltd System for detecting abnormality of data transmission quantity
JP3003197B2 (en) * 1990-10-23 2000-01-24 ソニー株式会社 Robot numerical controller
JPH05134736A (en) * 1991-11-13 1993-06-01 Hitachi Seiko Ltd Data transferring method
JPH06262558A (en) * 1993-03-11 1994-09-20 Natl Aerospace Lab Speed control system of robot
JP2002049363A (en) * 2000-05-24 2002-02-15 Sharp Corp Picture display system

Also Published As

Publication number Publication date
JP2011183498A (en) 2011-09-22

Similar Documents

Publication Publication Date Title
US7774099B2 (en) Programming device for returning robot to waiting position
JP5382359B2 (en) Robot system
JP6456051B2 (en) Robot system control method, robot system, robot system control program, and recording medium
US10940583B2 (en) Method and computer program for producing a graphical user interface of a manipulator program
JP2012232363A (en) Robot control system, robot system and program
JP7020812B2 (en) Robot device, control method of robot device, assembly method of articles using robot device, control program and recording medium
US10850394B2 (en) Driving device
JP2006350620A (en) Method for action instruction of assembling mechanism in automatic assembling system
JP2015186834A (en) Robot control apparatus, holding unit control device, robot, holding unit, robot control method and program
CN108290288B (en) Method for simplified modification of an application for controlling an industrial installation
JP5445233B2 (en) Robot controller
JP6658985B1 (en) Robot system, return program generation device, control support device, control device, program, return program generation method, and return program output method
JP7108103B2 (en) Machine teaching terminal used for machine teaching, teaching system, program and safety confirmation method
JP5375436B2 (en) Robot system
JP2014124735A (en) Robot control method, robot control device, program, and robot
KR101398215B1 (en) Dual arm robot control apparatus and method with error recovery function
JP2009045678A (en) Method for judging success or failure of operation of robot, and robot system
JP3913666B2 (en) Simulation device
JP4289219B2 (en) Human intervention robot controller
JP5365875B2 (en) Industrial controller
JP7359543B2 (en) Machine control device
JP2023004194A (en) Robot system and erroneous wiring detection method thereof
JP2006068890A (en) Track determination system and track determination method
US20210197374A1 (en) Composability framework for robotic control system
CN112720491A (en) Robot remote control method, system, storage medium and equipment

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20130109

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20131121

TRDD Decision of grant or rejection written
A01 Written decision to grant a patent or to grant a registration (utility model)

Free format text: JAPANESE INTERMEDIATE CODE: A01

Effective date: 20131126

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20131209

R150 Certificate of patent or registration of utility model

Ref document number: 5445233

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R150

Free format text: JAPANESE INTERMEDIATE CODE: R150

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250