Information Technology Reference
In-Depth Information
<implementation class= "CameraLocalization"/>
<property name="?Agent" type="String" value="The name of the robot to
be localized">
<service>
<provide interface="GoalLocalization"/>
</service>
<reference cardinality="0..1" interface= "GoalVideo" name="Video"
target="(Agent=?Agent)/>
<property name="self.osgi.precondition.LDAP" value="(light>30)"/>
</scr:component>
GoalLocalization ( ? Agent ) : true ←{ achieve ( GoalLaser ( ? Agent )) ; ...}
<scr:component ... factory="LaserLocalization"
name="CameraLocalization">
<implementation class= "LaserLocalization"/>
<property name="?Agent" type="String" value="The name of the robot to
be localized">
<service>
<provide interface="GoalLocalization"/>
</service>
<reference cardinality="0..1" interface= "GoalLaser" name="Laser"
target="(Agent=?Agent)/>
</scr:component>
Post-conditions. The post-conditions of both component plans are specified with the
OSGi XML service element. The MoveTo component plan implements a move-to nav-
igation behaviour in order to provide the service goal GoalNavigation , while both the
CameraLocalization and the LaserLocalization component plans implement localiza-
tion methods in order to provide localization updates through the service goal GoalLo-
calization .
Service Goal Requirements. Service goal requirements are declared using OSGi XML
reference elements. The definition of MoveTo declares its requirement of localization
information as dynamic , in order to allow OSGi to activate it even when the reference
to the Localization service goal is not resolved, thus avoiding to having to commit to a
specific localization mechanism before the behaviour is started.
Noticeably, the definition of CameraLocalization includes Self -OSGi-specific prop-
erty fields, self.osgi.precondition.LDAP , whose value may be used to characterise the
context when the component plan is applicable. In the example, the LDAP pre-condition
describes how CameraLocalization can only be used when the intensity of the ambient
light, e.g. sensed by a light sensor component, is believed to be above a given threshold.
Variables. In order to link post-conditions with pre-conditions and service goal require-
ments, Self -OSGi allows the use of variable attributes whose name starts with the spe-
cial character ”?”. Variables may be used as names of the property associated to a com-
ponent plan in order to specify that the component plan can be instantiated with any
value for that property. In such a case, the value of the variable is used as default value
of the property. For instance, both the MoveTo and the CameraLocalization component
plans declare the property Agent to specify that they can be used by any agent to achieve,
respectively, the GoalNavigation and the GoalLocalization service goals. Once the
Search WWH ::




Custom Search