Created
December 11, 2018 14:35
-
-
Save TheProjectsGuy/51dafe1de413ab321d85752a47ac4734 to your computer and use it in GitHub Desktop.
Python node for Dynamic reconfigure in ROS
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/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