[ros-users] dynamic_reconfigure server in Python?

Patrick Bouffard bouffard at eecs.berkeley.edu
Wed Apr 21 21:23:37 UTC 2010


Ah, I see. In fact the make step does do code generation for Python as
well. I hadn't noticed that it created
<package>/src/<package>/cfg/fooConfig.py. I just had to add
<package>/src/<package>/__init__.py and I can instantiate the Server.

When I run my node and reconfigure_gui, however, I don't see anything
show up in the reconfigure_gui dropdown, and if I run

rosrun dynamic_reconfigure dynparam list

... nothing is listed either.

Pat

On Wed, Apr 21, 2010 at 1:42 PM, Blaise Gassend <blaise at willowgarage.com> wrote:
> 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
>
>
> _______________________________________________
> 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