[go: up one dir, main page]

JP2005321954A - Robot apparatus, information processing system, information processing method, and computer program - Google Patents

Robot apparatus, information processing system, information processing method, and computer program Download PDF

Info

Publication number
JP2005321954A
JP2005321954A JP2004138633A JP2004138633A JP2005321954A JP 2005321954 A JP2005321954 A JP 2005321954A JP 2004138633 A JP2004138633 A JP 2004138633A JP 2004138633 A JP2004138633 A JP 2004138633A JP 2005321954 A JP2005321954 A JP 2005321954A
Authority
JP
Japan
Prior art keywords
class
function
language
overridden
wrapper
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
JP2004138633A
Other languages
Japanese (ja)
Inventor
Osamu Hanagata
理 花形
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.)
Sony Corp
Original Assignee
Sony 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 Sony Corp filed Critical Sony Corp
Priority to JP2004138633A priority Critical patent/JP2005321954A/en
Publication of JP2005321954A publication Critical patent/JP2005321954A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Manipulator (AREA)

Abstract

【課題】 コンパイラ言語で記述されたオブジェクトとスクリプト言語で記述されたオブジェクト間でクラス継承を好適に実現する。
【解決手段】 相互の言語のオブジェクトに他方のオブジェクトの参照をメンバに持つことで、クラスの継承を扱う。第1の言語におけるクラスのメンバに、これを継承したクラスである第2の言語のクラスへの参照を保持させ、第2の言語のオブジェクトのメンバに第1のクラスへの参照を保持させる。C++のベース・クラスからメソッドを呼び出した際、継承したクラスがスクリプト言語のクラスであれば、スクリプト言語のクラスのメソッドを正しく呼び出すことができる。
【選択図】 図1
PROBLEM TO BE SOLVED: To suitably realize class inheritance between an object described in a compiler language and an object described in a script language.
Inheritance of a class is handled by having a reference of the other object as a member in an object of a mutual language. A member of a class in the first language holds a reference to a class of the second language that is a class that inherits the member, and a member of an object of the second language holds a reference to the first class. When a method is called from a C ++ base class, if the inherited class is a script language class, the method of the script language class can be correctly called.
[Selection] Figure 1

Description

本発明は、オブジェクト指向言語で記述されたプログラムを実行するロボット装置、情報処理システム及び情報処理方法、並びにコンピュータ・プログラムに係り、特に、複数のオブジェクト指向言語で記述された言語間でクラス継承を実現するロボット装置、情報処理システム及び情報処理方法、並びにコンピュータ・プログラムに関する。   The present invention relates to a robot apparatus, an information processing system, an information processing method, and a computer program that execute a program described in an object-oriented language, and in particular, class inheritance between languages written in a plurality of object-oriented languages. The present invention relates to a robot apparatus, an information processing system, an information processing method, and a computer program.

さらに詳しくは、本発明は、コンパイラ言語で記述されたオブジェクトとスクリプト言語で記述されたオブジェクト間でクラス継承を実現するロボット装置、情報処理システム及び情報処理方法、並びにコンピュータ・プログラムに係り、例えば、ロボット装置にネイティブのコンパイラ言語で記述されたオブジェクトと、装置にダウンロードされたスクリプト言語形式のオブジェクト間において適切な関数呼び出しを行なうロボット装置、情報処理システム及び情報処理方法、並びにコンピュータ・プログラムに関する。   More particularly, the present invention relates to a robot apparatus, an information processing system and an information processing method, and a computer program that realize class inheritance between an object described in a compiler language and an object described in a script language. The present invention relates to a robot apparatus, an information processing system, an information processing method, and a computer program that perform an appropriate function call between an object described in a compiler language native to the robot apparatus and an object in a script language format downloaded to the apparatus.

電気的若しくは磁気的な作用を用いて人間の動作に似せた運動を行う機械装置のことを「ロボット」という。ロボットの語源は、スラブ語の“ROBOTA(奴隷機械)”に由来すると言われている。わが国では、ロボットが普及し始めたのは1960年代末からであるが、その多くは、工場における生産作業の自動化・無人化などを目的としたマニピュレータや搬送ロボットなどの産業用ロボット(industrial robot)であった。   A mechanical device that uses an electrical or magnetic action to perform a movement resembling human movement is called a “robot”. It is said that the word “robot” comes from the Slavic word “ROBOTA (slave machine)”. In Japan, robots began to spread from the end of the 1960s, but many of them are industrial robots such as manipulators and transfer robots for the purpose of automating and unmanned production operations in factories. Met.

最近では、イヌやネコのように4足歩行の動物の身体メカニズムやその動作を模したペット型ロボット、あるいは、ヒトやサルなどの2足直立歩行を行う動物の身体メカニズムや動作を模した「人間形」若しくは「人間型」のロボット(humanoid robot)など、脚式移動ロボットの構造やその安定歩行制御に関する研究開発が進展し、実用化への期待も高まってきている。これら脚式移動ロボットは、クローラ式ロボットに比し不安定で姿勢制御や歩行制御が難しくなるが、階段の昇降や障害物の乗り越えなど、柔軟な歩行・走行動作を実現できるという点で優れている。   Recently, a pet-type robot that mimics the body mechanism and movement of a quadruped animal, such as a dog or a cat, or the body mechanism or movement of a biped upright animal such as a human or monkey. Research and development related to the structure of legged mobile robots such as “humanoid” or “humanoid robots” and stable walking control thereof have progressed, and expectations for practical use are also increasing. These legged mobile robots are unstable compared to crawler robots, making posture control and walking control difficult, but they are superior in that they can realize flexible walking and running operations such as climbing stairs and climbing obstacles. Yes.

また、最近では、ロボット装置は、産業上の用途以外に、生活密着型、すなわち人間との「共生」あるいは「エンターティンメント」という目的で使用されることが多くなってきている。従来の玩具機械では、ユーザ操作と応答動作との関係が固定的で、玩具の動作をユーザの好みに合わせて変更することはできないため、ユーザは同じ動作の繰り返しにやがては飽きてしまう。これに対し、知能型のロボット装置は、動作に起因する行動モデルや学習モデルを備え、外部からの音声や画像、触覚などの入力情報に基づいてモデルを変化させて動作を決定し、自律的な思考及び動作制御を実現する。さらに、ロボットが感情モデルや本能モデルを用意することにより、ロボット自身の感情や本能に従った自律的な行動を表出することができる。また、人間とのインターフェースとして画像認識処理や音声認識処理などの認識技術を導入し、より高度でリアリスティックなコミュニケーションが可能となる。   In recent years, robotic devices have been increasingly used for purposes other than industrial applications, such as living together, that is, for “symbiosis” or “entertainment” with humans. In the conventional toy machine, the relationship between the user operation and the response operation is fixed, and the operation of the toy cannot be changed according to the user's preference. Therefore, the user gets tired of repeating the same operation. In contrast, intelligent robotic devices are equipped with behavioral models and learning models due to movement, and the movement is determined autonomously by changing the model based on input information such as voice, images, and touch from outside. Realization of thought and motion control. Furthermore, by preparing an emotion model and instinct model, the robot can express autonomous behavior according to the robot's own emotion and instinct. In addition, by introducing recognition technology such as image recognition processing and voice recognition processing as an interface with humans, more advanced and realistic communication is possible.

この種のロボットは高い情報処理能力を備えており、一種の計算機システムとして捉えることができる。すなわち、上述したような行動計画の立案やこれを体現するためのロボットの動作制御は、計算機システム上におけるプログラム・コード(例えぱアプリケーションなど)の実行という形態で実装される。言い換えれば、ロボットの行動・動作制御システムの構築は、計算機システムにおけるソフトウェア開発・設計という側面を持つ。   This type of robot has a high information processing capability and can be regarded as a kind of computer system. In other words, the above-described action planning and robot operation control for embodying the action plan are implemented in the form of execution of a program code (for example, an application) on the computer system. In other words, the construction of a robot behavior / motion control system has the aspect of software development / design in a computer system.

ところで、最近のソフトウェア設計においては、処理手順ではなく処理対象となるデータを重要視するという「オブジェクト指向」(object Oriented)技術が広く採用されている。一般に、オブジェクト指向によれば、ソフトウェアの開発と保守が効率化する。オブジェクト指向に基づくソフトウェアは、基本的に、データとそのデータに対する処理手続きとを一体化させた「オブジェクト」というモジュール単位で扱われる。また、必要に応じて複数のオブジェクトを作成し、これら組み合わせることで1つのソフトウェアが完成する。   By the way, in recent software design, an “object-oriented” technique that places importance on data to be processed rather than a processing procedure is widely adopted. In general, object orientation makes software development and maintenance more efficient. Software based on object orientation is basically handled in units of modules called “objects” in which data and processing procedures for the data are integrated. Further, a plurality of objects are created as necessary, and one software is completed by combining these objects.

オブジェクト指向パラダイムは、「カプセル化」、「クラス/インスタンス」、「クラス継承(インヘリタンス)」、及び、「メッセージ・パッシング」という主要な基本技術によって実現される。   The object-oriented paradigm is realized by the main basic technologies of “encapsulation”, “class / instance”, “class inheritance (inheritance)”, and “message passing”.

カプセル化は、データと手続き(メソッド)を一体化させることを指す。クラスは、複数のオブジェクトを共通化して定義することを指す。インスタンスはクラスに属するオブジェクトの実体を表す(同一クラスに属するオブジェクトすなわちインスタンスは基本的に同一のメソッドを有するので、個々にメソッドを定義する必要がない)。インヘリタンスとは、あるクラスで定義したことを別の(例えば下位の)クラスが継承することを意味する(新たにクラスを定義するときには、定義済みのクラスとの差分のみを追加変更するだけでよい)。メッセージ・パッシングとは、オブジェクトにメッセージを送って所定の動作を指示することを言う。各オブジェクトは自身のデータを隠蔽しているので、通常、メッセージ・パッシング以外の方法でオブジェクトにアクセスすることはできない。   Encapsulation refers to integrating data and procedures (methods). Class refers to defining multiple objects in common. An instance represents an entity of an object belonging to a class (an object belonging to the same class, ie, an instance, basically has the same method, so there is no need to define each method individually). Inheritance means that another (for example, subordinate) class inherits what was defined in one class (when a new class is defined, only the difference from the defined class needs to be added or changed. ). Message passing refers to sending a message to an object to instruct a predetermined action. Since each object hides its own data, it is usually not possible to access the object by any means other than message passing.

一般的な計算機システムとロボットとの主な相違として、前者はシステムを構成するハードウェア・コンポーネントの種類や組み合わせ(すなわちハードウェア構成)が各システム間で差が比較的少ないのに対して、後者はハードウェア構成がシステム間で大幅に変更するという点を挙げることができる。ひとえに移動ロボットといっても、胴体に対して取り付けられる可動部として、頭と脚部と尻尾で構成されるロボットや、頭部と車輪のみで構成されるロボットなど、千差万別である。   The main difference between a general computer system and a robot is that the former has a relatively small difference in the types and combinations (ie, hardware configurations) of hardware components constituting the system, while the latter. Can be mentioned that the hardware configuration changes significantly between systems. Even if it is a mobile robot, there are many different types of movable parts that can be attached to the body, such as a robot composed of a head, legs and tail, and a robot composed only of a head and wheels.

装備されるハードウェア構成がシステム間で比較的均一である計算機システムにおいては、システム上で実行するソフトウェアのデザインはハードウェアの影響を比較的受けずに済む。これに対して、後者のロボットの場合には、特にハードウェア操作を行なう制御ソフトウェアにおいてはハードウェア依存性が極めて高くなる。   In a computer system in which the installed hardware configuration is relatively uniform among systems, the design of software executed on the system is relatively unaffected by hardware. On the other hand, in the case of the latter robot, the hardware dependency becomes extremely high particularly in the control software for performing the hardware operation.

例えば、ロボットの移動制御を考えた場合、移動手段が可動脚の場合と車輪の場合と、2足と4足の場合とでは、移動時・歩行時における安定度判別規範がまったく相違するので、アプリケーションを実行するための動作環境はシステム間で大幅に異なる。このような事情を鑑み、ハードウェアの依存性が比較的低いソフトウェア層と、ハードウェアの依存性が高いソフトウェア層に分離してソフトウェア開発・設計を行なうことが効率的である。すなわち、ハードウェア非依存ソフトウェアと、ハードウェア依存ソフトウェアとを個別に開発しておき、両者の組み合わせにより、多岐にわたる、さまざまな特性や性能を持つ製品ラインアップを提供することができる。   For example, when considering the movement control of the robot, the stability determination criteria at the time of movement and walking are completely different between the case where the moving means is a movable leg, the case of a wheel, and the case of two legs and four legs. The operating environment for executing applications varies significantly between systems. In view of such circumstances, it is efficient to perform software development and design separately into a software layer with relatively low hardware dependency and a software layer with high hardware dependency. In other words, hardware-independent software and hardware-dependent software can be developed separately, and a combination of the two can provide a product lineup with a wide variety of characteristics and performance.

ハードウェア非依存のソフトウェアは、例えば、感情モデルや行動モデル、学習モデルなどのハードウェア操作との関係が少ない処理を行なうアプリケーションである。また、ハードウェア依存のソフトウェアは、例えば、ロボットの基本的な機能を提供するソフトウェア・モジュールの集まりで構成されるミドルウェアであり、各モジュールの構成はロボットの機械的・電気的な特性や仕様、形状などハードウェア属性の影響を受ける。ミドルウェアは、機能的には、各部のセンサの入力を処理・認識して上位のアプリケーションに通知する認識系のミドルウェアと、アプリケーションが発行するコマンドに従って各関節アクチュエータの駆動などハードウェアの駆動制御を行なう出力系のミドルウェアに大別することができる。   The hardware-independent software is, for example, an application that performs a process with little relation to hardware operations such as an emotion model, a behavior model, and a learning model. The hardware-dependent software is, for example, middleware composed of a collection of software modules that provide the basic functions of the robot. The configuration of each module includes the mechanical and electrical characteristics and specifications of the robot, Influenced by hardware attributes such as shape. Functionally, the middleware performs recognition and control of each part's sensor input and notifies the higher-level application, and performs hardware drive control such as driving each joint actuator according to the command issued by the application. It can be roughly divided into output middleware.

例えば、ハードウェア構成に適合したミドルウェアをロボットに導入することによって、同じアプリケーションをさまざまなハードウェア構成のロボット上で実行可能となる。また、アプリケーションとミドルウェア間の任意の組み合わせを許容するためには、これらソフトウェア層間でのデータやコマンドを交換する形式、すなわちプログラム間のインターフェースを確立させておく必要がある(例えば、特許文献1を参照のこと)。   For example, by introducing middleware adapted to the hardware configuration to the robot, the same application can be executed on the robots having various hardware configurations. Further, in order to allow any combination between an application and middleware, it is necessary to establish a format for exchanging data and commands between these software layers, that is, an interface between programs (for example, Patent Document 1). See

特開2002−113675号公報JP 2002-113675 A

ところで、ロボットを始めとして各種の計算機システムに対してソフトウェアを導入する形態として、新しいソフトウェアをリムーバブル・メディアを介して供給したり、あるいはネットワーク経由でソフトウェアをダウンロードしたりすることが挙げられる。   By the way, as a form of introducing software to various computer systems including a robot, new software can be supplied via a removable medium, or software can be downloaded via a network.

例えば、ロボットの本体のある部位に、メモリ・カードやメモリ・スティックなどのリムーバブル・メディアを介して、アプリケーションやミドルウェアなどの新しいソフトウェアを簡単にロボットに導入することができる。あるいは、ロボットが無線又は有線のLANインターフェースを装備することにより、例えば最寄りの基地局やサーバを経由して所定のサイトから最新バージョンのプログラムをダウンロードすることができる。   For example, new software such as applications and middleware can be easily introduced into the robot via a removable medium such as a memory card or memory stick at a certain part of the robot body. Alternatively, when the robot is equipped with a wireless or wired LAN interface, the latest version of the program can be downloaded from a predetermined site via, for example, the nearest base station or server.

ここで、プログラミング言語には、コンパイル処理後に実行形式となるコンパイラ言語と、スクリプト言語や簡易プログラミング言語と呼ばれる高レベル・プログラミング言語などがある。前者の例としてCやC++を挙げることができる。また、後者の例では、perl、python、Rubyなどを挙げることができる。   Here, as the programming language, there are a compiler language that becomes an execution form after compilation processing, and a high-level programming language called a script language or a simple programming language. Examples of the former include C and C ++. In the latter example, perl, Python, Ruby, etc. can be mentioned.

スクリプト言語は、高機能であるが、インタープリタ上で実行されるためスピードが遅いという問題点がある。このため、高スピードが要求されている部分は、コンパイラ型の言語で記述したり、あらかじめCやC++などのライブラリと組み合わせたりして使用している。例えば、ロボットなどの情報処理装置において、ネイティブなコード部分はCやC++などのコンパイラ言語で記述される。   Although the script language is highly functional, there is a problem that it is slow because it is executed on the interpreter. For this reason, a portion requiring high speed is described in a compiler type language or used in combination with a library such as C or C ++ in advance. For example, in an information processing apparatus such as a robot, a native code portion is described in a compiler language such as C or C ++.

ところが、コンパイラ言語はコンパイル処理してからでないと実行できないことから、装置にダウンロードされるプログラム・モジュールに関しては、コンパイル処理なしで実行可能にするため、スクリプト言語で記述することが便利であると、本発明者らは思料する。   However, since the compiler language can only be executed after compilation, the program module downloaded to the device can be executed without compilation, so it is convenient to write it in script language. The inventors contemplate.

この場合、スクリプト言語で記述されたプログラム・モジュール側から、コンパイラ言語で記述されたサブルーチンを呼び出す、あるいはその逆に、コンパイラ言語で記述されたプログラム・モジュール側から、スクリプト言語で記述されたサブルーチンを呼び出す必要があり、両方の言語の相違を吸収しなければならない。   In this case, a subroutine written in the compiler language is called from the program module side written in the script language, or vice versa. A subroutine written in the script language is called from the program module side written in the compiler language. Must be called and must absorb the differences between both languages.

とりわけ、オブジェクト指向プログラミングにおけるメッセージのメカニズムの基本的な概念の1つとして、ポリモルフィズム(多相性、多様性)を挙げることができる。このポリモルフィズムとは、異なるクラスに定義されている別のメソッドに同一の操作名を付ける(override)ことにより、それらを同一のメッセージで使用できる、ということを意味する。ポリモルフィズムの成立により、上下のクラスにおいて同じ名前の異なるメソッドを定義することができ、インヘリタンス(継承)を効率的に利用することができる。ポリモルフィズムに関しては、例えばBjarne Stroustrup著「プログラミング言語C++第三版」(Addison-Wesley,アスキー、pp 67)を参照されたい。   In particular, one of the basic concepts of message mechanisms in object-oriented programming is polymorphism (polymorphism, diversity). This polymorphism means that by giving the same operation name to another method defined in different classes, they can be used in the same message. With the establishment of polymorphism, different methods with the same name can be defined in the upper and lower classes, and inheritance (inheritance) can be used efficiently. Regarding polymorphism, see, for example, “Programming Language C ++ 3rd Edition” (Addison-Wesley, ASCII, pp 67) by Bjarne Strustrup.

上述した例では、ポリモルフィズムを達成するためには、コンパイラ言語及びスクリプト言語でそれぞれ記述されたオブジェクト相互間で、他方のオブジェクトへの参照情報を持ち、正しくクラス継承を扱えなくてはならない。例えば、C++のベース・クラスからメソッドを呼び出した際、正しいクラスを呼び出す。これがスクリプト言語のクラスであれば、スクリプト言語のクラスのメソッドを呼び出す。   In the above-described example, in order to achieve polymorphism, it is necessary to have reference information for the other object between objects described in the compiler language and the script language, and to correctly handle class inheritance. For example, when a method is called from a C ++ base class, the correct class is called. If this is a script language class, the method of the script language class is called.

