Skip to content

Instantly share code, notes, and snippets.

@TheProjectsGuy
Created December 11, 2018 14:35
Show Gist options
  • Select an option

  • Save TheProjectsGuy/51dafe1de413ab321d85752a47ac4734 to your computer and use it in GitHub Desktop.

Select an option

Save TheProjectsGuy/51dafe1de413ab321d85752a47ac4734 to your computer and use it in GitHub Desktop.
Python node for Dynamic reconfigure in ROS
#!/usr/bin/env python
# Import rospy
import rospy
# Main dynamic reconfiguration files
from dynamic_reconfigure.server import Server
# Configuration made in the devel folder
from intro_pkg1.cfg import SampleConfig
# Callback function
def callback(config, level):
rospy.loginfo("Values: {0}, {1}, {2}, {3}, {4}".format(config.Integer_param,
config.Double_param, config.String_param,
"True" if config.Bool_param else "False", config.Size))
return config
# Main code
if __name__ == "__main__":
# Initialize the node
rospy.init_node("python_configure", anonymous=True)
# Server assignment
srv = Server(SampleConfig, callback)
# Spin the node
rospy.spin()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment