当前位置: 首页>>代码示例>>Python>>正文


Python mujoco_py.MjSimState方法代码示例

本文整理汇总了Python中mujoco_py.MjSimState方法的典型用法代码示例。如果您正苦于以下问题:Python mujoco_py.MjSimState方法的具体用法?Python mujoco_py.MjSimState怎么用?Python mujoco_py.MjSimState使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在mujoco_py的用法示例。


在下文中一共展示了mujoco_py.MjSimState方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: reset_to_state

# 需要导入模块: import mujoco_py [as 别名]
# 或者: from mujoco_py import MjSimState [as 别名]
def reset_to_state(self, state, call_forward=True):
        """
        Reset to given state.

        Args:
        - state (MjSimState): desired state.
        """
        if not isinstance(state, MjSimState):
            raise TypeError(
                "You must reset to an explicit state (MjSimState).")

        if self.sim is None:
            if self._current_seed is None:
                self._update_seed()

            self.sim = self.get_sim(self._current_seed)
        else:
            # Ensure environment state not captured in MuJoCo's qpos/qvel
            # is reset to the state defined by the model.
            self.sim.reset()

        self.set_state(state, call_forward=call_forward)

        self.t = 0
        return self._reset_sim_and_spaces() 
开发者ID:openai,项目名称:mujoco-worldgen,代码行数:27,代码来源:env.py

示例2: set_state

# 需要导入模块: import mujoco_py [as 别名]
# 或者: from mujoco_py import MjSimState [as 别名]
def set_state(self, qpos, qvel):
        assert qpos.shape == (self.model.nq,) and qvel.shape == (self.model.nv,)
        old_state = self.sim.get_state()
        new_state = mujoco_py.MjSimState(old_state.time, qpos, qvel,
                                         old_state.act, old_state.udd_state)
        self.sim.set_state(new_state)
        self.sim.forward() 
开发者ID:ArztSamuel,项目名称:DRL_DeliveryDuel,代码行数:9,代码来源:mujoco_env.py

示例3: set_state

# 需要导入模块: import mujoco_py [as 别名]
# 或者: from mujoco_py import MjSimState [as 别名]
def set_state(self, state, call_forward=True):
        """
        Sets the state of the enviroment to the given value. It does not
        set time.

        Warning: This only sets the MuJoCo state by setting qpos/qvel
            (and the user-defined state "udd_state"). It doesn't set
            the state of objects which don't have joints.

        Args:
        - state (MjSimState): desired state.
        - call_forward (bool): if True, forward simulation after setting
            state.
        """
        if not isinstance(state, MjSimState):
            raise TypeError("state must be an MjSimState")
        if self.sim is None:
            raise EmptyEnvException(
                "You must call reset() or reset_to_state() before setting the "
                "state the first time")

        # Call forward to write out values in the MuJoCo data.
        # Note: if udd_callback is set on the MjSim instance, then the
        # user will need to call forward() manually before calling step.
        self.sim.set_state(state)
        if call_forward:
            self.sim.forward() 
开发者ID:openai,项目名称:mujoco-worldgen,代码行数:29,代码来源:env.py

示例4: get_state

# 需要导入模块: import mujoco_py [as 别名]
# 或者: from mujoco_py import MjSimState [as 别名]
def get_state(self):
        """
        Returns a copy of the current environment state.

        Returns:
        - state (MjSimState): state of the environment's MjSim object.
        """
        if self.sim is None:
            raise EmptyEnvException(
                "You must call reset() or reset_to_state() before accessing "
                "the state the first time")
        return self.sim.get_state() 
开发者ID:openai,项目名称:mujoco-worldgen,代码行数:14,代码来源:env.py

示例5: set_state

# 需要导入模块: import mujoco_py [as 别名]
# 或者: from mujoco_py import MjSimState [as 别名]
def set_state(self, qpos, qvel):
        assert qpos.shape == (self.model.nq,) and qvel.shape == (self.model.nv,)
        old_state = self.sim.get_state()
        new_state = mujoco_py.MjSimState(old_state.time, qpos, qvel,
                                         old_state.act, old_state.udd_state)
        self.sim.set_state(new_state)
        # print(self.sim)
        # print(qpos)
        # print(qvel)
        self.sim.forward() 
开发者ID:KamyarGh,项目名称:rl_swiss,代码行数:12,代码来源:pusher_mujoco_env.py

示例6: _set_state

# 需要导入模块: import mujoco_py [as 别名]
# 或者: from mujoco_py import MjSimState [as 别名]
def _set_state(self, qpos, qvel):
        old_state = self.sim.get_state()
        new_state = mujoco_py.MjSimState(old_state.time, qpos, qvel,
                                         old_state.act, old_state.udd_state)
        self.sim.set_state(new_state)
        self.sim.forward() 
开发者ID:MushroomRL,项目名称:mushroom-rl,代码行数:8,代码来源:humanoid_gait.py


注:本文中的mujoco_py.MjSimState方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。