Esempio n. 1
0
 def close(self):
     try:
         if self._connected:
             if self._load_egl and self._plugin is not None:
                 pb.unloadPlugin(self._plugin,
                                 physicsClientId=self.client_id)
             pb.disconnect(physicsClientId=self.client_id)
     except pb.error:
         raise RuntimeError(pb.error)
Esempio n. 2
0
 def _disconnect_physic_clients(self):
     if self._egl_plugin is not None:
         p.unloadPlugin(self._egl_plugin)
     for i in range(self._num_physic_clients):
         p.disconnect(physicsClientId=i)
Esempio n. 3
0
pixelWidth = 320
pixelHeight = 220
camTargetPos = [0,0,0]
camDistance = 4
pitch = -10.0
roll=0
upAxisIndex = 2


while (p.isConnected()):
    for yaw in range (0,360,10) :
        start = time.time()
        p.stepSimulation()
        stop = time.time()
        print ("stepSimulation %f" % (stop - start))

        #viewMatrix = [1.0, 0.0, -0.0, 0.0, -0.0, 0.1736481785774231, -0.9848078489303589, 0.0, 0.0, 0.9848078489303589, 0.1736481785774231, 0.0, -0.0, -5.960464477539063e-08, -4.0, 1.0]
        viewMatrix = p.computeViewMatrixFromYawPitchRoll(camTargetPos, camDistance, yaw, pitch, roll, upAxisIndex)
        projectionMatrix  = [1.0825318098068237, 0.0, 0.0, 0.0, 0.0, 1.732050895690918, 0.0, 0.0, 0.0, 0.0, -1.0002000331878662, -1.0, 0.0, 0.0, -0.020002000033855438, 0.0]

        start = time.time()
        img_arr = p.getCameraImage(pixelWidth, pixelHeight, viewMatrix=viewMatrix, projectionMatrix=projectionMatrix, shadow=1,lightDirection=[1,1,1])
        stop = time.time()
        print ("renderImage %f" % (stop - start))
        #time.sleep(.1)
        #print("img_arr=",img_arr)


p.unloadPlugin(plugin)
Esempio n. 4
0
upAxisIndex = 2

while (p.isConnected()):
  for yaw in range(0, 360, 10):
    start = time.time()
    p.stepSimulation()
    stop = time.time()
    print("stepSimulation %f" % (stop - start))

    #viewMatrix = [1.0, 0.0, -0.0, 0.0, -0.0, 0.1736481785774231, -0.9848078489303589, 0.0, 0.0, 0.9848078489303589, 0.1736481785774231, 0.0, -0.0, -5.960464477539063e-08, -4.0, 1.0]
    viewMatrix = p.computeViewMatrixFromYawPitchRoll(camTargetPos, camDistance, yaw, pitch, roll,
                                                     upAxisIndex)
    projectionMatrix = [
        1.0825318098068237, 0.0, 0.0, 0.0, 0.0, 1.732050895690918, 0.0, 0.0, 0.0, 0.0,
        -1.0002000331878662, -1.0, 0.0, 0.0, -0.020002000033855438, 0.0
    ]

    start = time.time()
    img_arr = p.getCameraImage(pixelWidth,
                               pixelHeight,
                               viewMatrix=viewMatrix,
                               projectionMatrix=projectionMatrix,
                               shadow=1,
                               lightDirection=[1, 1, 1])
    stop = time.time()
    print("renderImage %f" % (stop - start))
    #time.sleep(.1)
    #print("img_arr=",img_arr)

p.unloadPlugin(plugin)
Esempio n. 5
0
File: simenv.py Progetto: drMJ/roman
 def disconnect(self):
     if self.__egl_plugin is not None:
         pb.unloadPlugin(self.__egl_plugin)
     pb.disconnect()
Esempio n. 6
0
 def unload(self):
     """Unload plugin
     """
     if self._plugin_id != -1:
         pb.unloadPlugin(self._plugin_id, physicsClientId=self._client_id)
         self._plugin_id = -1
Esempio n. 7
0
 def close(self):
     if self._egl_plugin is not None:
         p.unloadPlugin(self._egl_plugin)
     p.disconnect()
Esempio n. 8
0
    def destroy(self):
        """ Destroys the environment properly """

        if self.use_egl_plugin:
            p.unloadPlugin(self._plugin)