added cam_id as attribute in imagereaders - return the right values in the to angles function

This commit is contained in:
Jonas
2018-06-04 11:58:18 +02:00
parent 99bcb5a07a
commit 3e3927a4d9

View File

@@ -16,6 +16,7 @@ class NaoImageReader(object):
def __init__(self, ip, port=9559, res=1, fps=30, cam_id=0): def __init__(self, ip, port=9559, res=1, fps=30, cam_id=0):
ip = bytes(ip) ip = bytes(ip)
self.res = self.RESOLUTIONS[res] self.res = self.RESOLUTIONS[res]
self.cam_id=cam_id
self.vd = ALProxy('ALVideoDevice', ip, port) self.vd = ALProxy('ALVideoDevice', ip, port)
self.sub = self.vd.subscribeCamera( self.sub = self.vd.subscribeCamera(
"video_streamer", cam_id, res, 13, fps "video_streamer", cam_id, res, 13, fps
@@ -23,7 +24,7 @@ class NaoImageReader(object):
def to_angles(self, x, y): def to_angles(self, x, y):
return self.vd.getAngularPositionFromImagePosition( return self.vd.getAngularPositionFromImagePosition(
self.cam_id, x / self.res[1], y / self.res[0] self.cam_id, [x, y]
) )
def to_relative(self, x, y): def to_relative(self, x, y):