C++では、一般に、仮想(virtual)関数を用いてポリモルフィズムを実装している。ベース・クラスでメンバ関数を仮想関数と宣言し、派生クラスで関数のオーバーライドを行なう。このとき、クラスに仮想テーブルを持たせることで、オブジェクトの属しているクラスを判定する。   In C ++, polymorphism is generally implemented using a virtual function. Declare the member function as a virtual function in the base class and override the function in the derived class. At this time, the class to which the object belongs is determined by providing the class with a virtual table.

C++のようなコンパイラ型の言語では、コンパイル時に派生クラスが関数のオーバーライドを行なっているかどうかを判断することができる。これに対し、スクリプト型の言語は、実行効率はよいが、インタープリタによる実行時でないと関数のオーバーライドを行なっているかどうかを判断することができない。このため、C++のクラスをスクリプト言語に継承することは困難である。   In a compiler type language such as C ++, it is possible to determine whether a derived class is overriding a function at the time of compilation. On the other hand, the script type language has high execution efficiency, but it is not possible to determine whether or not the function is overridden unless it is executed by the interpreter. For this reason, it is difficult to inherit the C ++ class to the script language.

また、2つの言語間の相違を吸収するために、ラッパー・コードと呼ばれるプログラムを利用することがある。このラッパー・コードを自動生成するツールとして、SWIGなどが知られている(http://swig.org/又はhttp://swig−jp.dyndns.org/を参照のこと)。ところが、このSWIGでは、スクリプト言語のクラスにC++のオブジェクトを持たせているだけであり、C++からスクリプト言語を呼び出すことができない。すなわち、C++のクラスをスクリプト言語に継承することはできない。   In addition, in order to absorb the difference between the two languages, a program called wrapper code is sometimes used. SWIG or the like is known as a tool for automatically generating this wrapper code (see http://swig.org/ or http://swig-jp.dyndns.org/). However, in this SWIG, the script language class only has a C ++ object, and the script language cannot be called from C ++. That is, the C ++ class cannot be inherited by the script language.

本発明は、上述したような技術的課題を勘案したものであり、その主な目的は、オブジェクト指向言語で記述された他言語間でクラス継承を好適に実現することができる、優れたロボット装置、情報処理システム及び情報処理方法、並びにコンピュータ・プログラムを提供することにある。   The present invention takes into account the technical problems as described above, and its main purpose is an excellent robot apparatus capable of suitably realizing class inheritance between other languages described in an object-oriented language. An information processing system, an information processing method, and a computer program are provided.

本発明のさらなる目的は、コンパイラ言語で記述されたオブジェクトとスクリプト言語で記述されたオブジェクト間でクラス継承を好適に実現することができる、優れたロボット装置、情報処理システム及び情報処理方法、並びにコンピュータ・プログラムを提供することにある。   A further object of the present invention is to provide an excellent robot apparatus, information processing system, information processing method, and computer capable of suitably realizing class inheritance between an object described in a compiler language and an object described in a script language.・ To provide a program.

本発明のさらなる目的は、ロボット装置にネイティブのコンパイラ言語形式のオブジェクトと、装置にダウンロードされたスクリプト言語形式のオブジェクト間において適切な関数を正しく呼び出すことができる、優れたロボット装置、情報処理システム及び情報処理方法、並びにコンピュータ・プログラムを提供することにある。   A further object of the present invention is to provide an excellent robot apparatus, information processing system, and information processing system capable of correctly calling an appropriate function between an object in a compiler language format native to the robot apparatus and an object in a script language format downloaded to the apparatus. It is to provide an information processing method and a computer program.

本発明のさらなる目的は、コンパイラ言語及びスクリプト言語のいずれのオブジェクトからでも、関数がスクリプト言語側のオブジェクトにオーバーライドされているか否かに応じて正しく呼び出し、ポリモルフィズムを達成することができる、優れたロボット装置、情報処理システム及び情報処理方法、並びにコンピュータ・プログラムを提供することにある。   A further object of the present invention is to provide an excellent robot that can call a function correctly from any object of the compiler language and script language depending on whether or not the function is overridden by an object on the script language side and achieve polymorphism. An apparatus, an information processing system, an information processing method, and a computer program are provided.

本発明は、上記課題を参酌してなされたものであり、その第1の側面は、1以上の可動部を備えたロボット装置において、
第1の言語で記述されたプログラム・コードの実行により前記ロボット装置の動作を制御する制御装置と、
第2の言語で記述されたプログラム・コードの実行により、前記制御装置を継承する継承装置とを備え、
前記第1の言語で記述されたクラスを前記第2の言語のクラスで継承する際に、前記制御装置は前記第2の言語のクラスへの参照を保持し,前記継承装置は前記第1の言語のクラスへの参照を保持する、
ことを特徴とするロボット装置である。
The present invention has been made in consideration of the above problems, and a first aspect of the present invention is a robot apparatus including one or more movable parts.
A control device for controlling the operation of the robot device by executing a program code described in a first language;
An inheriting device that inherits the control device by executing program code described in a second language;
When the class described in the first language is inherited by the class of the second language, the control device holds a reference to the class of the second language, and the inheritance device Holds a reference to a language class,
It is a robot apparatus characterized by this.

但し、ここで言う「システム」とは、複数の装置(又は特定の機能を実現する機能モジュール)が論理的に集合した物のことを言い、各装置や機能モジュールが単一の筐体内にあるか否かは特に問わない。   However, “system” here refers to a logical collection of a plurality of devices (or functional modules that realize specific functions), and each device or functional module is in a single housing. It does not matter whether or not.

ここで言う第1及び第2の言語はともにオブジェクト指向言語である。第1の言語は例えばC++などのコンパイラ言語であり、第2の言語はpython又はその他のスクリプト言語であり、インタープリタ上で実行される。すなわち、本発明に係るロボット装置では、コンパイラ言語とスクリプト言語でそれぞれ記述されたオブジェクトが混在するオブジェクト指向プログラミング環境により制御システムが構成されている。   The first and second languages referred to here are both object-oriented languages. The first language is a compiler language such as C ++, for example, and the second language is Python or another script language, which is executed on the interpreter. That is, in the robot apparatus according to the present invention, the control system is configured by an object-oriented programming environment in which objects described in a compiler language and a script language are mixed.

このようなシステム環境下では、異なる言語間におけるクラス継承の問題がある。具体的には、第1の言語で記述されたクラスを継承したクラスを第2の言語のクラスとしなければならない局面がある。この場合、いずれの言語のクラスから関数が呼び出された場合であっても、正しく関数を呼び出すようにする必要がある。   Under such a system environment, there is a problem of class inheritance between different languages. Specifically, there is a situation in which a class that inherits a class described in a first language must be a class in the second language. In this case, it is necessary to call the function correctly even if the function is called from any language class.

本発明に係るロボット装置の制御システムでは、相互の言語のオブジェクトに他方のオブジェクトの参照をメンバに持つことで、クラスの継承を扱うようにした。具体的には、第1の言語におけるクラスのメンバに、これを継承したクラスである第2の言語のクラスへの参照を保持させるとともに、第2の言語のオブジェクトのメンバに第1の言語のクラスへの参照を保持させる。例えば、C++のベース・クラスからメソッドを呼び出した際に、正しいクラスを呼び出す。すなわち、継承したクラスがスクリプト言語のクラスであれば、スクリプト言語のクラスのメソッドを正しく呼び出すことができる。   In the control system of the robot apparatus according to the present invention, the inheritance of the class is handled by having the object of the other language as a member in the mutual language object. Specifically, the member of the class in the first language holds a reference to the class of the second language that is a class that inherits the member, and the member of the object of the second language Keep a reference to the class. For example, when a method is called from a C ++ base class, the correct class is called. That is, if the inherited class is a script language class, a method of the script language class can be correctly called.

具体的には、第1の言語で記述されたベース・クラスを第2の言語で記述されたスーパー・クラスへ継承させる際に、前記ベース・クラスを第1の言語で記述された第1のラッパー・クラスで継承するとともに、第2の言語で記述された第2のラッパー・クラスをスーパー・クラスが継承する。そして、前記第1のラッパー・クラスは前記第2のラッパー・クラスのインスタンスのポインタを格納し、前記第2のラッパー・クラスは前記第1のラッパー・クラスのインスタンスのポインタを格納する。   Specifically, when the base class described in the first language is inherited to the super class described in the second language, the base class is described in the first language described in the first language. In addition to inheriting in the wrapper class, the super class inherits the second wrapper class described in the second language. The first wrapper class stores a pointer to an instance of the second wrapper class, and the second wrapper class stores a pointer to an instance of the first wrapper class.

しかし、両言語のクラスに相互参照の関係を構成するだけでは、ポリモルフィズムを完全に到達することはできない。すなわち、C++側のクラスに定義されている関数を、これを継承したスクリプト言語側のクラスにおいてオーバーライドしている場合には、正しく呼び出すことができるが、スクリプト言語側のクラスにおいてオーバーライドしていない場合には無限ループが生じ、正しく関数を呼び出すことができない、という問題がある。   However, polymorphism cannot be achieved completely by constructing cross-reference relationships between the classes of both languages. That is, if the function defined in the C ++ class is overridden in the script language class that inherits it, it can be called correctly, but it is not overridden in the script language class. Has a problem that an infinite loop occurs and the function cannot be called correctly.

このような無限ループを解決する1つの方法として、前記ベース・クラスの関数が第2の言語側で継承されているクラスにオーバーライドされているかどうかをチェックする判断機能を装備することを挙げることができる。   One way to solve such an infinite loop is to equip a judgment function to check whether the function of the base class is overridden by a class inherited on the second language side. it can.

具体的には、前記第1のラッパー・クラスは、前記ベース・クラスの関数をオーバーライドし、且つ、該オーバーライドした関数内において前記スーパー・クラスにおいてオーバーライドされているかどうかをチェックする。そして、前記スーパー・クラスにおいてオーバーライドされている場合には第2の言語側の関数を呼び出す一方、前記スーパー・クラスにおいてオーバーライドされていない場合には前記ベース・クラスの関数を呼び出すようにし、無限ループへ突入しないようにする。   Specifically, the first wrapper class overrides the base class function and checks whether it is overridden in the super class within the overridden function. When overridden in the super class, a function on the second language side is called. On the other hand, when not overridden in the super class, the function of the base class is called. Do not rush into.

また、無限ループを解決する他の方法として、前記第2のラッパー・クラスがいずれの関数を呼び出すかを判断する機能を装備することを挙げることができる。   In addition, as another method for solving the infinite loop, it is possible to provide a function for determining which function the second wrapper class calls.

具体的には、前記第1のラッパー・クラスは、前記ベース・クラスの関数をオーバーライドし、且つ、前記ベース・クラスの関数を呼び出す擬似オーバーライド関数を持つ。また、前記第2のラッパー・クラスは、前記ベース・クラスの関数をオーバーライドする。そして、第2のラッパー・クラスでは、オーバーライドした関数を呼び出す際には、該オーバーライドした関数内において前記スーパー・クラスにおいてオーバーライドされているかどうかをチェックする。前記スーパー・クラスにおいてオーバーライドされている場合には第2の言語側の関数を呼び出すが、前記スーパー・クラスにおいてオーバーライドされていない場合には前記擬似オーバーライド関数を呼び出すようにする。このチェック機構は、第二言語では自動的に行なわれる処理なので、ユーザがチェック機構チェック機構を負荷する必要はない。擬似オーバーライド関数は、前記ベース・クラスの関数を呼び出すので、無限ループへ突入しなくなる。   Specifically, the first wrapper class has a pseudo-override function that overrides the function of the base class and calls the function of the base class. Also, the second wrapper class overrides the base class function. In the second wrapper class, when the overridden function is called, it is checked whether the overridden function is overridden in the super class. When overridden in the super class, the function on the second language side is called, but when not overridden in the super class, the pseudo-override function is called. Since this check mechanism is automatically performed in the second language, it is not necessary for the user to load the check mechanism check mechanism. Since the pseudo-override function calls the base class function, it does not enter an infinite loop.

あるいは、前記第1のラッパー・クラスは、前記ベース・クラスの関数をオーバーライドするとともに、前記第1のラッパー・クラスを継承する第3のラッパー・クラスを設ける。この第3のラッパー・クラスでは、前記ベース・クラスの関数を呼び出す擬似オーバーライド関数を定義する。また、前記第2のラッパー・クラスは、前記ベース・クラスの関数をオーバーライドする。そして、第2のラッパー・クラスでは、オーバーライドした関数を呼び出す際には、前記スーパー・クラスにおいてオーバーライドされているかどうかをチェックする。前記スーパー・クラスにおいてオーバーライドされている場合には第2の言語側の関数を呼び出すが、前記スーパー・クラスにおいてオーバーライドされていない場合には前記第3のラッパー・クラスを呼び出す。そして、第3のラッパー・クラスで定義されている擬似オーバーライド関数は、前記ベース・クラスの関数を呼び出すので、無限ループへ突入しなくなる。   Alternatively, the first wrapper class overrides the function of the base class and provides a third wrapper class that inherits the first wrapper class. In this third wrapper class, a pseudo-override function that calls a function of the base class is defined. Also, the second wrapper class overrides the base class function. Then, in the second wrapper class, when calling the overridden function, it is checked whether it is overridden in the super class. If it is overridden in the super class, the function on the second language side is called. If not overridden in the super class, the third wrapper class is called. Since the pseudo override function defined in the third wrapper class calls the base class function, it does not enter an infinite loop.

また、本発明の第2の側面は、第1の言語と第2の言語でそれぞれ記述されたオブジェクトが混在するオブジェクト指向プログラミング環境においてプログラムを実行するための処理をコンピュータ・システム上で実行するようにコンピュータ可読形式で記述されたコンピュータ・プログラムにおいて、
第1の言語で記述されたクラスを継承したクラスを第2の言語のクラスとする際に、第1の言語におけるクラスのメンバに該クラスを継承した第2の言語のクラスへの参照を保持させるステップと、第2の言語のオブジェクトのメンバに第1の言語のクラスへの参照を保持させるステップと、
を備えることを特徴とするコンピュータ・プログラムである。
According to a second aspect of the present invention, a process for executing a program in an object-oriented programming environment in which objects described in the first language and the second language are mixed is executed on a computer system. In a computer program written in a computer readable format,
When a class that inherits a class described in the first language is used as a second language class, a member of the class in the first language holds a reference to the class in the second language that inherits the class. Causing a member of a second language object to retain a reference to a class of the first language;
A computer program characterized by comprising:

本発明の第2の側面に係るコンピュータ・プログラムは、コンピュータ・システム上で所定の処理を実現するようにコンピュータ可読形式で記述されたコンピュータ・プログラムを定義したものである。換言すれば、本発明の第2の側面に係るコンピュータ・プログラムをコンピュータ・システムにインストールすることによって、コンピュータ・システム上では協働的作用が発揮され、本発明の第1の側面に係るロボット装置の制御システムと同様の作用効果を得ることができる。   The computer program according to the second aspect of the present invention defines a computer program described in a computer-readable format so as to realize predetermined processing on a computer system. In other words, by installing the computer program according to the second aspect of the present invention in the computer system, a cooperative action is exhibited on the computer system, and the robot apparatus according to the first aspect of the present invention. The same operation effect as the control system can be obtained.

本発明によれば、オブジェクト指向言語で記述された他言語間でクラス継承を好適に実現することができる、優れたロボット装置、情報処理システム及び情報処理方法、並びにコンピュータ・プログラムを提供することができる。   According to the present invention, it is possible to provide an excellent robot apparatus, information processing system and information processing method, and computer program capable of suitably realizing class inheritance between other languages described in an object-oriented language. it can.

また、本発明によれば、コンパイラ言語で記述されたオブジェクトとスクリプト言語で記述されたオブジェクト間でクラス継承を好適に実現することができる、優れたロボット装置、情報処理システム及び情報処理方法、並びにコンピュータ・プログラムを提供することができる。   Further, according to the present invention, it is possible to preferably realize class inheritance between an object described in a compiler language and an object described in a script language. A computer program can be provided.

また、本発明によれば、ロボット装置にネイティブのコンパイラ言語形式のオブジェクトと、装置にダウンロードされたスクリプト言語形式のオブジェクト間において適切な関数を正しく呼び出すことができる、優れたロボット装置、情報処理システム及び情報処理方法、並びにコンピュータ・プログラムを提供することができる。   Further, according to the present invention, an excellent robot apparatus and information processing system capable of correctly calling an appropriate function between an object in a compiler language format native to the robot apparatus and an object in a script language format downloaded to the apparatus And an information processing method and a computer program can be provided.

また、本発明によれば、コンパイラ言語及びスクリプト言語のいずれのオブジェクトからでも、関数がスクリプト言語側のオブジェクトにオーバーライドされているか否かに応じて正しく呼び出し、ポリモルフィズムを達成することができる、優れたロボット装置、情報処理システム及び情報処理方法、並びにコンピュータ・プログラムを提供することができる。   Further, according to the present invention, from any object of the compiler language and the script language, the function can be correctly called according to whether or not the function is overridden by the script language side object, and polymorphism can be achieved. A robot apparatus, an information processing system, an information processing method, and a computer program can be provided.

本発明のさらに他の目的、特徴や利点は、後述する本発明の実施形態や添付する図面に基づくより詳細な説明によって明らかになるであろう。   Other objects, features, and advantages of the present invention will become apparent from more detailed descriptions based on embodiments of the present invention described later and the accompanying drawings.

以下、図面を参照しながら本発明の実施形態について詳解する。   Hereinafter, embodiments of the present invention will be described in detail with reference to the drawings.

図1には、本発明に実施に供されるロボット装置1の機能構成を模式的に示している。同図に示すように、ロボット装置1は、全体の動作の統括的制御やその他のデータ処理を行なう制御ユニット20と、入出力部40と、駆動部50と、電源部60とで構成される。以下、各部について説明する。   FIG. 1 schematically shows a functional configuration of a robot apparatus 1 that is used in the present invention. As shown in the figure, the robot apparatus 1 includes a control unit 20 that performs overall control of the entire operation and other data processing, an input / output unit 40, a drive unit 50, and a power supply unit 60. . Hereinafter, each part will be described.

入出力部40は、入力部としてロボット装置1の目に相当するCCDカメラ15や、耳に相当するマイクロフォン16、頭部や背中などの部位に配設されてユーザの接触を感知するタッチ・センサ18、あるいは五感に相当するその他の各種のセンサを含む。また、出力部として、口に相当するスピーカ17や、点滅の組み合わせや点灯のタイミングにより顔の表情を形成するLEDインジケータ(目ランプ)19などを装備している。   The input / output unit 40 is provided in the CCD camera 15 corresponding to the eyes of the robot apparatus 1 as an input unit, the microphone 16 corresponding to the ear, or a part such as the head or the back, and a touch sensor that detects a user's contact. 18 or other various sensors corresponding to the five senses. As an output unit, a speaker 17 corresponding to the mouth, an LED indicator (eye lamp) 19 that forms a facial expression by a combination of blinking and lighting timing, and the like are provided.

駆動部50は、制御部20が指令する所定の運動パターンに従ってロボット装置1の機体動作を実現する機能ブロックであり、行動制御による制御対象である。駆動部50は、ロボット装置1の各関節における自由度を実現するための機能モジュールであり、それぞれの関節におけるロール、ピッチ、ヨーなど各軸毎に設けられた複数の駆動ユニットで構成される。各駆動ユニットは、所定軸回りの回転動作を行なうモータ51と、モータ51の回転位置を検出するエンコーダ52と、エンコーダ52の出力に基づいてモータ51の回転位置や回転速度を適応的に制御するドライバ53の組み合わせで構成される。   The drive unit 50 is a functional block that realizes the body operation of the robot apparatus 1 in accordance with a predetermined motion pattern commanded by the control unit 20, and is a control target by behavior control. The drive unit 50 is a functional module for realizing the degree of freedom in each joint of the robot apparatus 1 and includes a plurality of drive units provided for each axis such as roll, pitch, and yaw in each joint. Each drive unit adaptively controls the rotational position and rotational speed of the motor 51 based on the output of the motor 51 that performs a rotational operation around a predetermined axis, the encoder 52 that detects the rotational position of the motor 51, and the encoder 52. A combination of drivers 53 is used.

電源部60は、ロボット装置1内の各電気回路などに対して給電を行なう機能モジュールである。本実施形態に係るロボット装置1は、バッテリを用いた自律駆動式であり、電源部60は、充電バッテリ61と、充電バッテリ61の充放電状態を管理する充放電制御部62とで構成される。充電バッテリ61は、例えば、複数本のリチウムイオン2次電池セルをカートリッジ式にパッケージ化した「バッテリ・パック」の形態で構成される。また、充放電制御部62は、バッテリ61の端子電圧や充電/放電電流量、バッテリ61の周囲温度などを測定することでバッテリ61の残存容量を把握し、充電の開始時期や終了時期などを決定する。   The power supply unit 60 is a functional module that supplies power to each electric circuit in the robot apparatus 1. The robot apparatus 1 according to the present embodiment is an autonomous drive type using a battery, and the power supply unit 60 includes a charging battery 61 and a charging / discharging control unit 62 that manages the charging / discharging state of the charging battery 61. . The rechargeable battery 61 is configured, for example, in the form of a “battery pack” in which a plurality of lithium ion secondary battery cells are packaged in a cartridge type. Further, the charge / discharge control unit 62 grasps the remaining capacity of the battery 61 by measuring the terminal voltage of the battery 61, the amount of charge / discharge current, the ambient temperature of the battery 61, etc., and determines the charging start timing and end timing. decide.

制御部20は、「頭脳」に相当し、例えばロボット装置1の頭部ユニットあるいは胴体部ユニットに搭載される。   The control unit 20 corresponds to a “brain” and is mounted on, for example, the head unit or the torso unit of the robot apparatus 1.

図2には、制御ユニット20の構成をさらに詳細に図解している。同図に示すように、制御ユニット20は、メイン・コントローラとしてのCPU(Central Processing Unit)121が、メモリその他の各回路コンポーネントや周辺機器とバス接続された構成となっている。バス28は、データ・バス、アドレス・バス、コントロール・バスなどを含む共通信号伝送路である。   FIG. 2 illustrates the configuration of the control unit 20 in more detail. As shown in the figure, the control unit 20 has a configuration in which a CPU (Central Processing Unit) 121 as a main controller is connected to a memory and other circuit components and peripheral devices via a bus. The bus 28 is a common signal transmission path including a data bus, an address bus, a control bus, and the like.

RAM(Random Access Memory)22は、DRAM(Dynamic RAM)などの揮発性メモリで構成された書き込み可能メモリであり、CPU21が実行するプログラム・コードをロードしたり、実行プログラムによる作業データの一時的に保存したりするために使用される。   A RAM (Random Access Memory) 22 is a writable memory composed of a volatile memory such as a DRAM (Dynamic RAM), and loads a program code executed by the CPU 21 or temporarily stores work data by the execution program. Used to save.

ROM(Read Only Memory)23は、プログラムやデータを恒久的に格納する読み出し専用メモリである。ROM23に格納されるプログラム・コードには、ロボット装置1の電源投入時に実行する自己診断テスト・プログラムや、ロボット装置1の動作を規定する動作制御プログラムなどが挙げられる。   A ROM (Read Only Memory) 23 is a read-only memory that permanently stores programs and data. Examples of the program code stored in the ROM 23 include a self-diagnosis test program that is executed when the robot apparatus 1 is powered on, and an operation control program that defines the operation of the robot apparatus 1.

不揮発性メモリ24は、例えばEEPROM(Electrically Erasable and Programmable ROM)のように、電気的に消去再書き込みが可能なメモリ素子で構成され、逐次更新すべきデータを不揮発的に保持するために使用される。逐次更新すべきデータには、例えば、製造番号や暗号鍵などのセキュリティ情報などが挙げられる。   The nonvolatile memory 24 is configured by a memory element that can be electrically erased and rewritten, such as an EEPROM (Electrically Erasable and Programmable ROM), and is used to hold data to be sequentially updated in a nonvolatile manner. . Examples of data that should be updated sequentially include security information such as a manufacturing number and an encryption key.

インターフェース25は、制御ユニット20外の機器と相互接続し、データ交換を可能にするための装置である。インターフェース25は、例えば、カメラ15やマイクロフォン16、スピーカ17との間でデータ入出力を行なう。また、インターフェース25は、駆動部50内の各駆動回路53−1…との間でデータやコマンドの入出力を行なう。   The interface 25 is a device for interconnecting with devices outside the control unit 20 and enabling data exchange. The interface 25 performs data input / output with the camera 15, the microphone 16, and the speaker 17, for example. Further, the interface 25 inputs / outputs data and commands to / from each drive circuit 53-1... In the drive unit 50.

また、インターフェース25は、RS(Recommended Standard)−232Cなどのシリアル・インターフェース、IEEE(Institute of Electrical and Electronics Engineers)1284などのパラレル・インターフェース、USB(Universal Serial Bus)インターフェース、i−Link(IEEE1394)インターフェース、SCSI(Small Computer System Interface)インターフェース、メモリ・カード・インターフェースなどのような、コンピュータの周辺機器接続用の汎用インターフェースを備え、ローカル接続された外部機器との間でプログラムやデータの移動を行なうようにしてもよい。   In addition, the interface 25 includes a serial interface such as RS (Recommended Standard) -232C, a parallel interface such as IEEE (Institut of Electrical and Electronics Engineers) 1284, a USB (Universal Serial Bus) I interface 94, an E A general-purpose interface for connecting peripheral devices of computers such as a small computer system interface (SCSI) interface, a memory card interface, etc., so as to transfer programs and data to / from locally connected external devices It may be.

また、インターフェース25の他の例として、赤外線通信(IrDA)インターフェースを備え、外部機器と無線通信を行なうようにしてもよい。   As another example of the interface 25, an infrared communication (IrDA) interface may be provided to perform wireless communication with an external device.

さらに、制御ユニット20は、無線通信インターフェース26を含み、Bluetoothのような近距離無線データ通信やIEEE802.11bのような無線ネットワークにより機体の数メートル以内に配設されたアクセスポイント(図示しない)との間で無線データ通信を行なうことができる。アクセスポイントは、さらにLANなどの小規模ネットワークやインターネットなどの広域ネットワークに相互接続され、ロボット装置1をネットワーク上の情報提供空間へと導くことができる。   Furthermore, the control unit 20 includes a wireless communication interface 26, and an access point (not shown) disposed within a few meters of the aircraft by a short-range wireless data communication such as Bluetooth or a wireless network such as IEEE802.11b. Wireless data communication can be performed between the two. The access point is further interconnected to a small-scale network such as a LAN or a wide-area network such as the Internet, and can guide the robot apparatus 1 to an information providing space on the network.

ネットワーク上には、コンテンツ・サーバを始めとし、多数のホスト装置が接続されている。ロボット装置1は、コンテンツ・サーバからソフトウェアをダウンロードすることができる。ここで、ロボット装置においてネイティブなコード部分は、処理の高速化などのため、CやC++などのコンパイラ言語で記述される。一方、ダウンロードされるプログラム・モジュールに関しては、コンパイル処理なしで実行可能にするため、スクリプト言語で記述する。   Many host devices such as a content server are connected on the network. The robot apparatus 1 can download software from the content server. Here, the native code portion in the robot apparatus is described in a compiler language such as C or C ++ in order to speed up the processing. On the other hand, the downloaded program module is described in a script language so that it can be executed without compiling.

図31には、本実施形態に係るロボット装置を取り巻くネットワーク構成を模式的に示している。   FIG. 31 schematically shows a network configuration surrounding the robot apparatus according to the present embodiment.

ロボット装置は、無線データ通信機能を装備しており、アクセス・ポイント経由でネットワークに接続されている(前述)。ロボット装置には、ユーザから与えられた指示を認識する能力、あるいは、ロボットが自らの行動のために必要と判断するプログラムが存在する。   The robot apparatus is equipped with a wireless data communication function and is connected to a network via an access point (described above). The robot apparatus has a capability of recognizing an instruction given by a user, or a program that the robot determines to be necessary for its own action.

ここで言うネットワークには、LANなどの小規模ネットワークやインターネットのような広域ネットワークが含まれる。   The network mentioned here includes a small-scale network such as a LAN and a wide area network such as the Internet.

ネットワーク上には、ロボット装置のためにWWW情報探索を代行して行う中継サーバや、その他の多数のサーバが存在する。ネットワーク上では、サーバなどの各ホストは例えばTCP/IPプロトコルによって相互接続されている。   On the network, there are a relay server that performs WWW information search on behalf of the robot apparatus, and many other servers. On the network, hosts such as servers are interconnected by, for example, the TCP / IP protocol.

中継サーバは、ロボット装置に必要なプログラム(オブジェクト)や情報コンテンツ、データなどをあらかじめ記憶しておくとともに、随時これらを更新して、ネットワーク経由で特定のロボット装置あるいはすべてのロボットに配信する。また逆に、ロボット装置から送られてくるプログラム(オブジェクト)や情報コンテンツ、データなどを受信してローカルな記憶システムに格納することができる。   The relay server stores programs (objects), information contents, data, and the like necessary for the robot apparatus in advance, updates them as needed, and distributes them to a specific robot apparatus or all robots via a network. Conversely, a program (object), information content, data, etc. sent from the robot apparatus can be received and stored in a local storage system.

また、ネットワーク上には、有料又は無料で情報を提供する情報提供サーバが存在する。例えば、情報提供サーバは、ウェブサイトが構築された典型的なWWWサーバとして稼働して、HTML(Hyper Text Transfer Protocol)形式で記述された情報コンテンツを蓄積し情報公開している。中継サーバは、HTTPを用いてHTMLコンテンツにアクセスすることができる。   There are information providing servers on the network that provide information for a fee or free of charge. For example, the information providing server operates as a typical WWW server on which a website is constructed, accumulates information contents described in an HTML (Hyper Text Transfer Protocol) format, and discloses the information. The relay server can access the HTML content using HTTP.

アプリケーション・サーバは、ロボット装置の機能拡張用のプログラム・モジュールを蓄積しており、ロボット装置からの要求に応じて、プログラム・モジュールを有償又は無償で提供する。   The application server stores program modules for function expansion of the robot apparatus, and provides the program modules for a fee or free of charge according to a request from the robot apparatus.

ロボット装置上で実行されるプログラム・コードは、ネイティブ・コード及びアプリケーション・サーバよりダウンロードされるプログラム・モジュールともに、オブジェクト指向プログラミングにより、設計・作成がなされている。アプリケーション・サーバよりダウンロードされたプログラム・モジュールは、ロボット装置にネイティブのクラスを継承する。   The program code executed on the robot apparatus is designed and created by object-oriented programming for both the native code and the program module downloaded from the application server. The program module downloaded from the application server inherits a class native to the robot apparatus.

ロボット装置においてネイティブなコード部分は、処理の高速化などのため、CやC++などのコンパイラ言語で記述される。一方、アプリケーション・サーバ側で蓄積されているプログラム・モジュールに関しては、ロボット装置へダウンロードした後にコンパイル処理なしで実行可能にするため、スクリプト言語で記述する。   In the robot apparatus, a native code portion is described in a compiler language such as C or C ++ in order to increase processing speed. On the other hand, the program modules stored on the application server side are described in a script language so that they can be executed without compiling after downloading to the robot apparatus.

図3には、本発明の実施形態に係るロボット装置1の行動制御システム100の機能構成を模式的に示している。ロボット装置1は、外部刺激の認識結果や内部状態の変化に応じて行動制御を行なうことができる。さらには、長期記憶機能を備え、外部刺激から内部状態の変化を連想記憶することにより、外部刺激の認識結果や内部状態の変化に応じて行動制御を行なうことができる。   FIG. 3 schematically shows a functional configuration of the behavior control system 100 of the robot apparatus 1 according to the embodiment of the present invention. The robot apparatus 1 can perform behavior control according to the recognition result of the external stimulus and the change in the internal state. Furthermore, by providing a long-term memory function and associatively storing a change in the internal state from an external stimulus, it is possible to perform action control according to the recognition result of the external stimulus and the change in the internal state.

図示の行動制御システム100にはオブジェクト指向プログラミングを採り入れて実装することができる。この場合、各ソフトウェアは、データとそのデータに対する処理手続きとを一体化させた「オブジェクト」というモジュール単位で扱われる。また、各オブジェクトは、メッセージ通信と共有メモリを使ったオブジェクト間通信方法によりデータの受け渡しとInvokeを行なうことができる。   The illustrated behavior control system 100 can adopt and implement object-oriented programming. In this case, each software is handled in units of modules called “objects” in which data and processing procedures for the data are integrated. In addition, each object can perform data transfer and invoke using message communication and an inter-object communication method using a shared memory.

行動制御システム100は、外部環境(Environments)を認識するために、視覚認識機能部101と、聴覚認識機能部102と、接触認識機能部103を備えている。   The behavior control system 100 includes a visual recognition function unit 101, an auditory recognition function unit 102, and a contact recognition function unit 103 in order to recognize an external environment (Environments).

視覚認識機能部(Video)51は、例えば、CCDカメラのような画像入力装置を介して入力された撮影画像を基に、顔認識や色認識などの画像認識処理や特徴抽出を行なう。視覚認識機能部51は、後述する“MultiColorTracker”、“FaceDetector”、“FaceIdentify”といった複数のオブジェクトで構成される。   The visual recognition function unit (Video) 51 performs image recognition processing such as face recognition and color recognition and feature extraction based on a photographed image input via an image input device such as a CCD camera. The visual recognition function unit 51 includes a plurality of objects such as “MultiColorTracker”, “FaceDetector”, and “FaceIdentify” which will be described later.

聴覚認識機能部(Audio)52は、マイクなどの音声入力装置を介して入力される音声データを音声認識して、特徴抽出したり、単語セット(テキスト)認識を行ったりする。聴覚認識機能部52は、後述する“AudioRecog”、“AuthurDecoder”といった複数のオブジェクトで構成される。   The auditory recognition function unit (Audio) 52 performs voice recognition on voice data input through a voice input device such as a microphone, and performs feature extraction or word set (text) recognition. The auditory recognition function unit 52 includes a plurality of objects such as “AudioRecog” and “AuthorDecoder” described later.

接触認識機能部(Tactile)53は、例えば機体の頭部などに内蔵された接触センサによるセンサ信号を認識して、「なでられた」とか「叩かれた」という外部刺激を認識する。   The contact recognition function unit (Tactile) 53 recognizes an external stimulus such as “struck” or “struck” by recognizing a sensor signal from a contact sensor built in the head of the aircraft, for example.

内部状態管理部(ISM:Internal Status Manager)104は、本能や感情といった数種類の情動を数式モデル化して管理しており、上述の視覚認識機能部101と、聴覚認識機能部102と、接触認識機能部103によって認識された外部刺激(ES:ExternalStimula)に応じてロボット装置1の本能や情動といった内部状態を管理する。   An internal status management unit (ISM: Internal Status Manager) 104 manages several types of emotions such as instinct and emotion by modeling them, and includes the above-described visual recognition function unit 101, auditory recognition function unit 102, and contact recognition function. The internal state such as instinct and emotion of the robot apparatus 1 is managed according to an external stimulus (ES: External Stimula) recognized by the unit 103.

感情モデルと本能モデルは、それぞれ認識結果と行動履歴を入力に持ち、感情値と本能値を管理している。行動モデルは、これら感情値や本能値を参照することができる。   The emotion model and the instinct model have the recognition result and the action history as inputs, respectively, and manage the emotion value and the instinct value. The behavior model can refer to these emotion values and instinct values.

本実施形態では、情動についてその存在意義による複数階層で構成され、それぞれの階層で動作する。決定された複数の動作から、そのときの外部環境や内部状態によってどの動作を行なうかを決定するようになっている(後述)。また、それぞれの階層で行動は選択されるが、より低次の行動から優先的に動作を発現していくことにより、反射などの本能的行動や、記憶を用いた動作選択などの高次の行動を1つの個体上で矛盾なく発現することができる。   In the present embodiment, the emotion is composed of a plurality of hierarchies depending on the significance of existence, and operates in each hierarchy. From a plurality of determined operations, which operation is to be performed is determined according to the external environment and internal state at that time (described later). In addition, actions are selected at each level, but by expressing actions preferentially from lower-order actions, higher-order actions such as instinct actions such as reflexes and action selection using memory Behavior can be expressed consistently on one individual.

ロボット装置1は、外部刺激の認識結果や内部状態の変化に応じて行動制御を行なうために、時間の経過とともに失われる短期的な記憶を行なう短期記憶部105と、情報を比較的長期間保持するための長期記憶部106を備えている。短期記憶と長期記憶という記憶メカニズムの分類は神経心理学に依拠する。   The robot apparatus 1 holds information for a relatively long period of time, and a short-term storage unit 105 that performs short-term storage that is lost over time in order to perform behavior control according to the recognition result of external stimuli and changes in internal state. A long-term storage unit 106 is provided. The classification of memory mechanisms, short-term memory and long-term memory, relies on neuropsychology.

短期記憶部(ShortTermMemory)105は、上述の視覚認識機能部101と、聴覚認識機能部102と、接触認識機能部103によって外部環境から認識されたターゲットやイベントを短期間保持する機能モジュールである。例えば、カメラ15からの入力画像を約15秒程度の短い期間だけ記憶する。一方、長期記憶部(LongTermMemory)106は、物の名前など学習により得られた情報を長期間保持するために使用される。長期記憶部106は、例えば、ある行動モジュールにおいて外部刺激から内部状態の変化を連想記憶することができる。   A short-term memory unit (ShortTermMemory) 105 is a functional module that holds targets and events recognized from the external environment by the visual recognition function unit 101, the auditory recognition function unit 102, and the contact recognition function unit 103 for a short period of time. For example, the input image from the camera 15 is stored for a short period of about 15 seconds. On the other hand, a long term memory unit (LongTermMemory) 106 is used to hold information obtained by learning such as the name of an object for a long period of time. For example, the long-term storage unit 106 can associatively store a change in internal state from an external stimulus in a certain behavior module.

また、本実施形態に係るロボット装置1の行動制御は、反射行動部109によって実現される「反射行動」と、状況依存行動階層108によって実現される「状況依存行動」と、熟考行動階層107によって実現される「熟考行動」に大別される。   Also, the behavior control of the robot apparatus 1 according to the present embodiment is performed by the “reflection behavior” realized by the reflection behavior unit 109, the “situation dependence behavior” realized by the situation-dependent behavior hierarchy 108, and the contemplation behavior hierarchy 107. It can be roughly divided into "contemplation behavior" to be realized.

反射的行動部(ReflexiveSituatedBehaviorsLayer)109は、上述の視覚認識機能部101と、聴覚認識機能部102と、接触認識機能部103によって認識された外部刺激に応じて反射的な機体動作を実現する機能モジュールである。反射行動とは、基本的に、センサ入力された外部情報の認識結果を直接受けて、これを分類して、出力行動を直接決定する行動のことである。例えば、人間の顔を追いかけたり、うなずくといった振る舞いは反射行動として実装することが好ましい。   A reflexive behavior unit (Reflexive Situated Behaviors Layer) 109 is a functional module that realizes a reflective body operation in response to an external stimulus recognized by the visual recognition function unit 101, the auditory recognition function unit 102, and the contact recognition function unit 103 described above. It is. The reflex action is basically an action that directly receives the recognition result of the external information input from the sensor, classifies it, and directly determines the output action. For example, a behavior such as chasing a human face or nodding is preferably implemented as a reflex behavior.

状況依存行動階層(SituatedBehaviorsLayer)108は、短期記憶部105並びに長期記憶部106の記憶内容や、内部状態管理部104によって管理される内部状態を基に、ロボット装置1が現在置かれている状況に即応した行動を制御する。   The situation-dependent behavior hierarchy (Situated Behaviors Layer) 108 is based on the storage contents of the short-term storage unit 105 and the long-term storage unit 106 and the internal state managed by the internal state management unit 104. Control responsive behavior.

状況依存行動階層108は、各行動毎にステートマシン(又は状態遷移モデル)を用意しており、それ以前の行動や状況に依存して、センサ入力された外部情報の認識結果を分類して、行動を機体上で発現する。また、状況依存行動階層108は、内部状態をある範囲に保つための行動(「ホメオスタシス行動」とも呼ぶ)も実現し、内部状態が指定した範囲内を越えた場合には、その内部状態を当該範囲内に戻すための行動が出現し易くなるようにその行動を活性化させる(実際には、内部状態と外部環境の両方を考慮した形で行動が選択される)。状況依存行動は、反射行動に比し、反応時間が遅い。   The situation-dependent action hierarchy 108 prepares a state machine (or a state transition model) for each action, and classifies recognition results of external information input from the sensor depending on previous actions and situations. Behavior is expressed on the aircraft. The situation-dependent action hierarchy 108 also realizes an action for keeping the internal state within a certain range (also referred to as “homeostasis action”). When the internal state exceeds the specified range, the internal state is The action is activated so that the action for returning to the range is likely to appear (actually, the action is selected in consideration of both the internal state and the external environment). Situation-dependent behavior has a slower response time than reflex behavior.

熟考行動階層(DeliberativeLayer)107は、短期記憶部105並びに長期記憶部106の記憶内容に基づいて、ロボット装置1の比較的長期にわたる行動計画などを行なう。熟考行動とは、与えられた状況あるいは人間からの命令により、推論やそれを実現するための計画を立てて行なわれる行動のことである。例えば、ロボットの位置と目標の位置から経路を探索することは熟考行動に相当する。このような推論や計画は、ロボット装置1がインタラクションを保つための反応時間よりも処理時間や計算負荷を要する(すなわち処理時間がかかる)可能性があるので、上記の反射行動や状況依存行動がリアルタイムで反応を返しながら、熟考行動は推論や計画を行なう。   A deliberate action hierarchy (Deliberate Layer) 107 performs a relatively long-term action plan of the robot apparatus 1 based on the storage contents of the short-term storage unit 105 and the long-term storage unit 106. A contemplation action is an action that is performed based on a given situation or a command from a human being and making a plan to realize it. For example, searching for a route from the position of the robot and the position of the target corresponds to a contemplation action. Such an inference or plan may require a processing time or a calculation load (that is, a processing time) rather than a reaction time for the robot apparatus 1 to maintain interaction. While responding in real time, the contemplation action makes inferences and plans.

熟考行動階層107や状況依存行動階層108、反射行動部109は、ロボット装置1のハードウェア構成に非依存の上位のアプリケーション・プログラムとして記述することができる。これに対し、ハードウェア依存層制御部(ConfigurationDependentActionsAndReactions)110は、これら上位アプリケーション(「スキーマ」と呼ばれる行動モジュール)からの命令に応じて、関節アクチュエータの駆動などの機体のハードウェア(外部環境)を直接操作する。   The contemplation behavior layer 107, the situation-dependent behavior layer 108, and the reflex behavior unit 109 can be described as higher-level application programs that are independent of the hardware configuration of the robot apparatus 1. On the other hand, the hardware dependent layer control unit (ConfigurationDependentActionsAndReactions) 110 performs hardware (external environment) such as joint actuator drive in accordance with commands from these higher-level applications (behavior modules called “schema”). Operate directly.

図3に示したようなロボット1の行動制御システム100における各機能モジュールは、オブジェクトとして構成される。各オブジェクトは、メッセージ通信と共有メモリを使ったオブジェクト間通信方法によりデータの受け渡しとInvokeを行なうことができる。図4には、本実施形態に係る行動制御システム100のオブジェクト構成を模式的に示している。   Each functional module in the behavior control system 100 of the robot 1 as shown in FIG. 3 is configured as an object. Each object can perform data transfer and invoke by message communication and an inter-object communication method using a shared memory. FIG. 4 schematically shows the object configuration of the behavior control system 100 according to the present embodiment.

視覚認識機能部101は、“FaceDetector”、“MulitColotTracker”、“FaceIdentify”という3つのオブジェクトで構成される。FaceDetectorは、画像フレーム中から顔領域を検出するオブジェクトであり、検出結果をFaceIdentifyに出力する。MulitColotTrackerは、色認識を行なうオブジェクトであり、認識結果をFaceIdentify及びShortTermMemory(短期記憶ブ105を構成するオブジェクト)に出力する。また、FaceIdentifyは、検出された顔画像を手持ちの人物辞書で検索するなどして人物の識別を行ない、顔画像領域の位置、大きさ情報とともに人物のID情報をShortTermMemoryに出力する。   The visual recognition function unit 101 includes three objects, “FaceDetector”, “MultiColtTracker”, and “FaceIdentify”. FaceDetector is an object that detects a face area from an image frame, and outputs the detection result to FaceIdentify. The MultiClotTracker is an object that performs color recognition, and outputs the recognition result to FaceIdentify and ShortTermMemory (an object constituting the short-term memory 105). FaceIdentify also identifies a person by searching the detected face image in a hand-held person dictionary, and outputs the person ID information together with the position and size information of the face image area to ShortTermMemory.

聴覚認識機能部102は、“AudioRecog”と”SpeechRecog”という2つのオブジェクトで構成される。AudioRecogは、マイクなどの音声入力装置からの音声データを受け取って、特徴抽出と音声区間検出を行なうオブジェクトであり、音声区間の音声データの特徴量及び音源方向をSpeechRecogやShortTermMemoryに出力する。SpeechRecogは、AudioRecogから受け取った音声特徴量と音声辞書及び構文辞書を使って音声認識を行なうオブジェクトであり、認識された単語のセットをShortTermMemoryに出力する。   The auditory recognition function unit 102 includes two objects “AudioRecog” and “SpeechRecog”. AudioRecog is an object that receives audio data from an audio input device such as a microphone and performs feature extraction and audio segment detection, and outputs the feature amount and sound source direction of the audio data in the audio segment to SpeedRecog and ShortTermMemory. The SpeechRecog is an object that performs speech recognition using the speech feature amount, the speech dictionary, and the syntax dictionary received from the AudioRecog, and outputs a set of recognized words to the ShortTermMemory.

触覚認識記憶部103は、接触センサからのセンサ入力を認識する“TactileSensor”というオブジェクトで構成され、認識結果はSHortTermMemoryや内部状態を管理するオブジェクトであるInternalStateModel(ISM)に出力する。   The tactile sensation recognition storage unit 103 is composed of an object called “TactileSensor” that recognizes sensor input from the contact sensor, and outputs the recognition result to the ShortTermMemory and an internal state model (ISM) that manages the internal state.

ShortTermMemory(STM)は、短期記憶部105を構成するオブジェクトであり、上述の認識系の各オブジェクトによって外部環境から認識されたターゲットやイベントを短期間保持(例えばカメラ15からの入力画像を約15秒程度の短い期間だけ記憶する)する機能モジュールであり、STMクライアントであるSituatedBehaviorsLayerに対して外部刺激の通知(Notify)を定期的に行なう。   ShortTermMemory (STM) is an object constituting the short-term storage unit 105, and holds targets and events recognized from the external environment by each object of the recognition system described above (for example, an input image from the camera 15 is about 15 seconds). This is a functional module that stores only for a short period of time, and periodically notifies the Stimated BehaviorsLayer, which is an STM client, of external stimuli (Notify).

LongTermMemory(LTM)は、長期記憶部106を構成するオブジェクトであり、物の名前など学習により得られた情報を長期間保持するために使用される。LongTermMemoryは、例えば、ある行動モジュールにおいて外部刺激から内部状態の変化を連想記憶することができる。   LongTermMemory (LTM) is an object that constitutes the long-term storage unit 106 and is used to hold information obtained by learning such as the name of an object for a long period of time. For example, LongTermMemory can associatively store a change in internal state from an external stimulus in a certain behavior module.

InternalStatusManager(ISM)は、内部状態管理部104を構成するオブジェクトであり、本能や感情といった数種類の情動を数式モデル化して管理しており、上述の認識系の各オブジェクトによって認識された外部刺激(ES:ExternalStimula)に応じてロボット装置1の本能や情動といった内部状態を管理する。   The Internal Status Manager (ISM) is an object that constitutes the internal state management unit 104, manages several types of emotions such as instinct and emotion by modeling them, and external stimuli (ES that are recognized by each object of the recognition system described above. : Manages the internal state of the robot apparatus 1 such as instinct and emotion according to (ExternalStimula).

SituatedBehaviorslayer(SBL)は状況依存型行動階層108を構成するオブジェクトである。SBLは、ShorTermMemoryのクライアント(STMクライアント)となるオブジェクトであり、ShorTermMemoryからは定期的に外部刺激(ターゲットやイベント)に関する情報の通知(Notify)を受け取ると、スキーマ(schema)すなわち実行すべき行動モジュールを決定する(後述)。   Situated Behaviorslayer (SBL) is an object that constitutes the context-dependent action hierarchy 108. SBL is an object that becomes a client of ShorTermMemory (STM client), and receives a notification (Notify) of information related to external stimuli (targets and events) periodically from ShorTermMemory, that is, a behavior module to be executed. Is determined (described later).

ReflexiveSituatedBehaviorsLayerは、反射的行動部109を構成するオブジェクトであり、上述した認識系の各オブジェクトによって認識された外部刺激に応じて反射的・直接的な機体動作を実行する。例えば、人間の顔を追いかけたり、うなずく、障害物の検出により咄嗟に避けるといった振る舞いを行なう。   The Reflexive Situated BehaviorsLayer is an object that constitutes the reflexive action unit 109, and executes reflexive and direct body motion according to the external stimulus recognized by each object of the recognition system described above. For example, behaviors such as chasing a human face, nodding, and avoiding by detecting obstacles are performed.

SituatedBehaviorslayerは外部刺激や内部状態の変化などの状況に応じて行動を選択する。これに対し、ReflexiveSituatedBehaviorsLayerは、外部刺激に応じて反射的を行動する。これら2つのオブジェクトによる行動選択は独立して行なわれるため、互いに選択された行動モジュール(スキーマ)を機体上で実行する場合に、ロボット1のハードウェア・リソースが競合して実現不可能なこともある。Resourcemanagerというオブジェクトは、SituatedBehaviorslayerとReflexiveSituatedBehaviorsLayerによる行動選択時のハードウェアの競合を調停する。そして、調停結果に基づいて機体動作を実現する各オブジェクトに通知することにより機体が駆動する。   The Situated Behaviors layer selects an action according to a situation such as an external stimulus or a change in an internal state. In contrast, Reflexive Situated BehaviorsLayer acts reflexively in response to external stimuli. Since the action selection by these two objects is performed independently, when the action modules (schema) selected from each other are executed on the aircraft, the hardware resources of the robot 1 may compete and cannot be realized. is there. The ResourceManager object arbitrates hardware conflicts when selecting actions by the Situated Behaviorslayer and the Reflexive Situated BehaviorsLayer. Then, the airframe is driven by notifying each object that realizes the airframe motion based on the arbitration result.

SoundPerformer、MotionController、LedControllerは、機体動作を実現するオブジェクトである。SoundPerformerは、音声出力を行なうためのオブジェクトであり、ResourceManager経由でSituatedBehaviorLayerから与えられたテキスト・コマンドに応じて音声合成を行ない、ロボット1の機体上のスピーカから音声出力を行なう。また、MotionControllerは、機体上の各関節アクチュエータの動作を行なうためのオブジェクトであり、ResourceManager経由でSituatedBehaviorLayerから手や脚などを動かすコマンドを受けたことに応答して、該当する関節角を計算する。また、LedControllerは、LED19の点滅動作を行なうためのオブジェクトであり、ResourceManager経由でSituatedBehaviorLayerからコマンドを受けたことに応答してLED19の点滅駆動を行なう。   SoundPerformer, MotionController, and LedController are objects that realize the body operation. The SoundPerformer is an object for performing voice output, performs voice synthesis in accordance with a text command given from the SituatedBehaviorLayer via the ResourceManager, and outputs voice from the speaker on the body of the robot 1. The Motion Controller is an object for performing the operation of each joint actuator on the aircraft, and calculates a corresponding joint angle in response to receiving a command to move a hand, leg, or the like from the Situated BehaviorLayer via the ResourceManager. The LedController is an object for performing the blinking operation of the LED 19, and performs the blinking drive of the LED 19 in response to receiving a command from the Situated BehaviorLayer via the ResourceManager.

図5には、状況依存行動階層(SBL)108(但し、反射行動部109を含む)による状況依存行動制御の形態を模式的に示している。認識系101〜103による外部環境の認識結果は、外部刺激として状況依存行動階層108(反射行動部109を含む)に与えられる。また、認識系による外部環境の認識結果に応じた内部状態の変化も状況依存行動階層108に与えられる。そして、状況依存行動階層108では、外部刺激や内部状態の変化に応じて状況を判断して、行動選択を実現することができる。   FIG. 5 schematically shows a form of situation-dependent action control by the situation-dependent action hierarchy (SBL) 108 (however, including the reflex action unit 109). The recognition result of the external environment by the recognition systems 101 to 103 is given to the situation-dependent action hierarchy 108 (including the reflex action part 109) as an external stimulus. In addition, a change in internal state according to the recognition result of the external environment by the recognition system is also given to the situation dependent action hierarchy 108. In the situation-dependent action hierarchy 108, the situation can be determined according to an external stimulus or a change in the internal state, and action selection can be realized.

状況依存行動階層108は、行動モジュール毎にステートマシンを用意しており、それ以前の行動や状況に依存して、センサ入力された外部情報の認識結果を分類して、行動を機体上で発現する。行動モジュールは、機体動作を記述し行動実行に伴う状態遷移(ステートマシン)を実現するaction機能と、action機能において記述された行動の実行を外部刺激や内部状態に応じて評価して状況判断を行なうmonitor機能とを備えたスキーマ(schema)として記述される。図6には、状況依存行動階層108が複数のスキーマによって構成されている様子を模式的に示している。   The state-dependent action hierarchy 108 prepares a state machine for each action module, classifies the recognition results of external information input from the sensor depending on the previous action and situation, and expresses the action on the aircraft To do. The action module describes an action function that describes the body motion and realizes a state transition (state machine) accompanying the action execution, and evaluates the execution of the action described in the action function according to an external stimulus or an internal state, and makes a situation determination. It is described as a schema with a monitor function to perform. FIG. 6 schematically illustrates the situation-dependent action hierarchy 108 configured by a plurality of schemas.

状況依存行動階層108(より厳密には、状況依存行動階層108のうち、通常の状況依存行動を制御する階層)は、複数のスキーマが階層的に連結されたツリー構造として構成され、外部刺激や内部状態の変化に応じてより最適なスキーマを統合的に判断して行動制御を行なうようになっている。ツリーは、例えば動物行動学的(Ethological)な状況依存行動を数式化した行動モデルや、感情表現を実行するためのサブツリーなど、複数のサブツリー(又は枝)を含んでいる。   The situation-dependent action hierarchy 108 (more strictly speaking, the hierarchy that controls the normal situation-dependent action among the situation-dependent action hierarchy 108) is configured as a tree structure in which a plurality of schemas are hierarchically connected. In accordance with changes in the internal state, a more optimal schema is determined in an integrated manner to perform action control. The tree includes a plurality of subtrees (or branches) such as a behavior model obtained by formulating an ethological situation-dependent behavior and a subtree for executing emotion expression.

図7には、状況依存行動階層108におけるスキーマのツリー構造を模式的に示している。同図に示すように、状況依存行動階層108は、短期記憶部105から外部刺激の通知(Notify)を受けるルート・スキーマを先頭に、抽象的な行動カテゴリから具体的な行動カテゴリに向かうように、各階層毎にスキーマが配設されている。例えば、ルート・スキーマの直近下位の階層では、「探索する(Investigate)」、「食べる(Ingestive)」、「遊ぶ(Play)」というスキーマが配設される。そして、「探索する(Investigate)」の下位には、「InvestigativeLocomotion」、「HeadinAirSniffing」、「InvestigativeSniffing」というより具体的な探索行動を記述したスキーマが配設されている。同様に、スキーマ「食べる(Ingestive)」の下位には「Eat」や「Drink」などのより具体的な飲食行動を記述したスキーマが配設され、スキーマ「遊ぶ(Play)」の下位には「PlayBowing」、「PlayGreeting」、「PlayPawing」などのより具体的な遊ぶ行動を記述したスキーマが配設されている。   FIG. 7 schematically shows a schema tree structure in the situation-dependent action hierarchy 108. As shown in the figure, the situation-dependent action hierarchy 108 is directed from the abstract action category to the specific action category, starting with the root schema that receives the notification (Notify) of the external stimulus from the short-term storage unit 105. A schema is arranged for each hierarchy. For example, in the hierarchy immediately below the root schema, schemas “Search”, “Insert”, and “Play” are arranged. Then, below “Investigate”, a schema describing more specific search behaviors such as “Investigative Location”, “HeadinAirSniffing”, and “InvestigativeSniffing” is arranged. Similarly, a schema describing more specific eating and drinking behavior such as “Eat” and “Drink” is arranged below the schema “Ingestive”, and “Schema” is placed below the “Play”. Schemas describing more specific playing behaviors such as “PlayBowing”, “PlayGreeting”, and “PlayPawing” are arranged.

このようにロボット装置100の行動制御プログラムは、スキーマのツリー構造によって構成される。このツリー構造の下位のスキーマは、コンテンツ・サーバからダウンロードし、逐次的にインストールすることができる。例えば、「遊ぶ(play)」というスキーマの具体的な行動を記述したスキーマや、スキーマの次期バージョンなどをダウンロードして、行動制御システムに随時組み込んでいくことができる。   Thus, the behavior control program of the robot apparatus 100 is configured by a schema tree structure. The schema below this tree structure can be downloaded from the content server and installed sequentially. For example, a schema describing specific behavior of the schema “play”, the next version of the schema, and the like can be downloaded and incorporated into the behavior control system as needed.

図7に示したように、各スキーマは外部刺激と内部状態を入力している。また、各スキーマは、少なくともMonitor関数とAction関数を備えている。また、図8には、スキーマの内部構成を模式的に示している。同図に示すように、スキーマは、所定の事象の発生に従がって状態(又はステート)が移り変わっていく状態遷移モデル(ステートマシン)の形式で機体動作を記述したAction関数と、外部刺激や内部状態に応じてAction関数の各状態を評価して活動度レベル値として返すMonitor関数と、Action関数のステートマシンをREADY(準備完了)、ACTIVE(活動中),SLEEP(待機中)いずれかの状態としてスキーマの状態を記憶管理する状態管理部で構成されている。   As shown in FIG. 7, each schema inputs an external stimulus and an internal state. Each schema has at least a Monitor function and an Action function. FIG. 8 schematically shows the internal structure of the schema. As shown in the figure, the schema includes an action function describing the body motion in the form of a state transition model (state machine) in which the state (or state) changes according to the occurrence of a predetermined event, and an external stimulus. The Monitor function that evaluates each state of the Action function according to the internal state and returns it as an activity level value, and the state machine of the Action function is either READY (ready), ACTIVE (active), or SLEEP (standby) The state management unit stores and manages the schema state as the state.

Monitor関数は、外部刺激と内部状態に応じて当該スキーマの活動度レベル(Activation Level:AL値)を算出する関数である。図7に示すようなツリー構造を構成する場合、上位(親)のスキーマは外部刺激と内部状態を引数として下位(子供)のスキーマのMonitor関数をコールすることができ、子供のスキーマはAL値を返り値とする。また、スキーマは自分のAL値を算出するために、さらに子供のスキーマのMonitor関数をコールすることができる。そして、ルートのスキーマには各サブツリーからのAL値が返されるので、外部刺激と内部状態の変化に応じた最適なスキーマすなわち行動を統合的に判断することができる。   The Monitor function is a function that calculates an activity level (Activation Level: AL value) of the schema in accordance with an external stimulus and an internal state. When a tree structure as shown in FIG. 7 is configured, the upper (parent) schema can call the Monitor function of the lower (child) schema with the external stimulus and the internal state as arguments, and the child schema has an AL value. Is the return value. The schema can also call the child's schema Monitor function to calculate its AL value. Since the AL value from each sub-tree is returned to the root schema, the optimum schema corresponding to the external stimulus and the change of the internal state, that is, the behavior can be determined in an integrated manner.

図8で示す例では、スキーマすなわち行動モジュールの管理を行なう行動状態制御部(仮称)は、Monitor関数からの戻り値に基づいて、実行すべき行動を選択し、該当するスキーマのAction関数をコールし、あるいは状態管理部に記憶されているスキーマの状態の移行を指示する。例えば行動誘発評価値としての活動度レベルが最も高いスキーマを選択したり、リソースが競合しないように優先順位に従って複数のスキーマを選択したりする。また、行動状態制御部は、より優先順位の高いスキーマが起動し、リソースの競合が生じた場合、優先順位が下位のスキーマの状態をACTIVEからSLEEPに退避させ、競合状態が解かれるとACTIVEに回復するなど、スキーマの状態を制御する。   In the example shown in FIG. 8, a behavior state control unit (tentative name) that manages a schema, that is, a behavior module, selects an action to be executed based on a return value from the Monitor function, and calls an action function of the corresponding schema. Alternatively, the transition of the schema state stored in the state management unit is instructed. For example, the schema having the highest activity level as the action induction evaluation value is selected, or a plurality of schemas are selected according to the priority order so that resources do not compete. In addition, when a schema having a higher priority is activated and a resource conflict occurs, the behavior state control unit saves the state of the schema having a lower priority from ACTIVE to SLEEP, and when the conflict state is solved, the behavior state control unit changes to ACTIVE. Control schema state, such as recovery.

行動状態の制御機能を、状況依存行動階層108内のスキーマ毎に分散して配置し階層的に構成することができる。図9に示すように。スキーマがツリー構造を形成している場合、上位(親)のスキーマの行動状態制御は、外部刺激と内部状態を引数として下位(子供)のスキーマのMonitor関数をコールし、子供のスキーマから活動度レベルと使用リソースを返り値として受け取る。また、子供のスキーマは、自分の活動度レベルと使用リソースを算出するために、さらに子供のスキーマのMonitor関数をコールする。そして、ルートのスキーマの行動状態制御部には、各サブツリーからの活動度レベルと使用リソースが返されるので、外部刺激と内部状態の変化に応じた最適なスキーマすなわち行動を統合的に判断して、Action関数をコールして、子供スキーマの実行を開始したり中断させたりする。   The behavioral state control function can be distributed and arranged hierarchically for each schema in the situation-dependent behavior hierarchy 108. As shown in FIG. If the schema forms a tree structure, the behavioral state control of the upper (parent) schema calls the Monitor function of the lower (child) schema with the external stimulus and the internal state as arguments, and the activity level from the child schema. Receives the level and resource used as a return value. In addition, the child schema further calls the Monitor function of the child schema in order to calculate its activity level and resource used. Then, the activity level control unit and the resources used from each sub-tree are returned to the action state control unit of the root schema, so that the optimum schema corresponding to the external stimulus and the change of the internal state, that is, the action is integrally determined. , Call the Action function to start or interrupt the execution of the child schema.

本実施形態では、ロボット装置1にネイティブのプログラム・コード部分については、高スピード化などの目的のため、C++などのコンパイラ言語で記述されている。他方、スキーマ・ツリー構造において下位に位置付けられるコード部分など、コンテンツ・サーバからのダウンロードなどにより後から追加されるコード部分については、インストール後のコンパイル処理を不要にするなどの目的のため、python又はその他のスクリプト言語で記述され、インタープリタ上で実行される。   In this embodiment, the program code portion native to the robot apparatus 1 is described in a compiler language such as C ++ for the purpose of increasing the speed. On the other hand, for the purpose of making the compiling process after installation unnecessary for the code part added later by downloading from the content server, such as the code part positioned in the lower level in the schema tree structure, It is written in another script language and executed on the interpreter.

また、本実施形態では、ネイティブのコンパイラ言語で記述されたコード部分、並びにダウンロードされるスクリプト形式のコード部分のいずれにおいても、オブジェクト指向言語として構成されている。ここで、ポリモルフィズムを達成するために、言語間におけるクラス継承の問題が生じる。   In the present embodiment, both the code portion described in the native compiler language and the downloaded script-format code portion are configured as an object-oriented language. Here, the problem of class inheritance between languages arises in order to achieve polymorphism.

ポリモルフィズムを実現するためには、いずれのクラスで関数を呼び出した場合であっても、正しく関数を呼び出すようにする必要がある。例えば、C++などのコンパイラ言語及びpythonなどのスクリプト言語いずれの側のクラスから関数が呼び出された場合であっても、同名の関数がスクリプト言語側のクラスでオーバーライドされている場合にはその関数を呼び出すが、オーバーライドされていない場合には、コンパイラ言語側のベース・クラスにある関数を呼び出さなければならない。   In order to realize polymorphism, it is necessary to call a function correctly regardless of which class calls the function. For example, even if a function is called from a class on either the compiler language such as C ++ or script language such as Python, if the function with the same name is overridden in the class on the script language side, the function is changed. If it is called but not overridden, it must call a function in the base class on the compiler language side.

ここで、正しいポリモルフィズムの動作を以下に示しておく。但し、コンパイラ言語側のクラスをBaseとし、これを継承するスクリプト言語のクラスをScriptSuperとし、呼び出される関数をfuncとする。   Here, the correct polymorphism operation is shown below. However, a class on the compiler language side is Base, a script language class that inherits the class is ScriptSuper, and a function to be called is func.

Figure 2005321954
Figure 2005321954

図10には、C++のようなコンパイラ言語とスクリプト言語でそれぞれ記述されたオブジェクトが混在するオブジェクト指向プログラミング環境下におけるプログラム開発手順を模式的に示している。   FIG. 10 schematically shows a program development procedure in an object-oriented programming environment in which objects described in a compiler language and a script language such as C ++ are mixed.

C++などのコンパイラ言語で記述されたソース・プログラムは、コンパイル処理され、さらに他のライブラリと組み合わせて、実行ライブラリを構成する。   A source program described in a compiler language such as C ++ is compiled and further combined with other libraries to constitute an execution library.

一方、pythonなどのスクリプト言語で記述されたソース・プログラムは、インタープリタ上で実行する。   On the other hand, a source program written in a script language such as Python is executed on an interpreter.

また、C++のソース・プログラムをトランスレータでトランスレートした後、両言語間でクラス継承する際の言語の相違を吸収するためのラッパー・コードを生成する。   Further, after the C ++ source program is translated by the translator, a wrapper code for absorbing the language difference when the class is inherited between the two languages is generated.

このラッパー・コードを自動生成するツールとして、SWIG(前述)などが知られている。SWIGなどの例では、C++側のインスタンスのポインタをスクリプト言語側のクラスで保持することで、スクリプト言語側のクラスからC++側の関数、メソッドを呼び出すことを実現している。しかし、この場合、スクリプト言語側のインスタンスのポインタをC++側で保持していないので、スクリプト言語側のメソッドをC++側のクラスから呼び出すことはできない。これは、インタープリタによる実行時でないと関数のオーバーライドを行なっているかどうかを判断できない、という理由に依拠する。   As a tool for automatically generating this wrapper code, SWIG (described above) is known. In the example of SWIG or the like, by holding the pointer of the instance on the C ++ side in the class on the script language side, it is possible to call the function and method on the C ++ side from the class on the script language side. However, in this case, since the pointer of the instance on the script language side is not held on the C ++ side, the method on the script language side cannot be called from the class on the C ++ side. This relies on the fact that it is not possible to determine whether the function is overridden unless it is run by the interpreter.

そこで、本実施形態では、C++側のクラスのメンバとして、スクリプト言語の継承したオブジェクトの値、継承されたスクリプト言語側のクラスのメンバにC++側の基本クラスのインスタンスの値(this)を持たせることによって、C++とスクリプト言語の相互に呼び出せるラッパー・コードを組み込むようにした。これによってスクリプト言語のクラスをC++のクラスの継承関係を持たせることができる。   Therefore, in the present embodiment, the value of the inherited object of the script language is given as a member of the class on the C ++ side, and the value of the instance (this) of the base class of the C ++ side is given to the member of the inherited script language side class. As a result, a wrapper code that can be called between C ++ and the script language is incorporated. This allows the script language class to have an inheritance relationship with the C ++ class.

図11には、C++とスクリプト言語の相互に呼び出せるラッパー・コードを組み込んだ様子を示している。   FIG. 11 shows a state in which wrapper code that can be called between C ++ and a script language is incorporated.

図示の例では、C++言語側では、ユーザ・クラスをベース・クラスが継承し、さらにスーパー・クラスがベース・クラスを継承している。また、スクリプト言語側では、ラッパー・クラスをスクリプト・ユーザ・クラスが継承している。また、両言語間で、ベース・クラスとラッパー・クラスは継承関係にある。   In the illustrated example, on the C ++ language side, the user class is inherited by the base class, and further, the super class inherits the base class. On the script language side, the script user class inherits the wrapper class. In addition, the base class and the wrapper class have an inheritance relationship between the two languages.

ここで、C++言語側のベース・クラス、並びにスクリプト言語側のラップ・クラスは、両言語間で継承関係を成立させるために設けられた、謂わばダミーのクラスである。実体としては、C++で記述されたユーザ・クラスを継承して、スクリプト・ユーザ・クラスを作成する。   Here, the base class on the C ++ language side and the wrap class on the script language side are so-called dummy classes provided for establishing an inheritance relationship between the two languages. As an entity, a script user class is created by inheriting a user class described in C ++.

ベース・クラスはスクリプト言語の継承したオブジェクトの値、継承されたスクリプト言語側のラップ・クラスのメンバにC++側のベース・クラスのインスタンスの値(this)を持ち、クラスの継承関係が成立する。   The base class has the inherited object value of the script language, and the inherited script language side wrap class member has the C ++ base class instance value (this), and the class inheritance relationship is established.

C++で記述されたユーザ・クラス(UserBase)を継承して、スクリプト・ユーザ・クラス(ScriptSuper)を作成することを考えた場合の、ユーザ・クラス及びベース・クラスのコードを、図12に擬似的に示している。また、図13には、スクリプト言語側でのクラス宣言を擬似的に示している。   The code of the user class and the base class when considering the creation of the script user class (ScriptSuper) by inheriting the user class (UserBase) described in C ++ is simulated in FIG. It shows. FIG. 13 shows a pseudo class declaration on the script language side.

図14を参照しながら、単純にC++側のインスタンスにスクリプト言語側のインスタンスのポインタを相互に持つ場合について考察する。   Referring to FIG. 14, a case will be considered in which the instance of the script language side is mutually held in the instance of the C ++ side.

図示の例では、C++側では、スクリプト言語側のクラスと継承関係を持つために、元のクラスUserBaseからスクリプト言語側のクラスへの継承を直接行なうのではなく、ラッパー・クラスとしてWsuperを用意し、Wsuperへ一旦継承する。   In the illustrated example, since the C ++ side has an inheritance relationship with the class on the script language side, Wsuper is prepared as a wrapper class instead of directly inheriting from the original class UserBase to the class on the script language side. , Once inherited to Wsuper.

同様に、スクリプト言語側では、C++言語側からクラス継承を直接行なうのではなく、ラッパー・クラスとしてScriptBaseを用意する。そして、クラス継承した実体としてのScriptSuperは、ラッパー・クラスScriptBaseをクラス継承した形態とする。ユーザはScriptBaseを継承するとする。   Similarly, the script language side does not directly perform class inheritance from the C ++ language side, but prepares ScriptBase as a wrapper class. Then, the ScriptSuper as a class inherited entity is a form in which the wrapper class ScriptBase is inherited. It is assumed that the user inherits ScriptBase.

スクリプト言語側でラッパークラスScriptBaseのインスタンスが構築される際に、C++側のラッパー・クラスWsuperには、スクリプト言語側のラッパー・クラスScriptBaseのインスタンスのポインタをpy_selfとして格納する(14−1)。また、ScriptBaseには、C++側のラッパー・クラスWsuperのインスタンスのポインタを、thisに格納する(14−2)。これによって、各言語のクラス間で相互に参照することができ、C++側からスクリプト言語の関数を、スクリプト言語側からC++の関数を相互に呼び出すことができる。   When an instance of the wrapper class ScriptBase is constructed on the script language side, the pointer of the instance of the wrapper class ScriptBase on the script language side is stored as py_self in the wrapper class Wsuper on the C ++ side (14-1). In ScriptBase, the pointer of the instance of the wrapper class Wsuper on the C ++ side is stored in this (14-2). Accordingly, classes in each language can be referred to each other, and a script language function can be called from the C ++ side, and a C ++ function can be called from the script language side.

しかし、このように両言語にラッパー・クラスを用意し、それぞれのポインタを格納して相互参照の関係を構成するだけでは、ポリモルフィズムを完全に到達することはできない。すなわち、C++側のクラスに定義されている関数を、これを継承したスクリプト言語側のクラスにおいてオーバーライドしている場合には、正しく呼び出すことができるが、スクリプト言語側のクラスにおいてオーバーライドしていない場合には関数を呼び出すことができない、という問題がある。   However, polymorphism cannot be achieved completely by simply providing wrapper classes in both languages and storing the respective pointers to construct the cross-reference relationship. That is, if the function defined in the C ++ class is overridden in the script language class that inherits it, it can be called correctly, but it is not overridden in the script language class. Has the problem that it cannot call functions.

図15には、C++側のクラスで定義されている関数funcok1が、これを継承しているスクリプト言語側のクラスでオーバーライドされている場合における関数呼び出しの手順について図解している。図示の例では、スクリプト言語側のクラスScriptSuperがクラス継承する際に、関数をオーバーライドする処理を行なっている。   FIG. 15 illustrates a function call procedure when the function funcok1 defined in the class on the C ++ side is overridden by a class on the script language side that inherits the function funcok1. In the example shown in the figure, when a script Script class on the script language side inherits the class, processing for overriding the function is performed.

まず、スクリプト言語のクラス側から関数funcOK1()を呼び出した場合(15−1−1)、funcOK1()はスクリプト言語のクラスでオーバーライドされているので、適切な関数ScriptSuper.funcOK1()を呼び出して戻る(15−1−2)。   First, when the function funcOK1 () is called from the script language class side (15-1-1), since the funcOK1 () is overridden by the script language class, an appropriate function ScriptSuper. Call funcOK1 () and return (15-1-2).

一方、コンパイラ言語のクラス側から関数funcOK1()を呼び出した場合(15−2−1)、funcOK1()はUserBaseからラッパー・クラスであるWSuperにより仮想的(virtual)にオーバーライドされているため、仮想関数により、オーバーライドしている適切な関数WSuper::funcOK1()が自動的に呼び出される(15−2−2)。ポリモルフィズム設計では、継承したクラスにおいて関数がオーバーライドされている場合には、オーバーライドされている関数を順次呼び出すようになっている。   On the other hand, when the function funkOK1 () is called from the class side of the compiler language (15-2-1), since funcOK1 () is overridden virtually from the UserBase by WSuper, which is a wrapper class, The function automatically calls the appropriate overriding function WSuper :: funcOK1 () (15-2-2). In polymorphism design, when a function is overridden in an inherited class, the overridden function is called sequentially.

そして、スクリプト言語のインスタンスのポインタpy_selfから、スクリプト言語でクラス継承したインスタンスを取り出し、funcOK1()を呼び出す。Wsuperには、スクリプト言語側のラッパー・クラスScriptBaseのインスタンスのポインタをpy_selfとして格納しているので、スクリプト言語側では、まずラッパー・クラスの関数ScriptBase.funcOK1()が適切に呼び出される。そして、インタープリタ処理により、この関数をオーバーライドしている適切な関数ScriptSuper.funcOK1が自動的に呼び出される(15−2−3)。   Then, an instance inherited by the script language is taken out from the pointer py_self of the script language instance, and funcOK1 () is called. In Wsuper, the pointer of the instance of the wrapper class ScriptBase on the script language side is stored as py_self. Therefore, on the script language side, first, the function ScriptBase. funcOK1 () is called appropriately. Then, an appropriate function ScriptSuper. funcOK1 is automatically called (15-2-3).

このように、C++側のクラスで定義されている関数がスクリプト言語側のクラスでオーバーライドされている場合には、適切に関数を呼び出すことができる。ところが、スクリプト言語側でオーバーライドされていない場合には、図14に示した相互参照の仕組みだけでは、関数を正しく呼び出すことができない場合がある。   As described above, when the function defined in the class on the C ++ side is overridden in the class on the script language side, the function can be appropriately called. However, if it is not overridden on the script language side, the function may not be called correctly only by the cross-reference mechanism shown in FIG.

図16には、C++側のクラスで定義されている関数funcNGが、これを継承しているスクリプト言語側のクラスでオーバーライドされていない場合における関数呼び出しの手順について図解している。図示のように、スクリプト言語側のクラスScriptSuperがScriptBaseをクラス継承する際に、関数をオーバーライドする処理を行なっていない。何故ならば、ベース・クラス側ではデフォルトではクラス継承時に関数をオーバーライドしないようになっているからである。   FIG. 16 illustrates the function call procedure when the function funcNG defined in the class on the C ++ side is not overridden in the class on the script language side that inherits the function funcNG. As shown in the figure, when the script Script class ScriptSuper inherits ScriptBase, the function is not overridden. This is because the base class does not override the function at class inheritance by default.

スクリプト言語のクラス側から関数funcNG()を呼び出した場合(16−1)、funcNG()はスクリプト言語で継承したクラスScriptSuperでオーバーライドされていないので、関数ScriptBase.funcNG()が呼び出される(16−2)。ポリモルフィズム設計では、継承先のクラスに該当する関数がない場合には、継承した元のクラス側の関数を呼び出すようになっている。   When the function funcNG () is called from the class side of the script language (16-1), since funcNG () is not overridden by the class ScriptSuper inherited in the script language, the function ScriptBase. funcNG () is called (16-2). In the polymorphism design, when there is no corresponding function in the inheritance destination class, the inherited original class function is called.

ここで、UserBaseはラッパークラスであり、クラスでオーバーライドされている関数の実体はないことから、次いで、元のクラス側の関数を呼び出す。ScriptBaseには、コンパイラ言語側のラッパー・クラスWsuperのインスタンスのポインタをthisに格納しているので、コンパイラ言語側では、Wsuperを経由して、元のクラスUserBaseの関数Base::funcNG()が呼び出される(16−3)。   Here, UserBase is a wrapper class, and since there is no function overridden in the class, the function on the original class side is then called. In ScriptBase, since the pointer of the instance of the wrapper class Wsuper on the compiler language side is stored in this, the function Base :: funcNG () of the original class UserBase is called on the compiler language side via Wsuper. (16-3).

関数Base::funcNG()は、WSuper::funcNG()でオーバーライドされているので、自動的にWSuper::funcNG()が呼び出される(16−4)。ここで、WSuper::funcNG()が自動的に呼び出されるのは、C++で仮想関数を用いるためであり、ScriptBaseに格納してあるC++のインスタンスはWSuperで構築されていることから、WSuper::funcNG()が自動的に呼び出される。   Since the function Base :: funcNG () is overridden by WSuper :: funcNG (), WSuper :: funcNG () is automatically called (16-4). Here, the reason why WSuper :: funcNG () is automatically called is to use a virtual function in C ++, and the instance of C ++ stored in ScriptBase is constructed by WSuper. funcNG () is called automatically.

そして、スクリプト言語のインスタンスのポインタpy_selfから、スクリプト言語でクラス継承したインスタンスを取り出し、関数を呼び出す。Wsuperには、スクリプト言語側のラッパー・クラスScriptBaseのインスタンスのポインタをpy_selfとして格納しているので、スクリプト言語側では、まずラッパー・クラスの関数ScriptBase::funcNG()が呼び出される(16−5)。しかし、この場合はScriptSuperで関数をオーバーライドしていないことから、元のクラスUserBaseの関数Base::funcNG()が呼び出され(16−3)、さらにこれをオーバーライドしているWSuper::funcNG()が自動的に呼び出されてしまい(16−4)、無限ループに陥ってしまう。   Then, an instance that inherits the class in the script language is taken out from the pointer py_self of the script language instance, and the function is called. In Wsuper, the pointer of the instance of the wrapper class ScriptBase on the script language side is stored as py_self. Therefore, the script class function ScriptBase :: funcNG () is first called on the script language side (16-5). . However, in this case, since the function is not overridden by ScriptSuper, the function Base :: funcNG () of the original class UserBase is called (16-3), and further, WSuper :: funcNG () overriding this is called. Is automatically called (16-4) and falls into an infinite loop.

一方、C++のクラス側から関数funcNG()を呼び出した場合(16−6)、関数Base::funcNG()は、WSuper::funcNG()でオーバーライドされているので、自動的にWSuper::funcNG()が呼び出される(16−4)。ここで、WSuper::funcNG()が自動的に呼び出されるのは、C++で仮想関数を用いるためであり、ScriptBaseに格納してあるC++のインスタンスはWSuperで構築されていることから、WSuper::funcNG()が自動的に呼び出される。   On the other hand, when the function funcNG () is called from the class side of C ++ (16-6), the function Base :: funcNG () is overridden by WSuper :: funcNG (), so WSuper :: funcNG automatically. () Is called (16-4). Here, the reason why WSuper :: funcNG () is automatically called is to use a virtual function in C ++, and the instance of C ++ stored in ScriptBase is constructed by WSuper. funcNG () is called automatically.

そして、スクリプト言語のインスタンスのポインタpy_selfから、スクリプト言語でクラス継承したインスタンスを取り出し、関数を呼び出す。Wsuperには、スクリプト言語側のラッパー・クラスScriptBaseのインスタンスのポインタをpy_selfとして格納しているので、スクリプト言語側では、まずラッパー・クラスの関数ScriptBase::funcNG()が呼び出される(16−5)。しかし、この場合はScriptSuperで関数をオーバーライドしていないことから、元のクラスUserBaseの関数Base::funcNG()が呼び出され(16−3)、さらにこれをオーバーライドしているWSuper::funcNG()が自動的に呼び出されるので(16−4)、無限ループに陥ってしまう(同上)。   Then, an instance that inherits the class in the script language is taken out from the pointer py_self of the script language instance, and the function is called. In Wsuper, the pointer of the instance of the wrapper class ScriptBase on the script language side is stored as py_self. Therefore, the script class function ScriptBase :: funcNG () is first called on the script language side (16-5). . However, in this case, since the function is not overridden by ScriptSuper, the function Base :: funcNG () of the original class UserBase is called (16-3), and further, WSuper :: funcNG () overriding this is called. Is automatically called (16-4), it falls into an infinite loop (same as above).

図17には、スクリプト言語側の継承クラスScriptSuperにおいて関数func()が定義されていない場合に、ScriptSuperのインスタンスをC++側から関数func()が呼び出されたときの処理を模式的に示している。   FIG. 17 schematically shows the processing when the function func () is called from the C ++ side for the instance of ScriptSuper when the function func () is not defined in the inheritance class ScriptSuper on the script language side. .

まず、C++側のクラスUserBaseから関数func()を呼ぶ。ここで、UserBase::func()は仮想関数なので、WSuper::func()が呼ばれる。   First, the function func () is called from the class UserBase on the C ++ side. Here, since UserBase :: func () is a virtual function, WSuper :: func () is called.

WSuper::func()が呼ばれると、WSuper::func()メンバ変数py_thisの関数func()を求める。   When WSuper :: func () is called, the function func () of the WSuper :: func () member variable py_this is obtained.

ここで、ScriptSuperでは関数func()を定義していない(オーバーライドしていない)ため、得られる関数はScriptBaseのものとなり、ScriptBase.func()を呼び出す。   Here, since the function Func () is not defined (not overridden) in ScriptSuper, the obtained function is that of ScriptBase, and ScriptBase. Call func ().

ScriptBase.func()では、関数this.func()を呼び出す。thisのクラスはWSuperであることからWSuper::func()が呼ばれる。   ScriptBase. In func (), the function this. Call func (). Since the class of this is WSuper, WSuper :: func () is called.

すなわち、WSuper::func()が呼ばれ、無限ループに陥ってしまう。   That is, WSuper :: func () is called and falls into an infinite loop.

このような無限ループを解決する1つの方法として、コンパイラ言語側で用意するラッパー・クラスWSuperに、スクリプト言語側で継承されているクラス(但し、ラッパー・クラスを除く)に関数がオーバーライドされているかどうかをチェックする判断機能を装備することを挙げることができる。   One way to solve such an infinite loop is whether the function is overridden in the class inherited on the script language side (excluding the wrapper class) in the wrapper class WSuper prepared on the compiler language side It can be mentioned that a judgment function to check whether or not is equipped.

すなわち、WSuperに格納されているスクリプト言語側のインスタンスに属するクラスを取り出し、そのクラスのメンバ関数がオーバーライドされているかどうかを、WSuperでオーバーライドしている関数WSuper::funcOK()が呼び出される度に毎回確認する。   That is, a class belonging to an instance on the script language side stored in WSuper is extracted, and whether or not the member function of the class is overridden, the function WSuper :: funcOK () overridden in WSuper is called each time. Check every time.

そして、スクリプト言語側でクラス継承したScriptSuperにおいて関数がオーバーライドされているときにはスクリプト言語側の関数を呼び出すが、オーバーライドされていない場合にはスクリプト言語側の関数を呼び出さず、UserBaseから関数Base::funcOKを呼び出すようにし、無限ループへの突入を回避する。   Then, when the function is overridden in the script superscript script superscript, the script language side function is called. When the function is not overridden, the script language side function is not called, and the function Base :: funcOK is called from UserBase. To avoid entering an infinite loop.

図18には、コンパイラ言語側で用意するラッパー・クラスWSuperに、スクリプト言語側で継承されているクラスに関数がオーバーライドされているかどうかをチェックする判断機能を装備した場合における関数呼び出しの手順について図解している。図示の例では、スクリプト言語側のクラスScriptSuperがScriptBaseをクラス継承する際に、関数をオーバーライドする処理を行なっていない。   FIG. 18 illustrates the function call procedure when the wrapper class WSuper prepared on the compiler language side is equipped with a determination function for checking whether or not the function is overridden in the class inherited on the script language side. doing. In the illustrated example, when the class ScriptSuper on the script language side inherits ScriptBase, the process of overriding the function is not performed.

スクリプト言語のクラス側から関数funcOK1()を呼び出した場合(18−1−1)、funcOK1()はスクリプト言語で継承したクラスScriptSuperでオーバーライドされていないので、関数ScriptBase.funcOK1()が呼び出される(18−1−2)。ポリモルフィズム設計では、継承先のクラスに該当する関数がない場合には、継承した元のクラス側の関数を呼び出すようになっている。   When the function funcOK1 () is called from the class side of the script language (18-1-1), since funcOK1 () is not overridden by the class ScriptSuper inherited by the script language, the function ScriptBase. funcOK1 () is called (18-1-2). In the polymorphism design, when there is no corresponding function in the inheritance destination class, the inherited original class function is called.

UserBaseはラッパークラスであり、クラスでオーバーライドされている関数の実体はないことから、次いで、元のクラス側の関数を呼び出す。ScriptBaseには、コンパイラ言語側のラッパー・クラスWsuperのインスタンスのポインタをthisに格納しているので、コンパイラ言語側では、ラッパー・クラスWSuperの関数WSuper::funcOK1()が呼び出される(18−1−3)。   UserBase is a wrapper class, and since there is no function overridden in the class, the function on the original class side is then called. In ScriptBase, the pointer of the instance of the wrapper class Wsuper on the compiler language side is stored in this, so the function WSuper :: funcOK1 () of the wrapper class WSuper is called on the compiler language side (18-1- 3).

ここで、WSuper::funcOK1()内部では、スクリプト言語側のラッパー・クラスScriptBaseのインスタンスのポインタpy_selfを取り出し、py_selfが属しているクラスを求める。そのクラスがfunkOK1()をオーバーライドしていれば、スクリプト言語側の関数funcOK1()を呼び出すが、そうでなければ、自身がオーバーライドしている関数Base::funcOK1()を呼び出す。図示の例では、py_selfが属しているスクリプト言語側のクラスScriptSuperは関数をオーバーライドしていないので、関数funcOK1()を呼び出す(18−1−4)。   Here, in WSuper :: funcOK1 (), a pointer py_self of an instance of the wrapper class ScriptBase on the script language side is taken out, and a class to which py_self belongs is obtained. If the class overrides funkOK1 (), the function funcOK1 () on the script language side is called; otherwise, the function Base :: funcOK1 () overridden by itself is called. In the illustrated example, the script ScriptSuper class to which py_self belongs does not override the function, so the function funkOK1 () is called (18-1-4).

一方、C++のクラス側から関数funcok1()を呼び出した場合(18−2−1)、ラッパー・クラスWSuperにおいて定義されている関数WSuper::funcOK1()でオーバーライドされているので、WSuper::funcOK1()が自動的に呼び出される(18−2−2)。   On the other hand, when the function funcok1 () is called from the C ++ class side (18-2-1), it is overridden by the function WSuper :: funcOK1 () defined in the wrapper class WSSuper, so WSuper :: funcOK1 () Is automatically called (18-2-2).

ここで、WSuper::funcOK1()内部では、スクリプト言語側のラッパー・クラスScriptBaseのインスタンスのポインタpy_selfを取り出し、py_selfが属しているクラスを求める。そして、py_selfが属しているスクリプト言語側のクラスScriptSuperは関数をオーバーライドしていないので、関数funcOK1()を呼び出す(同上)。   Here, in WSuper :: funcOK1 (), a pointer py_self of an instance of the wrapper class ScriptBase on the script language side is taken out, and a class to which py_self belongs is obtained. Then, the script language class ScriptSuper to which py_self belongs does not override the function, so the function funkOK1 () is called (same as above).

図19及び図20には、上述した解決方法を適用した場合における、C++でのクラス定義、及びpythonでのクラス定義の記述例をそれぞれ示している。   FIG. 19 and FIG. 20 show description examples of the class definition in C ++ and the class definition in Python when the above-described solution is applied.

なお、スクリプト言語側のクラスScriptSuperがScriptBaseをクラス継承する際に、関数をオーバーライドする処理を行なっている場合には、関数呼び出しの動作は、図15に示した場合と同様となるので、ここでは説明を省略する。   Note that when the script language class ScriptSuper inherits ScriptBase, when the function is overridden, the function call operation is the same as that shown in FIG. Description is omitted.

また、図16に示したような無限ループを解決する他の方法として、コンパイラ言語側で用意するラッパー・クラスWSuperに格納されているスクリプト言語側のインスタンスに属するクラスを取り出し、どの関数を呼び出すべきかをスクリプト言語側のクラスで判断することを挙げることができる。   As another method for solving the infinite loop as shown in FIG. 16, a class belonging to an instance on the script language side stored in a wrapper class WSuper prepared on the compiler language side is taken out, and which function should be called Judging by the class on the script language side can be mentioned.

この場合、C++のラッパー・クラスWSuperがベース・クラスUserBaseをクラス継承する際に、ベース・クラスUserBaseの関数をオーバーライドする以外に、当該ベース・クラスを呼び出すための擬似オーバーライド関数を用意する。また、スクリプト言語側で、WSuperを継承するラッパー・クラスScriptBaseでは、ベース・クラスUserBaseの関数をオーバーライドするが、この関数はいずれの関数を呼び出すべきかを判断する。   In this case, when the C ++ wrapper class WSuper inherits the base class UserBase, in addition to overriding the function of the base class UserBase, a pseudo override function for calling the base class is prepared. On the script language side, the wrapper class ScriptBase that inherits WSuper overrides the function of the base class UserBase. This function determines which function should be called.

ベース・クラスUserBaseにfunc()という関数が存在する場合、ラッパー・クラスWSuperには、UserBaseのfunc()を呼び出すコードが記述された擬似オーバーライド関数func_Base()を書いておく。そして、スクリプト言語側のラッパー・クラスScriptBaseでは、func()をオーバーライドするとともに、このfunc()には、オーバーライドした基の関数を呼び出すときには、これに代えて擬似オーバーライド関数WSuper::func_Base()を呼び出すように記述する。   When a function called func () exists in the base class UserBase, a pseudo-override function func_Base () in which a code that calls the func () of UserBase is written is written in the wrapper class WSSuper. In the wrapper class ScriptBase on the script language side, func () is overridden, and when calling the overridden base function in this func (), a pseudo-override function WSuper :: func_Base () is used instead. Write to call.

図21には、どの関数を呼び出すべきかをスクリプト言語側のクラスで判断する機能を装備した場合における関数呼び出しの手順について図解している。図示の例では、スクリプト言語側のクラスScriptSuperがScriptBaseをクラス継承する際に、関数をオーバーライドする処理を行なっていない。   FIG. 21 illustrates a function call procedure when a function for determining which function is to be called by a class on the script language side is provided. In the illustrated example, when the class ScriptSuper on the script language side inherits ScriptBase, the process of overriding the function is not performed.

スクリプト言語のクラス側から関数funcOK2()を呼び出した場合(21−1−1)、funcOK2()はスクリプト言語で継承したクラスScriptSuperでオーバーライドされていないので、関数ScriptBase.funcOK2()が自動的に呼び出される(21−1−2)。ポリモルフィズム設計では、継承先のクラスに該当する関数がない場合には、継承した元のクラス側の関数を呼び出すようになっている。   When the function funcOK2 () is called from the script language class side (21-1-1), since funcOK2 () is not overridden by the script Scriptclass inherited by the script language, the function ScriptBase. funcOK2 () is automatically called (21-1-2). In the polymorphism design, when there is no corresponding function in the inheritance destination class, the inherited original class function is called.

ScriptBaseはラッパークラスであり、クラスでオーバーライドされている関数の実体はないことから、次いで、元のクラス側の関数を呼び出す。ScriptBaseには、コンパイラ言語側のラッパー・クラスWsuperのインスタンスのポインタをthisに格納しているので、コンパイラ言語側では、ラッパー・クラスWSuperを呼び出す。ここで、funcOK2()はスクリプト言語で継承したクラスScriptSuperでオーバーライドされていないので、ScriptBase::funcOK2()がオーバーライドした関数を呼び出すときには、擬似オーバーライド関数WSuper::funcOK2_Base()が呼び出される(21−1−3)。そして、この擬似オーバーライド関数WSuper::funcOK2_Base()は、UserBaseのfuncOK2()を呼び出す(21−1−4)。   Since ScriptBase is a wrapper class and there is no entity that is overridden in the class, the original class-side function is then called. In ScriptBase, the pointer of the instance of the wrapper class Wsuper on the compiler language side is stored in this, so the compiler class calls the wrapper class WSuper. Here, since funcOK2 () is not overridden by the class ScriptSuper inherited in the script language, when calling the function overridden by ScriptBase :: funcOK2 (), the pseudo-override function WSSuper :: funcOK2_Base () is called (21-). 1-3). Then, the pseudo override function WSuper :: funcOK2_Base () calls userBase funcOK2 () (21-1-4).

一方、C++のクラス側から関数funcOK2()を呼び出した場合(21−2−1)、ラッパー・クラスWSuperにおいて定義されている関数WSuper::funcOK2()でオーバーライドされているので、WSuper::funcOK2()が自動的に呼び出される(21−2−2)。   On the other hand, when the function funcOK2 () is called from the class side of C ++ (21-2-1), it is overridden by the function WSuper :: funcOK2 () defined in the wrapper class WSuper, so WSuper :: funcOK2 () Is automatically called (21-2-2).

そして、WSuper::funcOK2()内部では、スクリプト言語側のインスタンスのポインタpy_selfから、ScriptBaseでオーバーライドされている関数funcOK2を呼び出す(21−2−3)。   Then, in WSuper :: funcOK2 (), the function funcOK2 overridden in ScriptBase is called from the pointer py_self of the instance on the script language side (21-2-3).

ScriptBaseはラッパークラスであり、クラスでオーバーライドされている関数の実体はないことから、次いで、元のクラス側の関数を呼び出す。ScriptBaseには、コンパイラ言語側のラッパー・クラスWsuperのインスタンスのポインタをthisに格納しているので、コンパイラ言語側では、ラッパー・クラスWSuperを呼び出す。ここで、funcOK2()はスクリプト言語で継承したクラスScriptSuperでオーバーライドされていないので、ScriptBase::func()がオーバーライドした関数を呼び出すときには、擬似オーバーライド関数WSuper::funcOK2_Base()が呼び出される(21−2−3)。そして、この擬似オーバーライド関数WSuper::funcOK2_Base()は、UserBaseのfunc()を呼び出す(同上)。   Since ScriptBase is a wrapper class and there is no entity that is overridden in the class, the original class-side function is then called. In ScriptBase, the pointer of the instance of the wrapper class Wsuper on the compiler language side is stored in this, so the compiler class calls the wrapper class WSuper. Here, since funcOK2 () is not overridden by the class ScriptSuper inherited in the script language, when calling the function overridden by ScriptBase :: func (), the pseudo-override function WSuper :: funcOK2_Base () is called (21-). 2-3). Then, the pseudo override function WSuper :: funcOK2_Base () calls UserBase func () (same as above).

