Пример #1
0
def create_default_randomizer_qbb() -> DomainRandomizer:
    """
    Create the default randomizer for the `QBallBalancerSim`.

    :return: randomizer based on the nominal domain parameter values
    """
    from pyrado.environments.pysim.quanser_ball_balancer import QBallBalancerSim
    dp_nom = QBallBalancerSim.get_nominal_domain_param()
    return DomainRandomizer(
        NormalDomainParam(name='g', mean=dp_nom['g'], std=dp_nom['g']/10, clip_lo=1e-4),
        NormalDomainParam(name='m_ball', mean=dp_nom['m_ball'], std=dp_nom['m_ball']/5, clip_lo=1e-4),
        NormalDomainParam(name='r_ball', mean=dp_nom['r_ball'], std=dp_nom['r_ball']/5, clip_lo=1e-3),
        NormalDomainParam(name='l_plate', mean=dp_nom['l_plate'], std=dp_nom['l_plate']/5, clip_lo=5e-2),
        NormalDomainParam(name='r_arm', mean=dp_nom['r_arm'], std=dp_nom['r_arm']/5, clip_lo=1e-4),
        NormalDomainParam(name='K_g', mean=dp_nom['K_g'], std=dp_nom['K_g']/4, clip_lo=1e-2),
        NormalDomainParam(name='J_l', mean=dp_nom['J_l'], std=dp_nom['J_l']/4, clip_lo=1e-6),
        NormalDomainParam(name='J_m', mean=dp_nom['J_m'], std=dp_nom['J_m']/4, clip_lo=1e-9),
        NormalDomainParam(name='k_m', mean=dp_nom['k_m'], std=dp_nom['k_m']/4, clip_lo=1e-4),
        NormalDomainParam(name='R_m', mean=dp_nom['R_m'], std=dp_nom['R_m']/4, clip_lo=1e-4),
        UniformDomainParam(name='eta_g', mean=dp_nom['eta_g'], halfspan=dp_nom['eta_g']/4, clip_lo=1e-4, clip_up=1),
        UniformDomainParam(name='eta_m', mean=dp_nom['eta_m'], halfspan=dp_nom['eta_m']/4, clip_lo=1e-4, clip_up=1),
        UniformDomainParam(name='B_eq', mean=dp_nom['B_eq'], halfspan=dp_nom['B_eq']/4, clip_lo=1e-4),
        UniformDomainParam(name='c_frict', mean=dp_nom['c_frict'], halfspan=dp_nom['c_frict']/4, clip_lo=1e-4),
        UniformDomainParam(name='V_thold_x_pos', mean=dp_nom['V_thold_x_pos'], halfspan=dp_nom['V_thold_x_pos']/3),
        UniformDomainParam(name='V_thold_x_neg', mean=dp_nom['V_thold_x_neg'], halfspan=abs(dp_nom['V_thold_x_neg'])/3),
        UniformDomainParam(name='V_thold_y_pos', mean=dp_nom['V_thold_y_pos'], halfspan=dp_nom['V_thold_y_pos']/3),
        UniformDomainParam(name='V_thold_y_neg', mean=dp_nom['V_thold_y_neg'], halfspan=abs(dp_nom['V_thold_y_neg'])/3),
        UniformDomainParam(name='offset_th_x', mean=dp_nom['offset_th_x'], halfspan=6./180*np.pi),
        UniformDomainParam(name='offset_th_y', mean=dp_nom['offset_th_y'], halfspan=6./180*np.pi)
    )
