コード例 #1
0
def main():
    fel.felicia_init()

    delegate = TopicCreateFlag()
    parser = cli.FlagParser()
    parser.set_program_name('protobuf_node_creator')
    if not parser.parse(len(sys.argv), sys.argv, delegate):
        sys.exit(1)

    master_proxy = fel.master_proxy
    s = master_proxy.start()
    if not s.ok():
        print("{} {}.".format(cli.RED_ERROR, s), file=sys.stderr)
        sys.exit(1)

    node_info = NodeInfo()
    node_info.name = delegate.name_flag.value

    ssl_server_context = None
    if delegate.is_publshing_node_flag.value:
        if delegate.use_ssl_flag.value:
            cert_file_path = fel.FilePath("examples/cert/server.crt")
            private_key_file_path = fel.FilePath("examples/cert/server.key")
            ssl_server_context = fel.channel.SSLServerContext.new_ssl_server_context(
                cert_file_path, private_key_file_path)
        master_proxy.request_register_node(ProtobufPublishingNode, node_info,
                                           delegate, ssl_server_context)
    else:
        master_proxy.request_register_node(ProtobufSubscribingNode, node_info,
                                           delegate)

    fel.main_thread.run()
コード例 #2
0
def main():
    fel.felicia_init()

    delegate = SimpleServiceFlag()
    parser = cli.FlagParser()
    parser.set_program_name('ros_srv_node_creator')
    if not parser.parse(len(sys.argv), sys.argv, delegate):
        sys.exit(1)

    master_proxy = fel.master_proxy
    s = master_proxy.start()
    if not s.ok():
        print("{} {}.".format(cli.RED_ERROR, s), file=sys.stderr)
        sys.exit(1)

    node_info = NodeInfo()
    node_info.name = delegate.name_flag.value

    if delegate.is_server_flag.value:
        master_proxy.request_register_node(RosSrvServerNode, node_info,
                                           delegate)
    else:
        master_proxy.request_register_node(RosSrvClientNode, node_info,
                                           delegate)

    fel.main_thread.run()
コード例 #3
0
def main():
    fel.felicia_init()

    delegate = TopicCreateFlag()
    parser = cli.FlagParser()
    parser.set_program_name('ros_msg_node_creator')
    if not parser.parse(len(sys.argv), sys.argv, delegate):
        sys.exit(1)

    s = fel.MasterProxy.start()
    if not s.ok():
        print("{} {}.".format(cli.RED_ERROR, s), file=sys.stderr)
        sys.exit(1)

    node_info = NodeInfo()
    node_info.name = delegate.name_flag.value

    if delegate.is_publshing_node_flag.value:
        fel.MasterProxy.request_register_node(RosMsgPublishingNode, node_info,
                                              delegate)
    else:
        fel.MasterProxy.request_register_node(RosMsgSubscribingNode, node_info,
                                              delegate)

    fel.MasterProxy.run()
コード例 #4
0
def main():
    fel.felicia_init()

    camera_descriptors = []
    s = fel.drivers.CameraFactory.get_camera_descriptors(camera_descriptors)
    if not s.ok():
        print("{} {}.".format(cli.RED_ERROR, s), file=sys.stderr)
        sys.exit(1)

    if len(camera_descriptors) == 0:
        print("{} {}.".format(cli.RED_ERROR, "No camera device"), file=sys.stderr)
        sys.exit(1)

    master_proxy = fel.master_proxy
    s = master_proxy.start()
    if not s.ok():
        print("{} {}.".format(cli.RED_ERROR, s), file=sys.stderr)
        sys.exit(1)

    node_info = NodeInfo()

    # Use the first camera
    master_proxy.request_register_node(
        ObjectDetectionNode, node_info, "message", camera_descriptors[0])

    fel.main_thread.run()
コード例 #5
0
def main():
    fel.felicia_init()

    delegate = OpenposeFlag()
    parser = cli.FlagParser()
    parser.set_program_name('human_pose_estimation_from_camera')
    if not parser.parse(len(sys.argv), sys.argv, delegate):
        sys.exit(1)

    camera_descriptors = []
    s = fel.drivers.CameraFactory.get_camera_descriptors(camera_descriptors)
    if not s.ok():
        print("{} {}.".format(cli.RED_ERROR, s), file=sys.stderr)
        sys.exit(1)

    if len(camera_descriptors) == 0:
        print("{} {}.".format(cli.RED_ERROR, "No camera device"), file=sys.stderr)
        sys.exit(1)

    s = fel.MasterProxy.start()
    if not s.ok():
        print("{} {}.".format(cli.RED_ERROR, s), file=sys.stderr)
        sys.exit(1)

    node_info = NodeInfo()
    params = dict()
    for flag in delegate._flags:
        params[flag.long_name[2:]] = flag.value

    # Use the first camera
    fel.MasterProxy.request_register_node(
        HumanPoseEstimationNode, node_info, "message", camera_descriptors[0], params)

    fel.MasterProxy.run()
コード例 #6
0
def main():
    fel.felicia_init()

    delegate = CameraFlag()
    parser = cli.FlagParser()
    parser.set_program_name('camera_node_creator')
    if not parser.parse(len(sys.argv), sys.argv, delegate):
        sys.exit(1)

    camera_descriptors = []
    s = fel.drivers.CameraFactory.get_camera_descriptors(camera_descriptors)
    if not s.ok():
        print("{} {}.".format(cli.RED_ERROR, s), file=sys.stderr)
        sys.exit(1)

    if delegate.device_index_flag.is_set():
        if len(camera_descriptors) <= delegate.device_index_flag.value:
            print("{} {}".format(cli.RED_ERROR,
                                 "Please set device_index among them.."))
            for i in range(len(camera_descriptors)):
                print("[{}] {}".format(i, camera_descriptors[i]),
                      file=sys.stderr)
            sys.exit(1)

    if delegate.device_list_flag.value:
        if delegate.device_index_flag.is_set():
            camera_formats = []
            s = fel.drivers.CameraFactory.get_supported_camera_formats(
                camera_descriptors[delegate.device_index_flag.value],
                camera_formats)
            if not s.ok():
                print("{} {}.".format(cli.RED_ERROR, s), file=sys.stderr)
                sys.exit(1)
            for i in range(len(camera_formats)):
                print("[{}] {}".format(i, camera_formats[i]))
        else:
            for i in range(len(camera_descriptors)):
                print("[{}] {}".format(i, camera_descriptors[i]))
        sys.exit(0)

    s = fel.MasterProxy.start()
    if not s.ok():
        print("{} {}.".format(cli.RED_ERROR, s), file=sys.stderr)
        sys.exit(1)

    node_info = NodeInfo()
    node_info.name = delegate.name_flag.value

    if delegate.is_publshing_node_flag.value:
        fel.MasterProxy.request_register_node(
            CameraPublishingNode, node_info, delegate,
            camera_descriptors[delegate.device_index_flag.value])
    else:
        fel.MasterProxy.request_register_node(CameraSubscribingNode, node_info,
                                              delegate)

    fel.MasterProxy.run()