図22及び図23には、上述した解決方法を適用した場合における、C++でのクラス定義、及びpythonでのクラス定義の記述例をそれぞれ示している。   FIG. 22 and FIG. 23 show description examples of the class definition in C ++ and the class definition in Python when the above-described solution is applied.

なお、スクリプト言語側のクラスScriptSuperがScriptBaseをクラス継承する際に、関数をオーバーライドする処理を行なっている場合には、関数呼び出しの動作は、図15に示した場合と同様となるので、ここでは説明を省略する。   Note that when the script language class ScriptSuper inherits ScriptBase, when the function is overridden, the function call operation is the same as that shown in FIG. Description is omitted.

図21に示した実施形態の変形例として、スクリプト言語側から呼び出す専用のラッパー・クラスWrapをC++側に用意するようにしてもよい。   As a modification of the embodiment shown in FIG. 21, a dedicated wrapper class Wrap called from the script language side may be prepared on the C ++ side.

スクリプト言語のクラスに関数がオーバーライドされていない場合に、C++側でクラス継承を行なう際に、ベース・クラスUserBaseの関数をオーバーライドしたラッパー・クラスWSuperのインスタンスを生成する以外に、UserBaseのfunc()を呼び出すためのコードが記述された擬似オーバーライド関数func_Base()を定義したラッパー・クラスWrapのインスタンスを生成する。擬似オーバーライド関数func_Base()には、UserBaseのfunc()を呼び出すことが書かれている。また、スクリプト言語側で、WSuperを継承するラッパー・クラスScriptBaseでは、ベース・クラスUserBaseの関数をオーバーライドするが、C++側のラッパー・クラスのいずれの関数を呼び出すべきかではなく、いずれのラッパー・クラスを呼び出すべきかを判断する。   When the function is not overridden in the script language class, when performing class inheritance on the C ++ side, in addition to generating an instance of the wrapper class WSSuper overriding the base class UserBase function, UserBase func () An instance of a wrapper class Wrap defining a pseudo override function func_Base () in which a code for calling is written is generated. In the pseudo override function func_Base (), it is written that func () of UserBase is called. On the script language side, in the wrapper class ScriptBase that inherits WSuper, the function of the base class UserBase is overridden, but not which function of the C ++ side wrapper class should be called, which wrapper class Determine whether to call.