Пример #2
0
def create_default_randomizer_qbb() -> DomainRandomizer:
    """
    Create the default randomizer for the `QBallBalancerSim`.

    :return: randomizer based on the nominal domain parameter values
    """
    from pyrado.environments.pysim.quanser_ball_balancer import QBallBalancerSim

    dp_nom = QBallBalancerSim.get_nominal_domain_param()
    return DomainRandomizer(
        NormalDomainParam(name="gravity_const",
                          mean=dp_nom["gravity_const"],
                          std=dp_nom["gravity_const"] / 10,
                          clip_lo=1e-4),
        NormalDomainParam(name="ball_mass",
                          mean=dp_nom["ball_mass"],
                          std=dp_nom["ball_mass"] / 5,
                          clip_lo=1e-4),
        NormalDomainParam(name="ball_radius",
                          mean=dp_nom["ball_radius"],
                          std=dp_nom["ball_radius"] / 5,
                          clip_lo=1e-3),
        NormalDomainParam(name="plate_length",
                          mean=dp_nom["plate_length"],
                          std=dp_nom["plate_length"] / 5,
                          clip_lo=5e-2),
        NormalDomainParam(name="arm_radius",
                          mean=dp_nom["arm_radius"],
                          std=dp_nom["arm_radius"] / 5,
                          clip_lo=1e-4),
        NormalDomainParam(name="gear_ratio",
                          mean=dp_nom["gear_ratio"],
                          std=dp_nom["gear_ratio"] / 4,
                          clip_lo=1e-2),
        NormalDomainParam(name="load_inertia",
                          mean=dp_nom["load_inertia"],
                          std=dp_nom["load_inertia"] / 4,
                          clip_lo=1e-6),
        NormalDomainParam(name="motor_inertia",
                          mean=dp_nom["motor_inertia"],
                          std=dp_nom["motor_inertia"] / 4,
                          clip_lo=1e-9),
        NormalDomainParam(name="motor_back_emf",
                          mean=dp_nom["motor_back_emf"],
                          std=dp_nom["motor_back_emf"] / 4,
                          clip_lo=1e-4),
        NormalDomainParam(name="motor_resistance",
                          mean=dp_nom["motor_resistance"],
                          std=dp_nom["motor_resistance"] / 4,
                          clip_lo=1e-4),
        UniformDomainParam(
            name="gear_efficiency",
            mean=dp_nom["gear_efficiency"],
            halfspan=dp_nom["gear_efficiency"] / 4,
            clip_lo=1e-4,
            clip_up=1,
        ),
        UniformDomainParam(
            name="motor_efficiency",
            mean=dp_nom["motor_efficiency"],
            halfspan=dp_nom["motor_efficiency"] / 4,
            clip_lo=1e-4,
            clip_up=1,
        ),
        UniformDomainParam(
            name="combined_damping",
            mean=dp_nom["combined_damping"],
            halfspan=dp_nom["combined_damping"] / 4,
            clip_lo=1e-4,
        ),
        UniformDomainParam(name="ball_damping",
                           mean=dp_nom["ball_damping"],
                           halfspan=dp_nom["ball_damping"] / 4,
                           clip_lo=1e-4),
        UniformDomainParam(name="voltage_thold_x_pos",
                           mean=dp_nom["voltage_thold_x_pos"],
                           halfspan=dp_nom["voltage_thold_x_pos"] / 3),
        UniformDomainParam(
            name="voltage_thold_x_neg",
            mean=dp_nom["voltage_thold_x_neg"],
            halfspan=abs(dp_nom["voltage_thold_x_neg"]) / 3,
        ),
        UniformDomainParam(name="voltage_thold_y_pos",
                           mean=dp_nom["voltage_thold_y_pos"],
                           halfspan=dp_nom["voltage_thold_y_pos"] / 3),
        UniformDomainParam(
            name="voltage_thold_y_neg",
            mean=dp_nom["voltage_thold_y_neg"],
            halfspan=abs(dp_nom["voltage_thold_y_neg"]) / 3,
        ),
        UniformDomainParam(name="offset_th_x",
                           mean=dp_nom["offset_th_x"],
                           halfspan=6.0 / 180 * np.pi),
        UniformDomainParam(name="offset_th_y",
                           mean=dp_nom["offset_th_y"],
                           halfspan=6.0 / 180 * np.pi),
    )