[ros-users] pr2 and sr ethercat devices plugins

Yann Sionneau yann.sionneau at telecom-sudparis.eu
Mon Feb 7 17:51:26 UTC 2011

Thanks for your answer,

I am trying to adapt some code from sr_hand_ethercat (the shadow robot 
hand which is fully ethercat) in order to do a hybrid hand (ethercat + 
CAN bus).

So I am trying to understand the already existing code, I have two 
examples : 1°) the pr2 ethercat drivers and 2°) the shadow robot 
ethercat hand ethercat drivers

One thing I don't understand is where in the code source is the correct 
handler instanciation for the Ethercat devices.

I mean, at startup there is a scan_slaves() function in the Application 
Layer which counts the slaves and retrieve product and vendor IDs from 

But as soon as the number of slaves is known I can see something like 
that :

m_slave_handler = newEtherCAT_SlaveHandler*[m_num_slaves];

But I never see in the code instanciation of WG05, WG021 or WG06 nor 
call to poly_loader.createClassInstance() in order to load dynamically 
the right class providing the product ID using the plugin architecture.

Where is the detection the slave type and where is the generic Slave 
object turned into the right handler ?

Sorry for those numerous questions, I am kind of lost into this huge 
code base which is ROS :)

I am trying to see the big picture here which is not easy ;)



Le 07/02/11 17:08, Kevin Watts a écrit :
> Yann-
> First of all, the code API for pr2_ethercat_drivers and pr2_etherCAT is
> not supported. We have documentation on the wiki and in the code FYI
> only. I strongly recommend that you don't make any changes to the code
> in that stack, since it may cause damage to your robot.
> At startup, pr2_etherCAT detects all the slave devices, like WG005 and
> WG021 boards on the etherCAT chain. Then it loads an EthercatDevice
> plugin to communicate with each device. The plugin type is determine by
> the type that the device reports. "6805005" is a WG designation for a
> WG005 motor controller board, which controls most of the motors in a PR2.
> You can look in the code of pr2_ethercat_drivers for more details.
> Kevin
> On Mon, Feb 7, 2011 at 6:17 AM, Yann Sionneau
> <yann.sionneau at telecom-sudparis.eu
> <mailto:yann.sionneau at telecom-sudparis.eu>> wrote:
>     Hello,
>     I wonder how the binding is done between the different EtherCAT devices
>     and the actual C++ class of the device.
>     I've found it's been implemented as plugins, but I don't understand how
>     it works though.
>     For example in
>     ros/cturtle/stacks/pr2_ethercat_drivers/ethercat_hardware/src/wg0x.cpp
>     there is :
>     PLUGINLIB_REGISTER_CLASS(6805005, WG05, EthercatDevice);
>     Here the WG05 is a C++ class that extends the EthercatDevice class.
>     And in
>     ros/cturtle/stacks/pr2_ethercat_drivers/ethercat_hardware/ethercat_device_plugin.xml
>     there is :
>     <class name="6805005" type="WG05" base_class_type="EthercatDevice">
>     So there seem to be a link between the number 6805005 (btw what is this
>     number ?) and the class WG05 but I don't understand exactly how all of
>     this work.
>     Regarding the documentation I found there
>     (http://www.ros.org/wiki/pluginlib) the first argument of
>     PLUGINLIB_REGISTER_CLASS should be the name of the class ? or just some
>     kind of a key ?
>     Another question I have is : how does the discovery of all the devices
>     in the Ethercat bus work ?
>     How does ROS become aware of the fact that there are two devices of
>     class WG05 and three of class WG021 for example ?
>     I don't know if I am clear enough in my questions.
>     Regards,

More information about the ros-users mailing list