@@ -17,7 +17,6 @@ def __init__(self, host="ws://127.0.0.1:2303", freq=30.0):
1717 # Execution control vars
1818 self .out_period = 1.0 / freq
1919 self .right_image = None
20- self .left_image = None
2120 self .image_lock = threading .Lock ()
2221 self .ack = True
2322 self .ack_frontend = True
@@ -27,7 +26,7 @@ def __init__(self, host="ws://127.0.0.1:2303", freq=30.0):
2726 self .world_name = "empty"
2827
2928 self .host = host
30- self .msg = {"image_right" : "" , "image_left" : "" }
29+ self .msg = {"image_right" : "" }
3130
3231 self .ideal_cycle = 80
3332 self .real_time_factor = 0
@@ -48,7 +47,7 @@ def gui_out_thread(self):
4847 with self .ack_lock :
4948 with self .image_lock :
5049 if self .ack :
51- if np .any (self .left_image ) or np . any ( self . right_image ):
50+ if np .any (self .right_image ):
5251 self .update_gui ()
5352 self .ack = False
5453
@@ -60,14 +59,6 @@ def gui_out_thread(self):
6059 # Prepares and send image to the websocket server
6160 def update_gui (self ):
6261
63- if np .any (self .left_image ):
64- _ , encoded_left_image = cv2 .imencode (".JPEG" , self .left_image )
65- b64_left = base64 .b64encode (encoded_left_image ).decode ("utf-8" )
66- shape_left = self .left_image .shape
67- else :
68- b64_left = None
69- shape_left = 0
70-
7162 if np .any (self .right_image ):
7263 _ , encoded_right_image = cv2 .imencode (".JPEG" , self .right_image )
7364 b64_right = base64 .b64encode (encoded_right_image ).decode ("utf-8" )
@@ -76,24 +67,16 @@ def update_gui(self):
7667 b64_right = None
7768 shape_right = 0
7869
79- payload_left = {
80- "image_left" : b64_left ,
81- "shape_left" : shape_left ,
82- }
8370 payload_right = {
8471 "image_right" : b64_right ,
8572 "shape_right" : shape_right ,
8673 }
87- self . msg [ "image_left" ] = json . dumps ( payload_left )
74+
8875 self .msg ["image_right" ] = json .dumps (payload_right )
8976 message = json .dumps (self .msg )
9077 self .send_to_client (message )
9178
9279 # Functions to set the next image to be sent
93- def setLeftImage (self , image ):
94- with self .image_lock :
95- self .left_image = image
96-
9780 def setRightImage (self , image ):
9881 with self .image_lock :
9982 self .right_image = image
@@ -108,8 +91,4 @@ def setRightImage(self, image):
10891
10992# Expose the user functions
11093def showImage (image ):
111- gui .setRightImage (image )
112-
113-
114- def showLeftImage (image ):
115- gui .setLeftImage (image )
94+ gui .setRightImage (image )
0 commit comments