Quantcast
Channel: ROS Answers: Open Source Q&A Forum - RSS feed
Viewing all articles
Browse latest Browse all 40

Programatically load yaml config file to the Parameter Server

$
0
0
How should I do that? I've looked up along the roslaunch and dynamic reconfigure code but I don't find it. Do you know any standard function to do it? By the momment I've done this (but I understand that should exist another way):
config = yaml.load(open(custom_configuration_file))
rospy.loginfo(config)
self.recursive_set_param(config)
...

def recursive_set_param(self, config, key_path=""):
        for k in config.keys():
            data = config[k]
            
            full_qualified_key = key_path + "/" + k
            if data.__class__ == dict:
                self.recursive_set_param(data, full_qualified_key)
            else:
                rospy.set_param(full_qualified_key, config[k])
                rospy.loginfo("SETTING PARAM %s -> %s", full_qualified_key, data)

Viewing all articles
Browse latest Browse all 40

Trending Articles