ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
5

Any good examples of using dynamic_reconfigure for a python node?

asked 2011-02-27 00:18:56 -0500

joq gravatar image

updated 2014-01-28 17:09:14 -0500

ngrennan gravatar image

I want to use dynamic_reconfigure with a python node. I know how to do it in C++, but could use a working python example to use as a model.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
4

answered 2011-02-27 04:00:40 -0500

updated 2011-02-27 05:21:40 -0500

Hmm, that rings a bell...

https://code.ros.org/lurker/message/20100421.190003.73490482.en.html

Unfortunately, if I did end up using dynamic_reconfigure server in a Python node, I can't find that node at the moment.

There is a small example of using a dynamic_reconfigure client on the wiki: http://www.ros.org/wiki/hokuyo_node/Tutorials/UsingDynparamToChangeHokuyoLaserParameters#PythonAPI

Edit: Found my code -- relevant bits excerpted:

from dynamic_reconfigure.server import Server as DynamicReconfigureServer
import flyer_controller.cfg.controllerConfig as Config
...
class Controller:

  def __init__(self):
     self.dyn_reconf_server = DynamicReconfigureServer(ConfigType, self.reconfigure) 

  def reconfigure(self, config, level):
     rospy.loginfo("Got reconfigure request!")
     self.command_frame = config["command_frame"]
     return config
edit flag offensive delete link more

Comments

Since the node itself is written in python, I need a server example. They seem hard to find.
joq gravatar image joq  ( 2011-02-27 04:39:13 -0500 )edit
Did you ever find a good example for the server in Python? I'm trying to set this up for one of my nodes right now and it's tougher than I thought it would be. If I figure it out I'll create a tutorial for everyone.
Thomas D gravatar image Thomas D  ( 2011-07-14 17:14:22 -0500 )edit
The fragment Patrick posted worked for me.
joq gravatar image joq  ( 2011-07-15 02:31:23 -0500 )edit
1
It worked for me too, don't know why I had trouble the first time. I have a tutorial at http://ibotics.ucsd.edu/stingray/wiki/ROSNodeTutorial. The tutorial shows how to create minimal C++ and Python nodes that use parameter server, dynamic reconfigure server and custom messages.
Thomas D gravatar image Thomas D  ( 2011-07-19 04:41:35 -0500 )edit

Is there an example that shows using level and updating the server outside of the callback with update_configuration?

lucasw gravatar image lucasw  ( 2016-04-23 07:05:01 -0500 )edit
1
lucasw gravatar image lucasw  ( 2016-04-23 07:51:08 -0500 )edit

Question Tools

Stats

Asked: 2011-02-27 00:18:56 -0500

Seen: 3,011 times

Last updated: Feb 27 '11