Пример #1
0
def _configure():
    config = BrightArgs("o80 PAM introspection")
    config.add_option("segment_id", o80_pam.segment_ids.robot,
                      "o80 segment_id of the instance of o80 pam to display",
                      str)
    change_all = False
    finished = config.dialog(change_all, sys.argv[1:])
    if not finished:
        return None
    return config
Пример #2
0
def _configure():
    config = BrightArgs("o80 PAM log file stats")
    config.add_option("file_path",
                      o80_pam.FileManager().latest(),
                      "absolute path to the log file",
                      str,
                      integrity_checks=[FileExists()])
    change_all = False
    finished = config.dialog(change_all, sys.argv[1:])
    if not finished:
        return None
    return config
Пример #3
0
def _configure() -> BrightArgs:
    """
    Configuration dialog
    """

    global TENNICAM_CLIENT_DEFAULT_SEGMENT_ID
    global DEFAULT_SAVE_FOLDER
    global O80_PAM_DEFAULT_SEGMENT_ID
    config = BrightArgs("o80 robot / tennicam logger")
    config.add_option(
        "ball_segment_id",
        TENNICAM_CLIENT_DEFAULT_SEGMENT_ID,
        "ball_segment_id of the tennicam backend",
        str,
    )
    config.add_option(
        "robot_segment_id",
        O80_PAM_DEFAULT_SEGMENT_ID,
        "robot_segment_id of the o80_pam backend",
        str,
    )
    config.add_option(
        "filepath",
        str(_unique_path(DEFAULT_SAVE_FOLDER)),
        "absolute path of the log file",
        str,
    )
    config.add_option(
        "frequency",
        250.0,
        "frequency at which entries will be written in the file",
        float,
    )
    change_all = False
    config.dialog(change_all, sys.argv[1:])
    print()
    return config
Пример #4
0
def _configure():
    config = BrightArgs("o80 PAM console")
    config.add_option("segment_id",
                      o80_pam.segment_ids.robot,
                      "o80 segment_id of the instance of o80 pam to display",
                      str)
    config.add_option("nb_dofs",
                      4,
                      "number of degrees of freedom of the robots",
                      int,
                      integrity_checks=[Positive()])
    config.add_option("pressure_delta",
                      2000,
                      "each muscle will apply pressures +/- this value",
                      int,
                      [Range(1,10000)])
    config.add_option("speed",
                      1000,
                      "pressure of unit per seconds",
                      int,
                      [Range(1,10000)])
    change_all=False
    finished = config.dialog(change_all,sys.argv[1:])
    if not finished:
        return None
    return config
Пример #5
0
from lightargs import BrightArgs,Set,Range,Positive


bright = BrightArgs("Welcome to BrightArgs example")
bright.add_operation("operation1","operation number one")
bright.add_option("option1",1,"option number 1",int,integrity_checks=[Set(1,2,3),Range(1,3)])
bright.print_help()


bright.parse(["--operation1","-option1","3"])
bright.print_status()

try :
    bright.dialog(False)
except KeyboardInterrupt:
    pass
    
bright.print_status()
Пример #6
0
def _configure():
    config = BrightArgs("o80 PAM swing demo")
    config.add_option(
        "segment_id", o80_pam.segment_ids.robot,
        "o80 segment_id of the instance of o80 pam to connect to", str)
    config.add_option("duration", 1000,
                      "duration of a motion (in milliseconds)", int,
                      [Range(400, 10000)])
    config.add_option("relax_pressure", 8000, "starting and ending pressure",
                      int, [Range(0, 22000)])
    config.add_option("nb_iterations", 10,
                      "number of swing motions to perform", int, [Positive()])
    change_all = False
    finished = config.dialog(change_all, sys.argv[1:])
    if not finished:
        return None
    return config
