(self)
return root_velocity_reward
Get the root velocity reward.
Get the root velocity reward.
Get the root velocity reward .
def _calc_reward_root_velocity(self):
    """Get the root velocity reward."""
    env = self._env
    robot = env.robot
    sim_model = robot.quadruped
    ref_model = self._ref_model
    pyb = self._get_pybullet_client()

    root_vel_ref, root_ang_vel_ref = pyb.getBaseVelocity(ref_model)
    root_vel_sim, root_ang_vel_sim = pyb.getBaseVelocity(sim_model)
    root_vel_ref = np.array(root_vel_ref)
    root_ang_vel_ref = np.array(root_ang_vel_ref)
    root_vel_sim = np.array(root_vel_sim)
    root_ang_vel_sim = np.array(root_ang_vel_sim)

    root_vel_diff = root_vel_ref - root_vel_sim
    root_vel_err = root_vel_diff.dot(root_vel_diff)

    root_ang_vel_diff = root_ang_vel_ref - root_ang_vel_sim
    root_ang_vel_err = root_ang_vel_diff.dot(root_ang_vel_diff)

    root_velocity_err = root_vel_err + 0.1 * root_ang_vel_err
    root_velocity_reward = np.exp(-self._root_velocity_err_scale *
                                  root_velocity_err)

    return root_velocity_reward
def _calc_reward_root_velocity ( self ) : env = self . _env robot = env . robot sim_model = robot . quadruped ref_model = self . _ref_model pyb = self . _get_pybullet_client ( ) root_vel_ref , root_ang_vel_ref = pyb . getBaseVelocity ( ref_model ) root_vel_sim , root_ang_vel_sim = pyb . getBaseVelocity ( sim_model ) root_vel_ref = np . array ( root_vel_ref ) root_ang_vel_ref = np . array ( root_ang_vel_ref ) root_vel_sim = np . array ( root_vel_sim ) root_ang_vel_sim = np . array ( root_ang_vel_sim ) root_vel_diff = root_vel_ref - root_vel_sim root_vel_err = root_vel_diff . dot ( root_vel_diff ) root_ang_vel_diff = root_ang_vel_ref - root_ang_vel_sim root_ang_vel_err = root_ang_vel_diff . dot ( root_ang_vel_diff ) root_velocity_err = root_vel_err + 0.1 * root_ang_vel_err root_velocity_reward = np . exp ( - self . _root_velocity_err_scale * root_velocity_err ) return root_velocity_reward