编码
mkdir nodes
vim server.py
#!/usr/bin/env python
import rospy
from dynamic_reconfigure.server import Server
from dynamic_tutorials.cfg import TutorialsConfig
def callback(config, level):
rospy.loginfo("""Reconfigure Request: {int_param}, {double_param},\
{str_param}, {bool_param}, {size}""".format(**config))
return config
if __name__ == "__main__":
rospy.init_node("dynamic_tutorials", anonymous = True)
srv = Server(TutorialsConfig, callback)
rospy.spin()
chmod +x nodes/server.py
运行测试
sudo apt-get install ros-indigo-rqt-reconfigure
rosrun dynamic_tutorials server.py
rosrun rqt_gui rqt_gui -s reconfigure