コード例 #1
0
 def __init__(self, *args, **kwargs):
     super(CartpoleSwingupEnv, self).__init__(
         self.model_path("cartpole.xml.mako"),
         *args, **kwargs
     )
     self.max_cart_pos = 3
     self.max_reward_cart_pos = 3
     self.cart = find_body(self.world, "cart")
     self.pole = find_body(self.world, "pole")
     Serializable.__init__(self, *args, **kwargs)
コード例 #2
0
 def __init__(self, *args, **kwargs):
     self.max_pole_angle = .2
     self.max_cart_pos = 2.4
     self.max_cart_speed = 4.
     self.max_pole_speed = 4.
     self.reset_range = 0.05
     super(CartpoleEnv, self).__init__(self.model_path("cartpole.xml.mako"),
                                       *args, **kwargs)
     self.cart = find_body(self.world, "cart")
     self.pole = find_body(self.world, "pole")
     Serializable.__init__(self, *args, **kwargs)
コード例 #3
0
 def __init__(self, *args, **kwargs):
     # make sure mdp-level step is 100ms long
     kwargs["frame_skip"] = kwargs.get("frame_skip", 2)
     if kwargs.get("template_args", {}).get("noise", False):
         self.link_len = (np.random.rand() - 0.5) + 1
     else:
         self.link_len = 1
     kwargs["template_args"] = kwargs.get("template_args", {})
     kwargs["template_args"]["link_len"] = self.link_len
     super(DoublePendulumEnv,
           self).__init__(self.model_path("double_pendulum.xml.mako"),
                          *args, **kwargs)
     self.link1 = find_body(self.world, "link1")
     self.link2 = find_body(self.world, "link2")
     Serializable.__init__(self, *args, **kwargs)
コード例 #4
0
 def __init__(self, *args, **kwargs):
     Serializable.__init__(self, *args, **kwargs)
     self.random_start = kwargs.pop("random_start", True)
     self.random_start_range = kwargs.pop("random_start_range", 1.)
     super(CarParkingEnv, self).__init__(
         self.model_path("car_parking.xml"),
         *args, **kwargs
     )
     self.goal = find_body(self.world, "goal")
     self.car = find_body(self.world, "car")
     self.wheels = [
         body for body in self.world.bodies if "wheel" in _get_name(body)]
     self.front_wheels = [
         body for body in self.wheels if "front" in _get_name(body)]
     self.max_deg = 30.
     self.goal_radius = 1.
     self.vel_thres = 1e-1
     self.start_radius = 5.
コード例 #5
0
 def __init__(self,
              height_bonus=1.,
              goal_cart_pos=0.6,
              *args, **kwargs):
     super(MountainCarEnv, self).__init__(
         self.model_path("mountain_car.xml.mako"),
         *args, **kwargs
     )
     self.max_cart_pos = 2
     self.goal_cart_pos = goal_cart_pos
     self.height_bonus = height_bonus
     self.cart = find_body(self.world, "cart")
     Serializable.quick_init(self, locals())