図24には、この場合の関数呼び出しの実行順序について図解している。図示の例では、スクリプト言語側のクラスScriptSuperがScriptBaseをクラス継承する際に、関数をオーバーライドする処理を行なっている。   FIG. 24 illustrates the execution order of function calls in this case. In the illustrated example, when the script Script class ScriptSuper inherits ScriptBase, the function is overridden.

まず、スクリプト言語のクラス側から関数funcOK3()を呼び出した場合(24−1−1)、funcOK3()はスクリプト言語のクラスでオーバーライドされているので、適切な関数ScriptSuper.funcOK3()を呼び出して戻る(24−1−2)。   First, when the function funcOK3 () is called from the script language class side (24-1-1), since funcOK3 () is overridden by the script language class, an appropriate function ScriptSuper. Call func3 () and return (24-1-2).

一方、コンパイラ言語のクラス側から関数funcOK3()を呼び出した場合(24−2−1)、funcOK3()はUserBaseからラッパー・クラスであるWSuperにより仮想的(virtual)にオーバーライドされているため、仮想関数により、オーバーライドしている適切な関数WSuper::funcOK3()が自動的に呼び出される(24−2−2)。ポリモルフィズム設計では、継承したクラスにおいて関数がオーバーライドされている場合には、オーバーライドされている関数を順次呼び出すようになっている。   On the other hand, when function funcOK3 () is called from the class side of the compiler language (24-2-1), funcOK3 () is virtually overridden by WSuper, which is a wrapper class, from UserBase. The function automatically calls the appropriate overriding function WSuper :: funcOK3 () (24-2-2). In polymorphism design, when a function is overridden in an inherited class, the overridden function is called sequentially.

