test_load_env_var_types.py 文件源码

python
阅读 17 收藏 0 点赞 0 评论 0

项目:openag_brain 作者: OpenAgInitiative 项目源码 文件源码
def test_valid_variables(self):
        ENVIRONMENTAL_VARIABLES = frozenset(
            VariableInfo.from_dict(d)
            for d in rospy.get_param("/var_types/environment_variables").itervalues())

        RECIPE_VARIABLES = frozenset(
            VariableInfo.from_dict(d)
            for d in rospy.get_param("/var_types/recipe_variables").itervalues())

        VALID_VARIABLES = ENVIRONMENTAL_VARIABLES.union(RECIPE_VARIABLES)
        print(VALID_VARIABLES)
        assert len(VALID_VARIABLES) == 19


        # This builds a dictionary of publisher instances using a
        # "dictionary comprehension" (syntactic sugar for building dictionaries).
        # The constant has to be declared here because get_message_class
        # needs to be called after the node is initialized.
        PUBLISHERS = {
            variable.name: rospy.Publisher(
                "{}/desired".format(variable.name),
                get_message_class(variable.type),
                queue_size=10)
            for variable in VALID_VARIABLES
        }
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号