本文整理汇总了Python中pybullet.startStateLogging方法的典型用法代码示例。如果您正苦于以下问题:Python pybullet.startStateLogging方法的具体用法?Python pybullet.startStateLogging怎么用?Python pybullet.startStateLogging使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pybullet
的用法示例。
在下文中一共展示了pybullet.startStateLogging方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: reset
# 需要导入模块: import pybullet [as 别名]
# 或者: from pybullet import startStateLogging [as 别名]
def reset(self):
obs = self.env.reset()
self._episode_idx += 1
import pybullet
pybullet.startStateLogging(
pybullet.STATE_LOGGING_VIDEO_MP4,
os.path.join(self._dirname, '{}.mp4'.format(self._episode_idx)))
return obs
示例2: log_video
# 需要导入模块: import pybullet [as 别名]
# 或者: from pybullet import startStateLogging [as 别名]
def log_video(self, task_name):
"""
Logs video of each task being executed
"""
if not os.path.exists("video_logs/"):
os.makedirs("video_logs")
try:
p.stopStateLogging(self.curr_recording)
self.video_log_key += 1
except Exception:
print("No Video Currently Being Logged")
self.curr_recording = p.startStateLogging(p.STATE_LOGGING_VIDEO_MP4,
"video_logs/task_vid_" +
str(task_name) + "_" + str(self.video_log_key) + ".mp4")
示例3: __init__
# 需要导入模块: import pybullet [as 别名]
# 或者: from pybullet import startStateLogging [as 别名]
def __init__(self,
urdfRoot=pybullet_data.getDataPath(),
actionRepeat=1,
isEnableSelfCollision=True,
renders=False,
isDiscrete=False,
maxSteps = 1000):
#print("KukaGymEnv __init__")
self._isDiscrete = isDiscrete
self._timeStep = 1./240.
self._urdfRoot = urdfRoot
self._actionRepeat = actionRepeat
self._isEnableSelfCollision = isEnableSelfCollision
self._observation = []
self._envStepCounter = 0
self._renders = renders
self._maxSteps = maxSteps
self.terminated = 0
self._cam_dist = 1.3
self._cam_yaw = 180
self._cam_pitch = -40
self._p = p
if self._renders:
cid = p.connect(p.SHARED_MEMORY)
if (cid<0):
cid = p.connect(p.GUI)
p.resetDebugVisualizerCamera(1.3,180,-41,[0.52,-0.2,-0.33])
else:
p.connect(p.DIRECT)
#timinglog = p.startStateLogging(p.STATE_LOGGING_PROFILE_TIMINGS, "kukaTimings.json")
self._seed()
self.reset()
observationDim = len(self.getExtendedObservation())
#print("observationDim")
#print(observationDim)
observation_high = np.array([largeValObservation] * observationDim)
if (self._isDiscrete):
self.action_space = spaces.Discrete(7)
else:
action_dim = 3
self._action_bound = 1
action_high = np.array([self._action_bound] * action_dim)
self.action_space = spaces.Box(-action_high, action_high)
self.observation_space = spaces.Box(-observation_high, observation_high)
self.viewer = None
示例4: __init__
# 需要导入模块: import pybullet [as 别名]
# 或者: from pybullet import startStateLogging [as 别名]
def __init__(self,
urdfRoot=pybullet_data.getDataPath(),
actionRepeat=1,
isEnableSelfCollision=True,
renders=False,
isDiscrete=False):
self._timeStep = 1./240.
self._urdfRoot = urdfRoot
self._actionRepeat = actionRepeat
self._isEnableSelfCollision = isEnableSelfCollision
self._observation = []
self._envStepCounter = 0
self._renders = renders
self._width = 341
self._height = 256
self._isDiscrete=isDiscrete
self.terminated = 0
self._p = p
if self._renders:
cid = p.connect(p.SHARED_MEMORY)
if (cid<0):
p.connect(p.GUI)
p.resetDebugVisualizerCamera(1.3,180,-41,[0.52,-0.2,-0.33])
else:
p.connect(p.DIRECT)
#timinglog = p.startStateLogging(p.STATE_LOGGING_PROFILE_TIMINGS, "kukaTimings.json")
self._seed()
self.reset()
observationDim = len(self.getExtendedObservation())
#print("observationDim")
#print(observationDim)
observation_high = np.array([np.finfo(np.float32).max] * observationDim)
if (self._isDiscrete):
self.action_space = spaces.Discrete(7)
else:
action_dim = 3
self._action_bound = 1
action_high = np.array([self._action_bound] * action_dim)
self.action_space = spaces.Box(-action_high, action_high)
self.observation_space = spaces.Box(low=0, high=255, shape=(self._height, self._width, 4))
self.viewer = None