[JdeRobot] ICE connection problem

a.pavo a.pavo93 at gmail.com
Sun May 14 19:21:15 CEST 2017


Hi

I'm developing a python server with ICE that is compatible with jdeRobots
Clients.

In my server I have implemented a Camera.ice interface and ImageProvider
from Image.ice. I try run a client and when I call getImageData,
getImageDescription the connection server-client works. But when I try call
getImageData the program stops and nothing happens any side without errors.

GetImageData is a amd(Asynchronous Method Dispatch) procedure and I try
implement a pool of threads in my server but the result is the same.

*This is a part of my server code:*

class WorkQueue(threading.Thread):
    def __init__(self):
        threading.Thread.__init__(self)
        self._callbacks = []
        self._done = False
        self._cond = threading.Condition()

    def run(self):
        with self._cond:
            while not self._done:
                if len(self._callbacks) == 0:
                    print('No hay tareas')
                    self._cond.wait()

                if not len(self._callbacks) == 0:

                    if not self._done:
                        if os.path.isfile('./image.jpg'):
                            self.imageDescription = jderobot.ImageData()
                            self.image= Image.open('./image.jpg')
                            self.imageDescription.description =
getImageDescription()
                            self.imageDescription.pixeldata = image.bits
                            return self.imageDesdescription
                        self._callbacks[0].future.set_result(None)
                        del self._callbacks[0]

            for i in range(0, len(self._callbacks)):
               
self._callbacks[i].future.set_exception(Demo.RequestCanceledException())

    def add(self, delay):
        future = Ice.Future()
        with self._cond:
            if not self._done:
                entry = CallbackEntry(future, delay)
                if len(self._callbacks) == 0:
                    self._cond.notify()
                self._callbacks.append(entry)
            else:
               future.set_exception(Demo.RequestCanceledException())
        return future

    def destroy(self):
        with self._cond:
            self._done = True
            self._cond.notify()



class ImageProviderI(jderobot.Camera):

  def getCameraDescription(self):
    return 0

  def setCameraDescription(description):
    return 0

  def startCameraStreaming(self):
    return ''
	
  def stopCameraStreaming(self,current=None):
    print('----')

  def reset(self):
    print('---')

  def getImageDescription(self,current=None):

    self.imageData = jderobot.ImageDescription()
    print('getImageDescription')    
    if os.path.isfile('./image.jpg'):
      self.image= Image.open('./image.jpg')
      self.imageData.width = self.image.width
      self.imageData.height = self.image.heigth
      self.format = 'RGB'
      return self.imageData

  def getImageData(self,format,current=None):

    return self._workQueue.add(format)


*Image provider process is:*

 ["amd"] idempotent ImageData getImageData(string format)
      throws DataNotExistException, HardwareFailedException;
};

*And the part where the code stop is a part of parallelIce.py :
*
def update(self):
        if self.hasproxy():
            image = self.proxy.getImageData(self.imgFormat) --->> here the
program stop
            height = image.description.height
            width = image.description.width

            self.lock.acquire()
            self.image = image
self.height = height

What can be happening?

Thanks.



--
View this message in context: http://jderobot-developer-list.2315034.n4.nabble.com/ICE-connection-problem-tp4643338.html
Sent from the Jderobot Developer List mailing list archive at Nabble.com.


More information about the Jde-developers mailing list