@@ -62,17 +62,21 @@ def robot_status_expand(self) -> None:
6262 self .robot_status .toggle_visibility ()
6363
6464 def update (
65- self , robot_status : RobotStatus , round_trip_time : RobotStatistic
65+ self , robot_status : RobotStatus , robot_statistic : RobotStatistic
6666 ) -> None :
6767 """Updates the Robot View Components with the new robot status message
6868 Updates the robot info widget and, if initialized, the robot status widget as well
6969
7070 :param robot_status: the new message data to update the widget with
71- :param round_trip_time : robot statistic proto to update with new metrics
71+ :param robot_statistic : robot statistic proto to update with new metrics
7272 """
73- self .robot_info .update (robot_status , round_trip_time )
74- if self .robot_status :
75- self .robot_status .update (robot_status )
73+ if robot_status is not None :
74+ self .robot_info .update (robot_status , robot_statistic )
75+ if self .robot_status :
76+ self .robot_status .update (robot_status )
77+
78+ if robot_statistic is not None :
79+ self .robot_info .update_rtt (robot_statistic )
7680
7781
7882class RobotView (QScrollArea ):
@@ -93,7 +97,7 @@ def __init__(self, available_control_modes: list[IndividualRobotMode]) -> None:
9397 super ().__init__ ()
9498
9599 self .robot_status_buffer = ThreadSafeBuffer (10 , RobotStatus )
96- self .round_trip_time_buffer = ThreadSafeBuffer (10 , RobotStatistic )
100+ self .robot_statistic_buffer = ThreadSafeBuffer (10 , RobotStatistic )
97101
98102 self .layout = QVBoxLayout ()
99103
@@ -121,11 +125,25 @@ def refresh(self) -> None:
121125 until the buffer is empty
122126 """
123127 robot_status = self .robot_status_buffer .get (block = False , return_cached = False )
124- round_trip_time = self .round_trip_time_buffer .get (
128+ robot_statistic = self .robot_statistic_buffer .get (
125129 block = False , return_cached = False
126130 )
127131
128- if robot_status is not None and round_trip_time is not None :
132+ if (
133+ robot_status is not None
134+ and robot_statistic is not None
135+ and robot_status .robot_id == robot_statistic .robot_id
136+ ): # if both pieces of data are available
129137 self .robot_view_widgets [robot_status .robot_id ].update (
130- robot_status , round_trip_time
138+ robot_status = robot_status , robot_statistic = robot_statistic
131139 )
140+ else :
141+ if robot_status is not None :
142+ self .robot_view_widgets [robot_status .robot_id ].update (
143+ robot_status ,
144+ robot_statistic = None ,
145+ )
146+ if robot_statistic is not None :
147+ self .robot_view_widgets [robot_statistic .robot_id ].update (
148+ robot_status = None , robot_statistic = robot_statistic
149+ )
0 commit comments