Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RTT measurements are now reported per-robot #3422

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/proto/robot_statistic.proto
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ syntax = "proto3";
message RobotStatistic
{
double round_trip_time_seconds = 1;
uint32 robot_id = 2;
}
8 changes: 5 additions & 3 deletions src/software/thunderscope/robot_communication.py
Original file line number Diff line number Diff line change
Expand Up @@ -337,11 +337,13 @@ def __receive_robot_status(self, robot_status: Message) -> None:
round_trip_time_seconds = time.time() - (
robot_status.adjusted_time_sent.epoch_timestamp_seconds
)
self.__forward_to_proto_unix_io(
RobotStatistic,
RobotStatistic(round_trip_time_seconds=round_trip_time_seconds),
robot_statistic = RobotStatistic(
robot_id=robot_status.robot_id,
round_trip_time_seconds=round_trip_time_seconds,
)

self.__forward_to_proto_unix_io(RobotStatus, robot_status)
self.__forward_to_proto_unix_io(RobotStatistic, robot_statistic)

def __exit__(self, type, value, traceback) -> None:
"""Exit RobotCommunication context manager
Expand Down
28 changes: 23 additions & 5 deletions src/software/thunderscope/robot_diagnostics/robot_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,13 @@ def update(
:param robot_status: the new message data to update the widget with
:param round_trip_time: robot statistic proto to update with new metrics
"""
self.robot_info.update(robot_status, round_trip_time)
if self.robot_status:
self.robot_status.update(robot_status)
if robot_status is not None:
self.robot_info.update(robot_status, round_trip_time)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: maybe we should rename round_trip_time to robot_statistic since it contains that new ID field now

if self.robot_status:
self.robot_status.update(robot_status)

if round_trip_time is not None:
self.robot_info.update_rtt(round_trip_time)


class RobotView(QScrollArea):
Expand Down Expand Up @@ -125,7 +129,21 @@ def refresh(self) -> None:
block=False, return_cached=False
)

if robot_status is not None and round_trip_time is not None:
if (
robot_status is not None
and round_trip_time is not None
and robot_status.robot_id == round_trip_time.robot_id
): # if both pieces of data are available
self.robot_view_widgets[robot_status.robot_id].update(
robot_status, round_trip_time
robot_status=robot_status, round_trip_time=round_trip_time
)
else:
if robot_status is not None:
self.robot_view_widgets[robot_status.robot_id].update(
robot_status,
round_trip_time=None,
)
if round_trip_time is not None:
self.robot_view_widgets[round_trip_time.robot_id].update(
robot_status=None, round_trip_time=round_trip_time
)