そして、スクリプト言語のインスタンスのポインタpy_selfから、スクリプト言語でクラス継承したインスタンスを取り出し、funcOK3()を呼び出す。Wsuperには、スクリプト言語側のラッパー・クラスScriptBaseのインスタンスのポインタをpy_selfとして格納しているので、スクリプト言語側では、まずラッパー・クラスの関数ScriptBase.funcOK3()が適切に呼び出される。そして、インタープリタ処理により、この関数をオーバーライドしている適切な関数ScriptSuper.funcOK3が自動的に呼び出される(24−2−3)。   Then, an instance inherited in the script language from the script language instance pointer py_self is extracted, and funcOK3 () is called. In Wsuper, the pointer of the instance of the wrapper class ScriptBase on the script language side is stored as py_self. Therefore, on the script language side, first, the function ScriptBase. funcOK3 () is called appropriately. Then, an appropriate function ScriptSuper. funcOK3 is automatically called (24-2-3).

また、図25には、スクリプト言語側のクラスScriptSuperがScriptBaseをクラス継承する際に、関数をオーバーライドする処理を行なっていないときの関数呼び出しの実行順序について図解している。   FIG. 25 illustrates the execution sequence of function calls when the script language class ScriptSuper inherits ScriptBase and does not perform the process of overriding the function.

