📄 applications-doc.sgml
字号:
<!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook V4.1//EN" "docbook/dtd/4.1/docbook.dtd" [<!ENTITY orocos "<acronym>Orocos</acronym>">]><article><articleinfo> <title> Orocos Applications </title> <author> <firstname>Herman</firstname> <surname>Bruyninckx</surname> <affiliation> <address> Herman.Bruyninckx@mech.kuleuven.ac.be </address> </affiliation> </author> <copyright> <year>2003</year> <holder>Herman Bruyninckx —Permission is granted to copy, distribute and/or modify this documentunder the terms of the GNU General Public License(<ulink url="http://www.fsf.org/copyleft/gpl.html">http://www.fsf.org/copyleft/gpl.html</ulink>), where the <emphasis>source code</emphasis> of the document is the <ulink url="applications-doc.xml">XML file</ulink>.</holder> </copyright> <abstract> <para> <emphasis role="strong">Abstract</emphasis> </para> <para>This document describes what an <emphasis>Application</emphasis> is and how building an application must beprepared to fit in the generic realtime feedback control Kernel.Some general applications are discussed in more detail.</para><para>The subsequent steps in the implementation of an application are: (i) todescribe the “family” of applications that the currentimplementation can or should cover; (ii) to determine the architectureof the application; (iii) to fill in the Data Object interfaces; (iv)to decide what functions are needed in all Components, and whatreal-time behaviour they require; (v) to determine the<emphasis>control flow</emphasis> of the application; and (vi) to implement the Componentfunctions.</para> </abstract> <revhistory> <revision> <revnumber>0.01</revnumber> <date>August 13, 2003</date> <authorinitials>HB</authorinitials> <revremark>Initial release: gives overview of Kernel design and programminginterface; lists most common motion control applications, without muchdetail; explains the complementary roles of the Kernel Builders, theApplication Builders, and the Component Builders. </revremark> </revision> <revision> <revnumber>0.02</revnumber> <date>August 16, 2003</date> <authorinitials>HB</authorinitials> <revremark>Added more details for a set of most common applications. </revremark> </revision> <revision> <revnumber>0.03</revnumber> <date>January 20, 2004</date> <authorinitials>HB</authorinitials> <revremark>Introduced “families”, and “Kernelapplications”. More details on (a)synchronous data exchange. </revremark> </revision> </revhistory></articleinfo><section id="applications-introduction"><title>Introduction</title><para>An <emphasis role="strong">application</emphasis> is a piece ofsoftware that <emphasis role="strong">(advanced) end-users</emphasis>can work with: the software runs on the end-users' particularhardware; it offers a programming language and (graphical) userinterface targeted to the end-users' goals; it provides configurationoptions that are relevant in the end-users' context; etc.</para><para>The &orocos; project is not in the first place about providing aparticular set of applications, but rather on providing the<emphasis>infrastructure</emphasis> to build applications.In this respect, &orocos; is designed to be a “plug-in”framework, in which different applications are developed as plug-insinto the same <emphasis>Kernel</emphasis> framework. However, &orocos; does have already a couple of applications, whichserve as examples from which to start other applications. Over time,the applications database will hopefully grow, by contributions fromusers.</para><para>At the lowest (“real-time”)control level, the current state of &orocos; is as follows:<itemizedlist><listitem><para>&orocos; provides a generic <emphasis role="strong">Kernel</emphasis>that can be used for all real-time or non real-time <emphasis role="strong">feedback control</emphasis>applications. The Kernel code is the responsibility of the<emphasis role="strong">Kernel Builders</emphasis>: they take careof the interfaces to the underlying operating system and hardware;they provide a programming interface that is more familiar to controlapplication builders than the powerful but hence often dangerous(real-time) operating system primitives; they take care about how tobest implement“boring stuff” like efficiency, distributability, mutualexclusion, and, possibly, CORBA support; and they provide a set ofexample applications.</para></listitem><listitem><para>The Kernel offers a plug-in interface for the<emphasis role="strong">Application Builders</emphasis>. TheApplication Builders' firstresponsibilty is to design an application by providing<emphasis role="strong">concrete specifications</emphasis> (interfacesand functionality) for allplug-ins, targeted to the application's goals. So, they specify whatthe application will functionally be able to do, what data it willaccept and generate, and how end users can interact with this data andfunctionality.</para><para>The second responsibilty of the Application Builders is <emphasis role="strong">to integrate</emphasis> the wholeapplication; i.e., the Component Builders (see below) provideimplementations of the above-mentioned specifications, and theApplication Builders must make sure that the whole set ofimplementations really works together as specified. In this part ofthe job, topics appear such as distribution over a network, andfilling in the<anchor id="hot-spots"><emphasis role="strong">hot spots</emphasis>. These hotspots are those parts of an application instantiation that do, ingeneral, not port between instantiations of the same application(i.e., from one serial robot manipulator to another serial robotmanipulator); they consist mainly of device drivers for the particularhardware of each instantiation, wrappers to the operatingsystem used in the instantiation, kinematics of robots, etc.</para><para>The first result of the Application Builders' work is independent ofthe concrete system (the “instantiation” of theapplication): the application is fully specified, but still withoutimplementation code.The second result of the Application Builders' work is fullyintegrated and implemented code; this part is<emphasis>very</emphasis> dependent on the concrete system.Because of this fundamental difference in dependencies, it is a goodidea to keep both responsibilities of the Application Builders<ulink url="decoupling.html">decoupled</ulink>, even in tightlyintegrated systems.</para></listitem><listitem><para>An application must have code in each of its Kernel plug-ins,<emphasis role="strong">implementing</emphasis> the functionality ofthat application, as specified by the Application Builders. Theconcrete implementation of the application functionality is theresponsibility of the<emphasis role="strong">Component Builders</emphasis>, who areexperts in the specific component functionality they are implementing.They have to know only a minimum about what is going on in the rest ofthe application or in the Kernel, and certainly not about how allthose other things are implemented.</para><para>Especially in research environments, it is useful to allow thepossibility to replace one particular component implementation withanother one. The Kernel was designed with this functionality ofdynamic re-configuration of plug-in implementations in mind.</para></listitem></itemizedlist>Of course, in many real cases, the same people play the roles ofKernel Builder, Application Builder and Component Builder, atdifferent times and with different levels of involvement. </para></section><section id="applications-kernel"><title>The Kernel</title><para>This Section describes the structure and the programming interface ofthe Kernel, but only at a level of detail that is appropriate forApplication and Component Builders. More details of the Kernel design,properties and implementation are described in<ulink url="kernel-doc.html">another document</ulink>; this documentfocuses on how <emphasis>to use</emphasis> the Kernel infrastructure.</para><para><xref linkend="fig-control-pattern"> depicts the <emphasis role="strong">structure</emphasis> of theKernel: the rectangles are “Components”, the ovals are“Data Objects”, and the arrows indicate read and writeaccesses. Basically, specifying an application means specifying thecontents of the Data Objects, as well as the function blocksin the Components.</para><para><figure id="fig-control-pattern" float="1" pgwide="0"><title> Structure of the generic feedback control Kernel.</title><mediaobject><imageobject><imagedata fileref="../pictures/control-pattern.png" format="PNG"></imageobject><imageobject><imagedata fileref="../pictures/control-pattern.eps" format="EPS"></imageobject></mediaobject></figure></para><para><figure id="fig-port-data-object" float="1" pgwide="0"><title>Data Objects (ovals) are responsible for the deterministicdistribution of information between Components. </title><mediaobject><imageobject><imagedata fileref="../pictures/port-data-object.png" format="PNG"></imageobject><imageobject><imagedata fileref="../pictures/port-data-object.eps" format="EPS"></imageobject></mediaobject></figure></para><section id="applications-kernel-exchange"><title>Interaction between Components</title><para>In the context of this document, the important thing is to know howthe various Components can <emphasis role="strong">interact</emphasis><anchor id="interaction">with each other.Components are designed and implemented independently of each other,except for the following complementary forms of interaction:<itemizedlist><listitem><para><emphasis role="strong">Data flow via Data Objects.</emphasis><xref linkend="fig-port-data-object"> shows the data exchangeconcept offered by the Kernel. Each Component has a number of <anchor id="ports"><emphasis role="strong">Ports</emphasis> through which it communicatesdata. Multiple Ports of the same Component can be connected to thesame Data Object. And one Data Object can be connected to multipleComponents.</para><para>The Kernel offers support for efficient and deterministic dataexchange, which takes place through standardized<parameter>Set_…</parameter> and<parameter>Get_…</parameter> methods on all Data Objects.The Component Builders do not have to worry about low-levelresponsibilities such as locking and transparant network distribution.</para></listitem><listitem><para><emphasis role="strong">Control flow via Events</emphasis>.The Kernel offers supportfor the “firing” and “handling” of events.Components use events to notify other Components that a certain facthas happened, without it having to know these other Componentsexplicitly, and without having to synchronize with them explicitly.</para><para>Some events are standardized by the Kernel, such as those used for(re)configuration; the application-dependent events are specified bythe Application Builders.</para></listitem></itemizedlist>Applications should not use any other means of interaction. Thetemptation may be high for an Application Builder to provide“shortcut” interactions, but everything that bypassesthe structures offered by the Kernel leads tonon-deterministic and non-maintainable implementations. (If ApplicationBuilders do have very good arguments to introduce other interactionprimitives, they should contact the Kernel Builders and discuss theaddition of these new primitives to the Kernel!)</para></section><section id="applications-kernel-inter-exchange"><title>Interaction within one single Component</title><para>Data exchange takes place between functions in Components: function``<emphasis>A</emphasis>'' in Component ``<emphasis>X</emphasis>''needs to have data from function ``<emphasis>B</emphasis>'' inComponent ``<emphasis>Y</emphasis>''. As in this simple example,these functions are often in <emphasis>different</emphasis>Components, and the Data Objects' support in the Kernel then takescare of the mutual exclusion needed in asynchronous data exchange. Butit is also possible that different functions in the<emphasis>same</emphasis> Component want to exchange data. If bothfunctions have the same<link linkend="rt-modes">real-time mode</link>, the fact that they runin the same Component is sufficient to guarantee mutual exclusion whenaccessing the common data. But if the functions have a different real-time mode, they most probably run in different threads, somutual exclusion synchronization is necessary. The fundamentaldifference between both situations is that in the latter, each accessto the shared data should be made through the safe<parameter>Set_…</parameter> and<parameter>Get_…</parameter> methods supported by the Kernel.</para><para>Alternatively, the Kernel implementation of these <parameter>Set_…</parameter> and<parameter>Get_…</parameter> methods could take into accountfrom which Components they are called and avoid the locking or networktransparancy when it is not needed. Of course, this approach requiressoftware support during the building of the application; this supportis a long-term goal of &orocos;.</para><para>This document uses the name “<emphasis role="strong">function blocks</emphasis>”for (the largest) sets of Component functions that, as a group, require asynchronous data exchange, and this data exchange is localized at thestart and end of the function block. That means that a function blockcan be implemented by a Component Builder without having to worryabout the context the code is used in. The name“function block” is, not by coincidence, the same as usedin <emphasis>Programmable Logic Controllers</emphasis> (PLCs).</para><para><xref linkend="fig-port-component"> depicts a situation in which twodifferent “function blocks” in the same Component access ashared data object through a <parameter>Port</parameter> that is onlyconnected inside the Component. For the Kernel, this“special” situation is not special at all: it doesn'trequire any added functionality from the Kernel, because the“asynchronously safe”<parameter>Set_…</parameter> and<parameter>Get_…</parameter> methods have to exist in theKernel anyway. So, both function blocks can be combined into onesingle larger function block.</para><para><figure id="fig-port-component" float="1" pgwide="0"><title>Asynchronous data access through Ports within one single Component.</title><mediaobject><imageobject><imagedata fileref="../pictures/port-component.png" format="PNG"></imageobject><imageobject><imagedata fileref="../pictures/port-component.eps" format="EPS"></imageobject></mediaobject></figure></para></section><section id="applications-kernel-use"><title>Applying the Kernel structure</title><para>The Kernel structure of <xref linkend="fig-control-pattern"> is a<emphasis role="strong">conceptual model</emphasis>. Inconcrete applications, this model can be used in various ways:<itemizedlist><listitem><para>Some Components are left empty. This means that the corresponding DataObjects are “short-circuited”. The<emphasis>Estimator</emphasis> is one of these Components that areneeded only in advanced applications, and hence will be leftempty in most systems.</para></listitem><listitem><para>Some Components are taken together in one single Component,<emphasis>i.e.</emphasis> the data exchange between these Componentstakes place in the same thread, and no external Components require
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -