本文整理匯總了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