スクリプト言語のクラス側から関数funcOK4()を呼び出した場合(25−1−1)、funcOK4()はスクリプト言語で継承したクラスScriptSuperでオーバーライドされていないので、関数ScriptBase.funcOK4()が自動的に呼び出される(25−1−2)。ポリモルフィズム設計では、継承先のクラスに該当する関数がない場合には、継承した元のクラス側の関数を呼び出すようになっている。   When the function funcOK4 () is called from the class side of the script language (25-1-1), since funcOK4 () is not overridden by the class ScriptSuper inherited in the script language, the function ScriptBase. funcOK4 () is automatically called (25-1-2). In the polymorphism design, when there is no corresponding function in the inheritance destination class, the inherited original class function is called.

ScriptBaseはラッパークラスであり、クラスでオーバーライドされている関数の実体はないことから、次いで、元のクラス側の関数を呼び出す。ここで、funcOK4()はスクリプト言語で継承したクラスScriptSuperでオーバーライドされていないので、C++側のラッパー・クラスWrapを呼び出す(25−1−3)。このラッパー・クラスWrapには擬似オーバーライド関数WSuper::funcOK4_Base()が定義されており、UserBaseのfuncOK4()を呼び出す(25−1−4)。   Since ScriptBase is a wrapper class and there is no entity that is overridden in the class, the original class-side function is then called. Here, since funcOK4 () is not overridden by the class ScriptSuper inherited in the script language, the C ++ side wrapper class Wrap is called (25-1-3). This wrapper class Wrap defines a pseudo-override function WSuper :: funcOK4_Base (), and calls FunBase4 () of UserBase (25-1-4).

