示例#1
0
def list_filter_types(req):
    res = ros_vision.srv.ListFilterTypesResponse()
    descriptors = Filter.list_descriptors()

    for filter_name in descriptors.keys():
        res.filter_list.filters.append(MessageFactory.create_filter_message_from_descriptor(descriptors[filter_name]))

    return res
示例#2
0
def load_workspace(req):
    res = ros_vision.srv.LoadWorkspaceResponse()
    rospack = rospkg.RosPack()
    name = os.path.join(rospack.get_path("ros_vision"), "workspaces/" + req.name + ".yaml")

    if not os.path.exists(name):
        name = req.name + ".yaml"

    workspace.reset()
    workspace.name = req.name

    with open(name, 'r') as f:
        for filtergroup_name, filters in yaml.load(f).items():
            workspace.add_group(filtergroup_name, None, filters)

    while not workspace.is_ready() and not rospy.is_shutdown():
        rospy.sleep(0.1)

    res.workspace = MessageFactory.create_workspace_message_from_workspace(workspace)

    return res
def update_filter_topic():
    msg = ros_vision.msg.FilterList()
    for f in fc.get_filters():
        msg.filters.append(MessageFactory.create_filter_message_from_filter(f))

    filter_topic.publish(msg)
示例#4
0
def get_workspace(req):
    res = ros_vision.srv.GetWorkspaceResponse()
    res.workspace = MessageFactory.create_workspace_message_from_workspace(workspace)

    return res