[Rock-dev] Device/Deployment Matching in Roby
Chris Mueller
christoph.mueller at dfki.de
Mon Aug 20 18:24:10 CEST 2012
Hi Roby-Users,
i've currently met another magic behaviour in roby that is probably not
known for everyone and i think personally not very obvious, especially
for new roby users. The documentation mentioned this feature indeed, but
i would recommend to add more concret details for it.
I've already mentioned in the past, that it was not clear for myself how
roby is choosing the correct physical deployment
if there exists more than one deployment providing a specific Orocos
Task. This issue is documented in:
http://rock-robotics.org/master/documentation/system/subsystem_design.html
(Topic: Orocos Deployments)
It says this is usually a policy issue and especially for roby devices
there is clear rule how it works.
"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."
If have currently some trouble to use this description for the concret
implemention.
Here is a short example. Assume you have the following deployments:
simple_deployment("pwm_led", "pwm_gumstix::Task")
simple_deployment("pwm_servo", "pwm_gumstix::Task")
In your config/ directory you have a ruby file that defines all robot
devices. e.G:
Robot.devices do
device(Dev::PwmControl, :as => "led").with_conf("led")
device(Dev::PwmControl, :as => "servo").with_conf("servo")
end
With driver_mapping in models/orogen/pwm_gumstix.rb:
class PwmGumstix::Task
driver_for "Dev::PwmControl" do
provides Srv::AnyService
end
end
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
for this example you get an error of the form:
multiple deployments for Dev::PwmControl: pwm_led, pwm_servo
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
name of a existing deployment. This is some explicit mapping mechanism
that was completely unknown for myself and its very helpful to know,
if your system has several devices using the same TaskContext type.
Here is the simple fix for this problem:
device(Dev::PwmControl, :as => "pwm_led").with_conf("led") # for
deployment pwm_led
device(Dev::PwmControl, :as => "pwm_servo").with_conf("servo") # for
deployment pwm_servo
Hope you are not struggling about that like I did.
Chris
-------------- nächster Teil --------------
Ein Dateianhang mit HTML-Daten wurde abgetrennt...
URL: http://www.dfki.de/pipermail/rock-dev/attachments/20120820/4c499677/attachment.htm
More information about the Rock-dev
mailing list