Пример #7
0
def configure(robot : str):
    config = BrightArgs("o80 PAM {} robot".format(robot))
    setattr(config, "robot", robot)
    config.add_option(
        "segment_id", o80_pam.segment_ids.robot, "o80 backend segment_id ", str
    )
    config.add_operation(
        "bursting_mode", "will the backend be started in bursting mode ?"
    )
    config.add_option(
        "frequency",
        500.,
        "o80 backend frequency (non bursting mode only)",
        float,
        integrity_checks=[Range(1, 3000), Positive()],
    )
    if robot=="pamy2":
        config.add_option(
            "ip",
            "192.168.0.110",
            "IP of the udp socket of the robot",
            str)
        config.add_option(
            "port",
            4700,
            "PORT of the udp socket of the robot",
            int)
        config.add_option(
            "pam_config_file",
            pam_interface.Pamy2DefaultConfiguration.get_path(False),
            "pam configuration file",
            str,
            integrity_checks=[FileExists()],
        )
        config.nb_dofs=4
    else:
        config.add_option(
            "nb_dofs",
            4,
            "number of degrees of freedom of the robots",
            int,
            integrity_checks=[Positive()],
        )
        config.add_option(
            "pam_config_file",
            pam_interface.Pamy1DefaultConfiguration.get_path(False),
            "pam configuration file",
            str,
            integrity_checks=[FileExists()],
        )
    change_all = False
    finished = config.dialog(change_all, sys.argv[1:])
    print()
    if not finished:
        return None
    return config
Пример #8
0
def _configure():
    config = BrightArgs("o80 PAM console")
    config.add_option("segment_id", o80_pam.segment_ids.robot,
                      "o80 segment_id of the instance of o80 pam to display",
                      str)
    config.add_option("nb_dofs",
                      4,
                      "number of degrees of freedom of the robots",
                      int,
                      integrity_checks=[Positive()])
    config.add_option("refresh frequency", 100,
                      "refresh rate of the console (Hz)", int,
                      [Range(1, 1000)])
    config.add_option(
        "minimal_pressure", 5000,
        "minimal possible muscle pressure, for scaling purposes", int,
        [Positive()])
    config.add_option(
        "maximal_pressure", 25000,
        "maximal possible muscle pressure, for scaling purposes", int,
        [Positive()])
    config.add_option("width", 100,
                      "number of characters used for pressure bars", int,
                      [Positive()])
    change_all = False
    finished = config.dialog(change_all, sys.argv[1:])
    if not finished:
        return None
    return config
Пример #9
0
def _configure():
    config = BrightArgs("o80 PAM logger")
    # note: a backend is expected to be already running on this segment_id
    config.add_option("segment_id", o80_pam.segment_ids.robot,
                      "o80 segment_id of the instance to log", str)
    # the propose path does not exists, and contains the current date and time
    config.add_option(
        "file_path",
        o80_pam.FileManager().next(),
        "absolute path to the log file (will overwrite if existing !)", str)
    # all the observations generated between two iterations of the collection process
    # will be written, so (relatively) low frequency should be ok. 500Hz is likely to
    # be overkill, but that's fine
    config.add_option(
        "frequency", 500.,
        "frequency at which entries will be written in the file", float)
    # to have the process automatically stopping
    config.add_option(
        "duration", -1,
        "duration of record (in sec). if negative, infinite record time", int)
    change_all = False
    finished = config.dialog(change_all, sys.argv[1:])
    if not finished:
        return None
    return config
Пример #10
0
def _configure():
    config = BrightArgs("o80 PAM console")
    config.add_option("segment_id",
                      o80_pam.segment_ids.robot,
                      "o80 segment_id of the instance of o80 pam to display",
                      str)
    config.add_option("maximal_frequency",
                      3000,
                      "maximal frequency of the o80 backend, for scaling",
                      float,
                      [Positive()])
    config.add_option("nb_dofs",
                      4,
                      "number of degrees of freedom of the robot",
                      int,
                      [Positive()])
    config.add_option("window_width",
                      1200,
                      "plot window's width",
                      int,
                      [Positive()])
    config.add_option("window_height",
                      1000,
                      "plot window's height",
                      int,
                      [Positive()])
    config.add_option("data_size",
                      2000,
                      "number of running data points per plot",
                      int,
                      [Positive()])
    config.add_option("minimal_pressure",
                      5000,
                      "minimal possible muscle pressure, for scaling purposes",
                      int,
                      [Positive()])
    config.add_option("maximal_pressure",
                      25000,
                      "maximal possible muscle pressure, for scaling purposes",
                      int,
                      [Positive()])
    change_all=False
    finished = config.dialog(change_all,sys.argv[1:])
    if not finished:
        return None
    return config