[ros-users] dynamic_reconfigure server in Python?

Blaise Gassend blaise at willowgarage.com
Wed Apr 21 20:42:10 UTC 2010


Sorry, for some reason I was thinking that image_rotate was python. Have
a look at pr2_camera_synchronizer. It is big and messy, but the
reconfigure part is pretty simple. Look at
src/pr2_camera_synchronizer/synchronizer_classes.py

Relevant lines to your question:
   from pr2_camera_synchronizer.cfg import CameraSynchronizerConfig as
ConfigType
   self.server = DynamicReconfigureServer(ConfigType, self.reconfigure)


On Wed, 2010-04-21 at 13:35 -0700, Patrick Bouffard wrote:
> Thanks Blaise. That will probably help, though I'm looking for an
> example in Python.
> 
> Specifically, I'm stuck as to how to specify the 'type' argument when
> instantiating a dynamic_reconfigure.server.Server:
> 
> class Server(object):
>     def __init__(self, type, callback): <== what is type?
> ...
> 
> I can see that, for C++, there is a build step that generates a C++
> class from the .cfg file, i.e. if I have Test.cfg it generates a
> TestConfig class. And as shown in the example you point to, that is
> the type that is specified in the templated constructor for the
> server. So I imagine there is some equivalent to this in python that
> probably doesn't involve any code generation, since the .cfg file
> itself is really a python script. But I'm at a loss to figure out
> exactly how to proceed. I imagine it should look something like:
> 
> import dynamic_reconfigure
> from ____.___ import ____
> ...
> myserver = dynamic_reconfigure.server.Server(____, my_callback)
> 
> Any guesses how I should fill in the blanks? :)
> 
> Pat
> 
> On Wed, Apr 21, 2010 at 1:21 PM, Blaise Gassend <blaise at willowgarage.com> wrote:
> > No documentation yet, but you can have a look at this node, which is
> > pretty simple:
> > svn co
> > https://code.ros.org/svn/wg-ros-pkg/branches/trunk_boxturtle/sandbox/image_rotate
> >
> > On Wed, 2010-04-21 at 12:00 -0700, Patrick Bouffard wrote:
> >> Is anyone aware of an example of a dynamic_reconfigure server as part
> >> of a Python node? The documentation seems to only talk about how to
> >> set up a client, but code for the server does appear to be in
> >> boxturtle and I have some Python based nodes which I would like to be
> >> able to dynamically_reconfigure. :)
> >>
> >> Thanks,
> >> Pat
> >> _______________________________________________
> >> ros-users mailing list
> >> ros-users at code.ros.org
> >> https://code.ros.org/mailman/listinfo/ros-users
> >
> >
> > _______________________________________________
> > ros-users mailing list
> > ros-users at code.ros.org
> > https://code.ros.org/mailman/listinfo/ros-users
> >
> _______________________________________________
> ros-users mailing list
> ros-users at code.ros.org
> https://code.ros.org/mailman/listinfo/ros-users





More information about the ros-users mailing list