<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
</head>
<body text="#000000" bgcolor="#FFFFFF">
Hi Roby-Users,<br>
<br>
i've currently met another magic behaviour in roby that is probably
not known for everyone and i think personally not very obvious,
especially<br>
for new roby users. The documentation mentioned this feature indeed,
but i would recommend to add more concret details for it. <br>
<br>
I've already mentioned in the past, that it was not clear for myself
how roby is choosing the correct physical deployment <br>
if there exists more than one deployment providing a specific Orocos
Task. This issue is documented in:<br>
<meta http-equiv="content-type" content="text/html;
charset=ISO-8859-1">
<a
href="http://rock-robotics.org/master/documentation/system/subsystem_design.html">http://rock-robotics.org/master/documentation/system/subsystem_design.html</a>
(Topic: Orocos Deployments)<br>
<br>
It says this is usually a policy issue and especially for roby
devices there is clear rule how it works. <br>
<br>
"If the task context is a device driver, i.e. needs to access
hardware, ambiguities are not acceptable (one deployment might have
access to the required hardware while the other has not). In this
case, the deployment that has the same name than the device will be
used (if there is one), or an error will be generated."<br>
<br>
If have currently some trouble to use this description for the
concret implemention.<br>
<br>
Here is a short example. Assume you have the following deployments:<br>
<br>
simple_deployment("pwm_led", "pwm_gumstix::Task")<br>
simple_deployment("pwm_servo", "pwm_gumstix::Task")<br>
<br>
In your config/ directory you have a ruby file that defines all
robot devices. e.G:<br>
<br>
Robot.devices do<br>
device(Dev::PwmControl, :as => "led").with_conf("led")<br>
device(Dev::PwmControl, :as => "servo").with_conf("servo")<br>
end<br>
<br>
With driver_mapping in models/orogen/pwm_gumstix.rb:<br>
<br>
class PwmGumstix::Task<br>
driver_for "Dev::PwmControl" do<br>
provides Srv::AnyService<br>
end<br>
end<br>
<br>
The concret problem is now: How can Roby match the correct
deployment process to the right device and if you try to instanciate
the current model<br>
for this example you get an error of the form:<br>
multiple deployments for Dev::PwmControl: pwm_led, pwm_servo<br>
<br>
The solution is very simple: the ":as" property is not only an
internal identifier for the roby devices. The name of this property
must also match the<br>
name of a existing deployment. This is some explicit mapping
mechanism that was completely unknown for myself and its very
helpful to know, <br>
if your system has several devices using the same TaskContext type.<br>
<br>
Here is the simple fix for this problem:<br>
device(Dev::PwmControl, :as => "pwm_led").with_conf("led") #
for deployment pwm_led<br>
device(Dev::PwmControl, :as => "pwm_servo").with_conf("servo")
# for deployment pwm_servo<br>
<br>
Hope you are not struggling about that like I did.<br>
<br>
Chris<br>
<meta http-equiv="content-type" content="text/html;
charset=ISO-8859-1">
</body>
</html>