获取接口

获取当前 Mech-Viz 工程所用的任务

获取当前 Mech-Viz 工程所用任务的函数如下所示。

def get_viz_task_names(self, msg={}, timeout=None):
    result = self.call_viz("getAllTaskNames", msg, timeout)
    logging.info("Property result: {}".format(json.loads(result)))
    return result

调用 get_viz_task_names() 后,返回 json 格式的字符串,表示获取的所有任务。

获取 Mech-Viz 或 Mech-Vision 工程中的参数

获取 Mech-Viz 或 Mech-Vision 工程中参数的函数如下所示。

def get_property_info(self, msg={}, get_viz=True, timeout=None):
    result = (self.call_viz if get_viz else self.call_vision)("getPropertyInfo", msg, timeout)
    logging.info("{0} property result: {1}".format("Viz" if get_viz else "Vision", json.loads(result)))
    return result

在调用时,未指定 msg 参数中的 “type”,则表示获取所有参数。若指定,则仅获取相应的参数。例如,调用 get_property_info(msg={“type”: “move”}) 后,返回 json 格式的字符串,表示获取的移动任务参数。