in experiments/rolling/RollingEnv.py [0:0]
def step(self, render=True):
"""
Step simulation, sync with tacto simulator
Args:
render: whether render tactile imprints, Default: True
"""
# Step in pybullet
pb.stepSimulation()
if not (render):
return
st = time.time()
# Sync tacto
self.digits.update()
# Render tactile imprints
self.color, self.depth = self.digits.render()
self.time_render.append(time.time() - st)
self.time_render = self.time_render[-100:]
# print("render {:.4f}s".format(np.mean(self.time_render)), end=" ")
st = time.time()
if self.recordLogs:
self.logs["touch"].append([self.color.copy(), self.depth])
self.visionColor, self.visionDepth = self.cam.get_image()
self.logs["vision"].append([self.visionColor, self.visionDepth])
if self.visTacto:
color1 = self.color[1].copy()
x0 = int(self.goal[0] * self.tactoResolution[1])
y0 = int(self.goal[1] * self.tactoResolution[0])
color1[x0 - 4 : x0 + 4, y0 - 4 : y0 + 4, :] = [255, 255, 255]
# color1 = draw_circle(color1, self.goal)
self.color[1] = color1
self.digits.updateGUI(self.color, self.depth)
self.time_vis.append(time.time() - st)
self.time_vis = self.time_vis[-100:]