一方、C++のクラス側から関数funcOK4()を呼び出した場合(25−2−1)、ラッパー・クラスWSuperにおいて定義されている関数WSuper::funcOK4()でオーバーライドされているので、WSuper::funcOK4()が自動的に呼び出される(25−2−2)。   On the other hand, when the function funcOK4 () is called from the class side of C ++ (25-2-1), it is overridden by the function WSuper :: funcOK4 () defined in the wrapper class WSuper, so WSuper :: funcOK4 () Is automatically called (25-2-2).

そして、WSuper::funcOK4()内部では、スクリプト言語側のインスタンスのポインタpy_selfから、ScriptBaseでオーバーライドされている関数funcOK4を呼び出す(25−2−3)。   Then, in WSuper :: funcOK4 (), the function funcOK4 overridden by ScriptBase is called from the pointer py_self of the instance on the script language side (25-2-3).

ScriptBaseはラッパークラスであり、クラスでオーバーライドされている関数の実体はないことから、次いで、元のクラス側の関数を呼び出す。ここで、funcOK4()はスクリプト言語で継承したクラスScriptSuperでオーバーライドされていないので、C++側のラッパー・クラスWrapを呼び出す。このラッパー・クラスWrapには擬似オーバーライド関数WSuper::funcOK4_Base()が定義されており、UserBaseのfuncOK4()を呼び出す(同上)。   Since ScriptBase is a wrapper class and there is no entity that is overridden in the class, the original class-side function is then called. Here, since funcOK4 () is not overridden by the class ScriptSuper inherited in the script language, the C ++ side wrapper class Wrap is called. This wrapper class Wrap defines a pseudo-override function WSuper :: funcOK4_Base (), and calls UserBase funcOK4 () (same as above).

図26及び図27には、上述した解決方法を適用した場合における、C++でのクラス定義、及びpythonでのクラス定義の記述例をそれぞれ示している。   FIG. 26 and FIG. 27 respectively show description examples of the class definition in C ++ and the class definition in Python when the above-described solution is applied.

図28には、C++側のベース・クラスUserBaseを継承するスクリプト言語側のクラスScriptSuperのインスタンスを構築するとき(コンストラクタ)の実行順序を図解している。   FIG. 28 illustrates the execution order when constructing an instance of a script language-side class ScriptSuper that inherits the base class UserBase on the C ++ side (constructor).

まず、ScriptSuper.__init__()が呼ばれる(28−1)。   First, ScriptSuper. __Init __ () is called (28-1).

次いで、ScriptBase.__init__()を呼び出す(28−2)。   Next, ScriptBase. Call __init __ () (28-2).

次いで、WSuper::WSuper()を呼び出す(28−3)。   Next, WSuper :: WSuper () is called (28-3).

このとき、C++では、自動的にベース・クラスから初期化されるため、UserBase::UserBase()が呼ばれる(28−4)。   At this time, since C ++ is automatically initialized from the base class, UserBase :: UserBase () is called (28-4).

そして、UserBase::UserBase()の後、WSuper::WSuper()が呼ばれる(28−5)。   And after UserBase :: UserBase (), WSuper :: WSuper () is called (28-5).

WSuper::WSuper()が終わった後、ScriptBaseのthisにC++のインスタンスのポインタを格納する(28−6)。   After the completion of WSuper :: WSuper (), the pointer of the C ++ instance is stored in this of ScriptBase (28-6).

C++のメンバ変数に、スクリプト言語側のインスタンスのポインタを書き込むため、WSuper.set_self()を呼ぶ(28−7)。   In order to write a pointer of an instance on the script language side to a member variable of C ++, WSuper. Set_self () is called (28-7).

WSuper::set_self()でスクリプト言語のインスタンスのポインタを格納した後、戻る(28−8)。   After storing the pointer of the script language instance with WSuper :: set_self (), the process returns (28-8).

そして、ScriptBase._init_()から戻るとともに(28−9)、ScriptSuper._init_()から戻る(28−10)。   And ScriptBase. _Init_ () returns (28-9), and ScriptSuper. Return from _init_ () (28-10).

また、図29には、ScriptSuperのインスタンスを消滅するとき(デストラクタ)の実行順序を図解している。   Also, FIG. 29 illustrates the execution order when an instance of ScriptSuper disappears (destructor).

まず、ScriptSuper.__del__()が呼ばれると(29−1)、ScriptBase.__del__()が呼ばれる(29−2)。   First, ScriptSuper. When __del __ () is called (29-1), ScriptBase. __Del __ () is called (29-2).

そして、ScriptBaseのメンバ変数thisの値からWSuper::〜WSuper()を呼び出す(29−3)。   Then, WSuper :: ˜WSuper () is called from the value of the member variable “this” of ScriptBase (29-3).

次いで、WSuper::〜WSuper()が呼び出され(29−4)、UserBase::〜UserBase()が呼び出される(29−5)。   Next, WSuper :: ˜WSuper () is called (29-4), and UserBase :: ˜UserBase () is called (29-5).

このようにコンストラクタ及びデストラクタが機能することにより、結果として、図30に示すように、仮想的にC++のクラスをスクリプト言語側のクラスが継承したように見える。   By functioning the constructor and the destructor in this way, as a result, as shown in FIG. 30, it seems that the C ++ class is virtually inherited by the script language class.

以上、特定の実施例を参照しながら、本発明について詳解してきた。しかしながら、本発明の要旨を逸脱しない範囲で当業者が該実施例の修正や代用を成し得ることは自明である。   The present invention has been described in detail above with reference to specific embodiments. However, it is obvious that those skilled in the art can make modifications and substitutions of the embodiments without departing from the gist of the present invention.

本発明の要旨は、必ずしも「ロボット」と称される製品には限定されない。すなわち、電気的若しくは磁気的な作用を用いて人間の動作に似せた運動を行なう機械装置であるならば、例えば玩具等のような他の産業分野に属する製品であっても、同様に本発明を適用することができる。   The gist of the present invention is not necessarily limited to a product called a “robot”. That is, as long as it is a mechanical device that performs an exercise resembling human movement using an electrical or magnetic action, the present invention can be applied to products belonging to other industrial fields such as toys. Can be applied.

要するに、例示という形態で本発明を開示してきたのであり、本明細書の記載内容を限定的に解釈するべきではない。本発明の要旨を判断するためには、冒頭に記載した特許請求の範囲の欄を参酌すべきである。   In short, the present invention has been disclosed in the form of exemplification, and the description of the present specification should not be interpreted in a limited manner. In order to determine the gist of the present invention, the claims section described at the beginning should be considered.

図1は、本発明に実施に供されるロボット装置1の機能構成を模式的に示した図である。FIG. 1 is a diagram schematically illustrating a functional configuration of a robot apparatus 1 that is used in the present invention. 図2は、制御ユニット20の構成を示した図である。FIG. 2 is a diagram showing the configuration of the control unit 20. 図3は、本発明の実施形態に係るロボット装置1の行動制御システム100の機能構成を模式的に示した図である。FIG. 3 is a diagram schematically illustrating a functional configuration of the behavior control system 100 of the robot apparatus 1 according to the embodiment of the present invention. 図4は、行動制御システム100のオブジェクト構成を模式的に示した図である。FIG. 4 is a diagram schematically illustrating an object configuration of the behavior control system 100. 図5は、状況依存行動階層(SBL)108(但し、反射行動部109を含む)による状況依存行動制御の形態を模式的に示した図である。FIG. 5 is a diagram schematically showing a form of situation-dependent action control by the situation-dependent action hierarchy (SBL) 108 (including the reflex action unit 109). 図6は、状況依存行動階層108が複数のスキーマによって構成されている様子を模式的に示した図である。FIG. 6 is a diagram schematically showing how the situation-dependent action hierarchy 108 is composed of a plurality of schemas. 図7は、状況依存行動階層108におけるスキーマのツリー構造を模式的に示した図である。FIG. 7 is a diagram schematically showing a schema tree structure in the situation-dependent action hierarchy 108. 図8は、スキーマの内部構成を模式的に示した図である。FIG. 8 is a diagram schematically showing the internal structure of the schema. 図9は、スキーマがツリー構造を形成している場合における行動状態制御のメカニズムを説明するための図である。FIG. 9 is a diagram for explaining the mechanism of behavioral state control when the schema forms a tree structure. 図10は、C++のようなコンパイラ言語とスクリプト言語でそれぞれ記述されたオブジェクトが混在するオブジェクト指向プログラミング環境下におけるプログラム開発手順を模式的に示した図である。FIG. 10 is a diagram schematically showing a program development procedure in an object-oriented programming environment in which objects described in a compiler language and a script language such as C ++ are mixed. 図11は、C++とスクリプト言語の相互に呼び出せるラッパー・コードを組み込んだ様子を示した図である。FIG. 11 is a diagram showing a state where a wrapper code that can be called between C ++ and a script language is incorporated. 図12は、C++で記述されたユーザ・クラス(UserBase)を継承して、スクリプト・ユーザ・クラス(Script_Super)を作成することを考えた場合の、ユーザ・クラス及びベース・クラスのコードを示した図である。FIG. 12 shows the code of the user class and the base class when it is considered that the script user class (Script_Super) is created by inheriting the user class (UserBase) described in C ++. FIG. 図13は、スクリプト言語側でのクラス宣言を擬似的に示した図である。FIG. 13 is a diagram showing a pseudo class declaration on the script language side. 図14は、C++側のインスタンスにスクリプト言語側のインスタンスのポインタを相互に持つ様子を示した図である。FIG. 14 is a diagram showing a state in which pointers of instances on the script language side are mutually held on instances on the C ++ side. 図15は、C++側のクラスで定義されている関数funcok1が、これを継承しているスクリプト言語側のクラスでオーバーライドされている場合における関数呼び出しの実行順序を説明するための図である。FIG. 15 is a diagram for explaining the execution order of function calls when the function funcok1 defined in the class on the C ++ side is overridden by a class on the script language side that inherits the function funcok1. 図16は、C++側のクラスで定義されている関数funcok1が、これを継承しているスクリプト言語側のクラスでオーバーライドされていない場合における関数呼び出しの実行順序を説明するための図である。FIG. 16 is a diagram for explaining the execution order of function calls when the function funcok1 defined in the class on the C ++ side is not overridden by the class on the script language side that inherits the function funcok1. 図17は、スクリプト言語側の継承クラスScriptSuperにおいて関数func()が定義されていない場合に、関数呼び出しにより無限ループに陥る動作を説明するための図である。FIG. 17 is a diagram for explaining an operation that falls into an infinite loop due to a function call when the function func () is not defined in the inheritance class ScriptSuper on the script language side. 図18は、コンパイラ言語側で用意するラッパー・クラスWSuperに、スクリプト言語側で継承されているクラスに関数がオーバーライドされているかどうかをチェックする判断機能を装備した場合における関数呼び出しの実行順序を説明するための図である。FIG. 18 illustrates the execution sequence of function calls when the wrapper class WSuper prepared on the compiler language side is equipped with a judgment function for checking whether or not a function is overridden in a class inherited on the script language side. It is a figure for doing. 図19は、図18に示した解決方法を適用した場合におけるC++でのクラス定義の記述例を示した図である。FIG. 19 is a diagram showing a description example of class definition in C ++ when the solution shown in FIG. 18 is applied. 図20は、図18に示した解決方法を適用した場合におけるpythonでのクラス定義の記述例を示した図である。FIG. 20 is a diagram showing a description example of class definition in Python when the solution shown in FIG. 18 is applied. 図21は、どの関数を呼び出すべきかをスクリプト言語側のクラスで判断する機能を装備した場合における関数呼び出しの実行順序を説明するための図である。FIG. 21 is a diagram for explaining the execution order of function calls when a function for determining which function should be called is provided by a class on the script language side. 図22は、図21に示した解決方法を適用した場合におけるC++でのクラス定義の記述例を示した図である。FIG. 22 is a diagram showing a description example of class definition in C ++ when the solution shown in FIG. 21 is applied. 図23は、図21に示した解決方法を適用した場合におけるpythonでのクラス定義の記述例を示した図である。FIG. 23 is a diagram showing a description example of class definition in Python when the solution shown in FIG. 21 is applied. 図24は、図21に示した関数呼び出しの実行順序の変形例を説明するための図である。FIG. 24 is a diagram for explaining a modification of the execution order of the function calls shown in FIG. 図25は、図21に示した関数呼び出しの実行順序の変形例を説明するための図である。FIG. 25 is a diagram for explaining a modification of the execution order of the function calls shown in FIG. 図26は、図25に示した解決方法を適用した場合におけるC++でのクラス定義の記述例を示した図である。FIG. 26 is a diagram showing a description example of class definition in C ++ when the solution shown in FIG. 25 is applied. 図27は、図25に示した解決方法を適用した場合におけるpythonでのクラス定義の記述例を示した図である。FIG. 27 is a diagram showing a description example of class definition in Python when the solution shown in FIG. 25 is applied. 図28は、C++側のベース・クラスUserBaseを継承するスクリプト言語側のクラスScriptSuperのインスタンスを構築するとき(コンストラクタ)の実行順序を説明するための図である。FIG. 28 is a diagram for explaining the execution order when constructing an instance of the script language-side class ScriptSuper that inherits the base class UserBase on the C ++ side (constructor). 図29は、ScriptSuperのインスタンスを消滅するとき(デストラクタ)の実行順序を説明するための図である。FIG. 29 is a diagram for explaining the execution order when an instance of ScriptSuper disappears (destructor). 図30は、仮想的にC++のクラスをスクリプト言語側のクラスが継承した様子を示した図である。FIG. 30 is a diagram showing a state in which a C ++ class is virtually inherited by a class on the script language side. 図31は、本発明に係るロボット装置を取り巻くネットワーク構成を模式的に示した図である。FIG. 31 is a diagram schematically showing a network configuration surrounding the robot apparatus according to the present invention.

符号の説明Explanation of symbols

1…ロボット装置
15…CCDカメラ
16…マイクロフォン
17…スピーカ
18…タッチ・センサ
19…LEDインジケータ
20…制御部ユニット
21…CPU
22…RAM
23…ROM
24…不揮発メモリ
25…インターフェース
26…無線通信インターフェース
28…バス
40…入出力部
50…駆動部
51…モータ
52…エンコーダ
53…ドライバ
DESCRIPTION OF SYMBOLS 1 ... Robot apparatus 15 ... CCD camera 16 ... Microphone 17 ... Speaker 18 ... Touch sensor 19 ... LED indicator 20 ... Control part unit 21 ... CPU
22 ... RAM
23 ... ROM
24 ... Non-volatile memory 25 ... Interface 26 ... Wireless communication interface 28 ... Bus 40 ... Input / output unit 50 ... Drive unit 51 ... Motor 52 ... Encoder 53 ... Driver

Claims (23)

