gym_pendula.py 文件源码

python
阅读 35 收藏 0 点赞 0 评论 0

项目:bullet-gym 作者: benelot 项目源码 文件源码
def calc_state(self):
        self.theta, theta_dot = self.j1.current_position()
        x, vx = self.slider.current_position()
        #assert( np.isfinite(x) )

        if not np.isfinite(x):
            print("x is inf")
            x = 0

        if not np.isfinite(vx):
            print("vx is inf")
            vx = 0

        if not np.isfinite(self.theta):
            print("theta is inf")
            self.theta = 0

        if not np.isfinite(theta_dot):
            print("theta_dot is inf")
            theta_dot = 0

        return np.array([
            x, vx,
            np.cos(self.theta), np.sin(self.theta), theta_dot
            ])
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号