From f8ca138d2e9caab9c7f3a0b7c68b9c0dac787de6 Mon Sep 17 00:00:00 2001 From: Mohamed Fazil Date: Tue, 12 Apr 2022 14:41:36 -0700 Subject: [PATCH] Radio Nominal pose update pane changes --- .../results/testrig_results_202203091216.yaml | 5 +++- .../nodes/testrig_dashboard.py | 28 ++++++++++++++++--- 2 files changed, 28 insertions(+), 5 deletions(-) diff --git a/stretch_camera_testrig/data/results/testrig_results_202203091216.yaml b/stretch_camera_testrig/data/results/testrig_results_202203091216.yaml index 76a3e1b..1e85fd3 100644 --- a/stretch_camera_testrig/data/results/testrig_results_202203091216.yaml +++ b/stretch_camera_testrig/data/results/testrig_results_202203091216.yaml @@ -1,4 +1,7 @@ -Realsense Details: '' +Realsense Details: + firmware: 05.13.00.50 + serial: 040322072690 + usb: '3.2' capture_id: '202203091216' lighting_condition: brightness: null diff --git a/stretch_camera_testrig/nodes/testrig_dashboard.py b/stretch_camera_testrig/nodes/testrig_dashboard.py index 34d64aa..0dffd15 100755 --- a/stretch_camera_testrig/nodes/testrig_dashboard.py +++ b/stretch_camera_testrig/nodes/testrig_dashboard.py @@ -16,7 +16,6 @@ class TestRig_dashboard(): self.ros_package_dir = os.path.expanduser('~/catkin_ws/src/stretch_ros/stretch_camera_testrig') self.data_directory = self.ros_package_dir + '/data' self.nominal_poses_filename = self.ros_package_dir + '/config/testrig_marker_info.yaml' - self.nominal_poses_filename = self.ros_package_dir + '/config/testrig_marker_info.yaml' self.data_keys = ['base_left_marker_pose', 'base_right_marker_pose', @@ -116,7 +115,7 @@ class TestRig_dashboard(): try: del info_dict['performance_metrics'] except KeyError: - None + print('Performance Metrics not found.') info_txt = str(yaml.safe_dump(info_dict, allow_unicode=True, default_flow_style=False)) self.info_print = Label(self.window, text=info_txt, anchor="w", font=("Arial", 11), justify=LEFT) self.info_print.place(x=x_pos, y=y_pos) @@ -180,11 +179,32 @@ class TestRig_dashboard(): ros_log = Popen("roslaunch stretch_camera_testrig testrig_collect_data.launch", shell=True, bufsize=64, stdin=PIPE, stdout=PIPE, close_fds=True).stdout.read() except: - None + print('Unable to Collect Testrig Data.') print(ros_log) def radiobutton_sel(self): - print('selected {}'.format(self.data_keys[self.radio_var.get()])) + selected_data_key = self.data_keys[self.radio_var.get()] + print('selected {}'.format(selected_data_key)) + nominal_poses_dict = self.get_nominal_pose_dict(self.nominal_poses_filename) + for key in self.data_keys: + if key == selected_data_key: + print(nominal_poses_dict[key]) + for i in range(4): + for j in range(4): + self.matrix_text_var[i][j].set(nominal_poses_dict[key][i][j]) + # print(self.matrix_text_var) + # print(self.matrix_entries) + + def get_nominal_pose_dict(self, filename): + try: + with open(filename, 'r') as file: + data = yaml.safe_load(file) + nominal_poses_dict = {} + for key in data['testrig_aruco_marker_info'].keys(): + nominal_poses_dict[key] = np.array(data['testrig_aruco_marker_info'][key]) + return nominal_poses_dict + except IOError: + print('[Error] Unable to open Testrig Nominal Poses file: {0}'.format(filename)) def update_nominal_poses(self): self.log('Updated new Nominal Poses File.')