1以上の可動部を備えたロボット装置において、
第1の言語で記述されたプログラム・コードの実行により前記ロボット装置の動作を制御する制御装置と、
第2の言語で記述されたプログラム・コードの実行により、前記制御装置を継承する継承装置とを備え、
前記第1の言語で記述されたクラスを前記第2の言語のクラスで継承する際に、前記制御装置は前記第2の言語のクラスへの参照を保持し,前記継承装置は前記第1の言語のクラスへの参照を保持する、
ことを特徴とするロボット装置。
In a robot apparatus having one or more movable parts,
A control device for controlling the operation of the robot device by executing a program code described in a first language;
An inheriting device that inherits the control device by executing program code described in a second language;
When the class described in the first language is inherited by the class of the second language, the control device holds a reference to the class of the second language, and the inheritance device Holds a reference to a language class,
A robot apparatus characterized by that.
第1の言語はプログラム・コードを所定のコンパイル処理を経て実行可能となるコンパイル言語であり、第2の言語はプログラム・コードをインタープリタ上で実行可能なスクリプト言語である、
ことを特徴とする請求項1に記載のロボット装置。
The first language is a compiled language that allows program code to be executed through a predetermined compilation process, and the second language is a script language that can execute the program code on an interpreter.
The robot apparatus according to claim 1.
前記継承装置は、第1の言語で記述されたベース・クラスを第2の言語で記述されたスーパー・クラスへ継承させる際に、
前記ベース・クラスを継承する、第1の言語で記述された第1のラッパー・クラスと、
前記スーパー・クラスで継承される、第2の言語で記述された第2のラッパー・クラスと、
前記第1のラッパー・クラスから前記第2のラッパー・クラスのインスタンスへのポインタと、
前記第2のラッパー・クラスから前記第1のラッパー・クラスのインスタンスへのポインタと、
を備えることを特徴とする請求項1に記載のロボット装置。
When the inheriting device inherits the base class described in the first language to the super class described in the second language,
A first wrapper class written in a first language that inherits the base class;
A second wrapper class written in a second language inherited by the super class;
A pointer from the first wrapper class to an instance of the second wrapper class;
A pointer from the second wrapper class to an instance of the first wrapper class;
The robot apparatus according to claim 1, further comprising:
前記第1のラッパー・クラスは、前記ベース・クラスの関数が第2の言語側で継承されているクラスにオーバーライドされているかどうかをチェックする判断機能を備える、
ことを特徴とする請求項3に記載のロボット装置。
The first wrapper class has a determination function for checking whether the function of the base class is overridden by a class inherited on the second language side,
The robot apparatus according to claim 3.
前記第1のラッパー・クラスは、前記ベース・クラスの関数をオーバーライドし、且つ、該オーバーライドした関数内において前記スーパー・クラスで前記ベース・クラスの関数がオーバーライドされているかどうかをチェックし、前記スーパー・クラスにおいて前記ベース・クラスの関数がオーバーライドされている場合には第2の言語側の関数を呼び出すが、前記スーパー・クラスにおいてオーバーライドされていない場合には前記ベース・クラスの関数を呼び出す、
ことを特徴とする請求項4に記載のロボット装置。
The first wrapper class overrides the function of the base class, and checks whether the function of the base class is overridden in the super class in the overridden function. Calling a second language side function if the base class function is overridden in the class, but calling the base class function if not overridden in the super class;
The robot apparatus according to claim 4, wherein:
前記第2のラッパー・クラスはいずれの関数を呼び出すかを判断する機能を装備する、
ことを特徴とする請求項3に記載のロボット装置。
The second wrapper class is equipped with a function for determining which function to call.
The robot apparatus according to claim 3.
前記第1のラッパー・クラスは、前記ベース・クラスの関数をオーバーライドし、且つ、前記ベース・クラスの関数を呼び出す擬似オーバーライド関数を持ち、
前記第2のラッパー・クラスは、前記ベース・クラスの関数をオーバーライドし、且つ、該オーバーライドした関数内において前記スーパー・クラスで前記ベース・クラスの関数がオーバーライドされているかどうかをチェックし、前記スーパー・クラスで前記ベース・クラスの関数がオーバーライドされている場合には第2の言語側の関数を呼び出すが、前記スーパー・クラスにおいてオーバーライドされていない場合には前記擬似オーバーライド関数を呼び出す、
ことを特徴とする請求項6に記載のロボット装置。
The first wrapper class has a pseudo-override function that overrides the base class function and calls the base class function;
The second wrapper class overrides the base class function, and checks whether the base class function is overridden in the super class in the overridden function, and Call a second language function if the class has overridden the base class function, but call the pseudo-override function if not overridden in the super class;
The robot apparatus according to claim 6.
前記第1のラッパー・クラスは、前記ベース・クラスの関数をオーバーライドし、
前記ベース・クラスの関数を呼び出す擬似オーバーライド関数を定義する第3のラッパー・クラスが前記第1のラッパー・クラスを継承し、
前記第2のラッパー・クラスは、前記ベース・クラスの関数をオーバーライドし、且つ、該オーバーライドした関数内において前記スーパー・クラスで前記ベース・クラスの関数がオーバーライドされているかどうかをチェックし、前記スーパー・クラスで前記ベース・クラスの関数がオーバーライドされている場合には第2の言語側の関数を呼び出すが、前記スーパー・クラスにおいてオーバーライドされていない場合には前記第3のラッパー・クラスを呼び出す、
ことを特徴とする請求項6に記載のロボット装置。
The first wrapper class overrides the base class function;
A third wrapper class defining a pseudo-override function that calls a function of the base class inherits the first wrapper class;
The second wrapper class overrides the base class function, and checks whether the base class function is overridden in the super class in the overridden function, and Call a function on the second language side if the function of the base class is overridden in the class, but call the third wrapper class if not overridden in the super class;
The robot apparatus according to claim 6.
第1の言語と第2の言語でそれぞれ記述されたオブジェクトが混在するオブジェクト指向プログラミング環境においてプログラムを実行する情報処理システムにおいて、
第1の言語で記述されたクラスを継承したクラスを第2の言語のクラスとする際に、第1の言語におけるクラスのメンバに該クラスを継承した第2の言語のクラスへの参照を保持させるとともに、第2の言語のオブジェクトのメンバに第1の言語のクラスへの参照を保持させる、
ことを特徴とする情報処理システム。
In an information processing system for executing a program in an object-oriented programming environment in which objects described in a first language and a second language are mixed,
When a class that inherits a class described in the first language is used as a second language class, a member of the class in the first language holds a reference to the class in the second language that inherits the class. And having a member of the second language object hold a reference to the first language class,
An information processing system characterized by this.
第1の言語はプログラム・コードを所定のコンパイル処理を経て実行可能となるコンパイル言語であり、第2の言語はプログラム・コードをインタープリタ上で実行可能なスクリプト言語である、
ことを特徴とする請求項9に記載の情報処理システム。
The first language is a compiled language that allows program code to be executed through a predetermined compilation process, and the second language is a script language that can execute the program code on an interpreter.
The information processing system according to claim 9.
第1の言語で記述されたベース・クラスを第2の言語で記述されたスーパー・クラスへ継承させる際に、
前記ベース・クラスを第1の言語で記述された第1のラッパー・クラスで継承するとともに、第2の言語で記述された第2のラッパー・クラスを前記スーパー・クラスが継承し、
前記第1のラッパー・クラスは前記第2のラッパー・クラスのインスタンスのポインタを格納し、
前記第2のラッパー・クラスは前記第1のラッパー・クラスのインスタンスのポインタを格納する、
ことを特徴とする請求項9に記載の情報処理システム。
When inheriting a base class written in a first language to a super class written in a second language,
The super class inherits the base class from a first wrapper class written in a first language and the second wrapper class written in a second language;
The first wrapper class stores a pointer to an instance of the second wrapper class;
The second wrapper class stores a pointer to an instance of the first wrapper class;
The information processing system according to claim 9.
前記第1のラッパー・クラスは、前記ベース・クラスの関数が第2の言語側で継承されているクラスにオーバーライドされているかどうかをチェックする判断機能を装備する、
ことを特徴とする請求項11に記載の情報処理システム。
The first wrapper class is equipped with a determination function for checking whether the function of the base class is overridden by a class inherited on the second language side,
The information processing system according to claim 11.
前記第1のラッパー・クラスは、前記ベース・クラスの関数をオーバーライドし、且つ、該オーバーライドした関数内において前記スーパー・クラスで前記ベース・クラスの関数がオーバーライドされているかどうかをチェックし、前記スーパー・クラスにおいて前記ベース・クラスの関数がオーバーライドされている場合には第2の言語側の関数を呼び出すが、前記スーパー・クラスにおいてオーバーライドされていない場合には前記ベース・クラスの関数を呼び出す、
ことを特徴とする請求項12に記載の情報処理システム。
The first wrapper class overrides the function of the base class, and checks whether the function of the base class is overridden in the super class in the overridden function. Calling a second language side function if the base class function is overridden in the class, but calling the base class function if not overridden in the super class;
The information processing system according to claim 12.
前記第2のラッパー・クラスはいずれの関数を呼び出すかを判断する機能を装備する、
ことを特徴とする請求項11に記載の情報処理システム。
The second wrapper class is equipped with a function for determining which function to call.
The information processing system according to claim 11.
前記第1のラッパー・クラスは、前記ベース・クラスの関数をオーバーライドし、且つ、前記ベース・クラスの関数を呼び出す擬似オーバーライド関数を持ち、
前記第2のラッパー・クラスは、前記ベース・クラスの関数をオーバーライドし、且つ、該オーバーライドした関数内において前記スーパー・クラスで前記ベース・クラスの関数がオーバーライドされているかどうかをチェックし、前記スーパー・クラスで前記ベース・クラスの関数がオーバーライドされている場合には第2の言語側の関数を呼び出すが、前記スーパー・クラスにおいてオーバーライドされていない場合には前記擬似オーバーライド関数を呼び出す、
ことを特徴とする請求項14に記載の情報処理システム。
The first wrapper class has a pseudo-override function that overrides the base class function and calls the base class function;
The second wrapper class overrides the base class function, and checks whether the base class function is overridden in the super class in the overridden function, and Call a second language function if the class has overridden the base class function, but call the pseudo-override function if not overridden in the super class;
The information processing system according to claim 14.
前記第1のラッパー・クラスは、前記ベース・クラスの関数をオーバーライドし、
前記ベース・クラスの関数を呼び出す擬似オーバーライド関数を定義する第3のラッパー・クラスが前記第1のラッパー・クラスを継承し、
前記第2のラッパー・クラスは、前記ベース・クラスの関数をオーバーライドし、且つ、該オーバーライドした関数内において前記スーパー・クラスで前記ベース・クラスの関数がオーバーライドされているかどうかをチェックし、前記スーパー・クラスで前記ベース・クラスの関数がオーバーライドされている場合には第2の言語側の関数を呼び出すが、前記スーパー・クラスにおいてオーバーライドされていない場合には前記第3のラッパー・クラスを呼び出す、
ことを特徴とする請求項14に記載の情報処理システム。
The first wrapper class overrides the base class function;
A third wrapper class defining a pseudo-override function that calls a function of the base class inherits the first wrapper class;
The second wrapper class overrides the base class function, and checks whether the base class function is overridden in the super class in the overridden function, and Call a function on the second language side if the function of the base class is overridden in the class, but call the third wrapper class if not overridden in the super class;
The information processing system according to claim 14.
第1の言語と第2の言語でそれぞれ記述されたオブジェクトが混在するオブジェクト指向プログラミング環境においてプログラムを実行するための情報処理方法において、
第1の言語で記述されたクラスを継承したクラスを第2の言語のクラスとする際に、第1の言語におけるクラスのメンバに該クラスを継承した第2の言語のクラスへの参照を保持させるステップと、第2の言語のオブジェクトのメンバに第1の言語のクラスへの参照を保持させるステップと、
を備えることを特徴とする情報処理方法。
In an information processing method for executing a program in an object-oriented programming environment in which objects described in a first language and a second language are mixed,
When a class that inherits a class described in the first language is used as a second language class, a member of the class in the first language holds a reference to the class in the second language that inherits the class. Causing a member of a second language object to retain a reference to a class of the first language;
An information processing method comprising:
第1の言語はプログラム・コードを所定のコンパイル処理を経て実行可能となるコンパイル言語であり、第2の言語はプログラム・コードをインタープリタ上で実行可能なスクリプト言語である、
ことを特徴とする請求項17に記載の情報処理方法。
The first language is a compiled language that allows program code to be executed through a predetermined compilation process, and the second language is a script language that can execute the program code on an interpreter.
The information processing method according to claim 17.
第1の言語で記述されたベース・クラスを第2の言語で記述されたスーパー・クラスへ継承させる際に、
前記ベース・クラスを第1の言語で記述された第1のラッパー・クラスで継承するステップと、
第2の言語で記述された第2のラッパー・クラスを前記スーパー・クラスが継承するステップと、
前記第1のラッパー・クラスが前記第2のラッパー・クラスのインスタンスのポインタを格納するステップと、
前記第2のラッパー・クラスが前記第1のラッパー・クラスのインスタンスのポインタを格納するステップと、
をさらに備えることを特徴とする請求項17に記載の情報処理方法。
When inheriting a base class written in a first language to a super class written in a second language,
Inheriting the base class with a first wrapper class written in a first language;
The super class inheriting a second wrapper class written in a second language;
The first wrapper class storing a pointer to an instance of the second wrapper class;
The second wrapper class storing a pointer to an instance of the first wrapper class;
The information processing method according to claim 17, further comprising:
前記第1のラッパー・クラスは、前記ベース・クラスの関数をオーバーライドし、且つ、該オーバーライドした関数内において前記スーパー・クラスで前記ベース・クラスの関数がオーバーライドされているかどうかをチェックするステップを備え、
前記のチェックするステップでは、前記スーパー・クラスにおいて前記ベース・クラスの関数がオーバーライドされている場合には第2の言語側の関数を呼び出すが、前記スーパー・クラスにおいてオーバーライドされていない場合には前記ベース・クラスの関数を呼び出す、
ことを特徴とする請求項19に記載の情報処理方法。
The first wrapper class comprises overriding the base class function and checking whether the base class function is overridden in the super class within the overridden function. ,
In the checking step, if the function of the base class is overridden in the super class, the function of the second language side is called. If not overridden in the super class, the function of the base class is called. Call a base class function,
The information processing method according to claim 19.
前記第1のラッパー・クラスは、前記ベース・クラスの関数をオーバーライドし、且つ、前記ベース・クラスの関数を呼び出す擬似オーバーライド関数を持ち、
前記第2のラッパー・クラスが、前記ベース・クラスの関数をオーバーライドし、且つ、該オーバーライドした関数内において前記スーパー・クラスで前記ベース・クラスの関数がオーバーライドされているかどうかをチェックするステップを備え、
前記のチェックするステップでは、前記スーパー・クラスで前記ベース・クラスの関数がオーバーライドされている場合には第2の言語側の関数を呼び出すが、前記スーパー・クラスにおいてオーバーライドされていない場合には前記擬似オーバーライド関数を呼び出す、
ことを特徴とする請求項19に記載の情報処理方法。
The first wrapper class has a pseudo-override function that overrides the base class function and calls the base class function;
The second wrapper class overriding the function of the base class and checking whether the function of the base class is overridden in the super class in the overridden function; ,
In the checking step, if the function of the base class is overridden in the super class, the function of the second language side is called. If not overridden in the super class, the function of the base class is called. Call the pseudo-override function,
The information processing method according to claim 19.
前記第1のラッパー・クラスは、前記ベース・クラスの関数をオーバーライドし、
前記ベース・クラスの関数を呼び出す擬似オーバーライド関数を定義する第3のラッパー・クラスが前記第1のラッパー・クラスを継承し、
前記第2のラッパー・クラスは、前記ベース・クラスの関数をオーバーライドし、且つ、該オーバーライドした関数内において前記スーパー・クラスで前記ベース・クラスの関数がオーバーライドされているかどうかをチェックするステップを備え、
前記のチェックするステップでは、前記スーパー・クラスで前記ベース・クラスの関数がオーバーライドされている場合には第2の言語側の関数を呼び出すが、前記スーパー・クラスにおいてオーバーライドされていない場合には前記第3のラッパー・クラスを呼び出す、
ことを特徴とする請求項19に記載の情報処理方法。
The first wrapper class overrides the base class function;
A third wrapper class defining a pseudo-override function that calls a function of the base class inherits the first wrapper class;
The second wrapper class comprises overriding the base class function and checking whether the base class function is overridden in the super class within the overridden function. ,
In the checking step, if the function of the base class is overridden in the super class, the function of the second language side is called. If not overridden in the super class, the function of the base class is called. Call the third wrapper class,
The information processing method according to claim 19.
第1の言語と第2の言語でそれぞれ記述されたオブジェクトが混在するオブジェクト指向プログラミング環境においてプログラムを実行するための処理をコンピュータ・システム上で実行するようにコンピュータ可読形式で記述されたコンピュータ・プログラムにおいて、
第1の言語で記述されたクラスを継承したクラスを第2の言語のクラスとする際に、第1の言語におけるクラスのメンバに該クラスを継承した第2の言語のクラスへの参照を保持させるステップと、第2の言語のオブジェクトのメンバに第1の言語のクラスへの参照を保持させるステップと、
を備えることを特徴とするコンピュータ・プログラム。
A computer program written in a computer-readable format so that processing for executing the program is executed on a computer system in an object-oriented programming environment in which objects described in the first language and the second language are mixed. In
When a class that inherits a class described in the first language is used as a second language class, a member of the class in the first language holds a reference to the class in the second language that inherits the class. Causing a member of a second language object to retain a reference to a class of the first language;
A computer program comprising:
JP2004138633A 2004-05-07 2004-05-07 Robot apparatus, information processing system, information processing method, and computer program Pending JP2005321954A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2004138633A JP2005321954A (en) 2004-05-07 2004-05-07 Robot apparatus, information processing system, information processing method, and computer program

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2004138633A JP2005321954A (en) 2004-05-07 2004-05-07 Robot apparatus, information processing system, information processing method, and computer program

Publications (1)

Publication Number Publication Date
JP2005321954A true JP2005321954A (en) 2005-11-17

Family

ID=35469209

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2004138633A Pending JP2005321954A (en) 2004-05-07 2004-05-07 Robot apparatus, information processing system, information processing method, and computer program

Country Status (1)

Country Link
JP (1) JP2005321954A (en)

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2009018411A (en) * 2007-07-13 2009-01-29 Honda Research Inst Europe Gmbh Method and device for controlling robot
JP2012175026A (en) * 2011-02-24 2012-09-10 Yamaha Motor Co Ltd Component mounting device
CN105739957A (en) * 2014-12-09 2016-07-06 阿里巴巴集团控股有限公司 User interface data processing method and system
CN108874376A (en) * 2018-06-19 2018-11-23 北京智明星通科技股份有限公司 Function and the deriving method and device of class, terminal and computer readable storage medium
WO2022168336A1 (en) * 2021-02-03 2022-08-11 オムロン株式会社 Control device, control method, and control program

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH11296359A (en) * 1998-04-10 1999-10-29 Hitachi Ltd Program development support tool
JP2001067358A (en) * 1999-06-28 2001-03-16 Lucent Technol Inc Application independent language module for language independent application

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH11296359A (en) * 1998-04-10 1999-10-29 Hitachi Ltd Program development support tool
JP2001067358A (en) * 1999-06-28 2001-03-16 Lucent Technol Inc Application independent language module for language independent application

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2009018411A (en) * 2007-07-13 2009-01-29 Honda Research Inst Europe Gmbh Method and device for controlling robot
JP2012175026A (en) * 2011-02-24 2012-09-10 Yamaha Motor Co Ltd Component mounting device
CN105739957A (en) * 2014-12-09 2016-07-06 阿里巴巴集团控股有限公司 User interface data processing method and system
CN108874376A (en) * 2018-06-19 2018-11-23 北京智明星通科技股份有限公司 Function and the deriving method and device of class, terminal and computer readable storage medium
CN108874376B (en) * 2018-06-19 2021-09-07 北京智明星通科技股份有限公司 Method and device for exporting functions and classes, terminal and computer-readable storage medium
WO2022168336A1 (en) * 2021-02-03 2022-08-11 オムロン株式会社 Control device, control method, and control program
JP7593154B2 (en) 2021-02-03 2024-12-03 オムロン株式会社 Control device, control method, and control program

Similar Documents

Publication Publication Date Title
CN100364731C (en) Robotic device, its behavior control method and program
US8145492B2 (en) Robot behavior control system and method, and robot apparatus
JP2005193331A (en) Robot apparatus and emotion expression method thereof
KR101137205B1 (en) Robot behavior control system, behavior control method, and robot device
EP1327503B1 (en) Robot control system and robot control method
US7363108B2 (en) Robot and control method for controlling robot expressions
JP4244812B2 (en) Action control system and action control method for robot apparatus
JP3558222B2 (en) Robot behavior control system and behavior control method, and robot device
JP3925140B2 (en) Information providing method, information providing apparatus, and computer program
JP4449372B2 (en) Robot apparatus and behavior control method thereof
JP2005321954A (en) Robot apparatus, information processing system, information processing method, and computer program
JP2006110707A (en) Robot equipment
JP2007125631A (en) Robot apparatus and behavior control method thereof
JP4552465B2 (en) Information processing apparatus, action control method for robot apparatus, robot apparatus, and computer program
JP2002187082A (en) Robot control system and robot control method
JP4147960B2 (en) Robot apparatus and operation control method of robot apparatus
JP2004283957A (en) Robot device, control method thereof, and program
JP4649806B2 (en) Robot apparatus and shock absorbing method for robot apparatus
JP2007125629A (en) Robot apparatus and behavior control method thereof
JP2005193330A (en) Robot apparatus and emotion expression method thereof
JP2004283960A (en) Robot device, behavior control method thereof, and program
JP2004291147A (en) Robot behavior control system
JP2004209599A (en) Robot device, behavior learning method of robot device, behavior generation method of robot device
JP2003266352A (en) Robot device and control method therefor
JP2007125630A (en) Robot apparatus and behavior control method thereof

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20070405

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20100406

A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20100520

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20100629

A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20100818

A02 Decision of refusal

Free format text: JAPANESE INTERMEDIATE CODE: A02

Effective date: 20100921