diff --git a/ambf_ros_modules/ambf_client/python/test.py b/ambf_ros_modules/ambf_client/python/test.py index e58d1f1f..91c7956e 100644 --- a/ambf_ros_modules/ambf_client/python/test.py +++ b/ambf_ros_modules/ambf_client/python/test.py @@ -4,7 +4,7 @@ c = Client() c.connect() time.sleep(1.0) -# print c.get_obj_names() +# print(c.get_obj_names()) time.sleep(1.0) b = c.get_obj_handle('baselink') -print b.get_name() \ No newline at end of file +print(b.get_name()) \ No newline at end of file diff --git a/ambf_ros_modules/ambf_client/python/tests/duplex_com_test.py b/ambf_ros_modules/ambf_client/python/tests/duplex_com_test.py index 14d00b16..ecaef4d0 100755 --- a/ambf_ros_modules/ambf_client/python/tests/duplex_com_test.py +++ b/ambf_ros_modules/ambf_client/python/tests/duplex_com_test.py @@ -15,7 +15,7 @@ def cb(data): step = data.sim_step cb_ctr +=1 if cb_ctr % 1000 == 0: - print step + print(step) def main(): @@ -35,7 +35,7 @@ def main(): cmd.step_clock = not cmd.step_clock pre_step = step if dstep > cmd.n_skip_steps: - print 'Jumped {} steps, default is {}'.format(dstep, cmd.n_skip_steps) + print('Jumped {} steps, default is {}'.format(dstep, cmd.n_skip_steps)) pub.publish(cmd) rate.sleep() diff --git a/ambf_ros_modules/ambf_client/python/tests/dynamo_haptic_response_test.py b/ambf_ros_modules/ambf_client/python/tests/dynamo_haptic_response_test.py index c9614b1b..a497b8bb 100644 --- a/ambf_ros_modules/ambf_client/python/tests/dynamo_haptic_response_test.py +++ b/ambf_ros_modules/ambf_client/python/tests/dynamo_haptic_response_test.py @@ -105,7 +105,7 @@ def w_cb(msg): g1D.reset() g2D.reset() collection_enabled = False - print 'Setting Rate to {} Hz and testing'.format(r) + print('Setting Rate to {} Hz and testing'.format(r)) time_offset = rospy.Time.now().to_sec() + 4.0 while not g1D.is_done() or not g2D.is_done(): wCmd.step_clock = not wCmd.step_clock @@ -113,7 +113,7 @@ def w_cb(msg): rate.sleep() if not collection_enabled and rospy.Time.now().to_sec() > time_offset: collection_enabled = True - print 'Enabling Data Collection' + print('Enabling Data Collection') g1D.enable_collectoin() g2D.enable_collectoin() g1D.compute_data_metrics() diff --git a/ambf_ros_modules/ambf_client/python/tests/haptic_response_test.py b/ambf_ros_modules/ambf_client/python/tests/haptic_response_test.py index 5357604f..8bbce8f8 100644 --- a/ambf_ros_modules/ambf_client/python/tests/haptic_response_test.py +++ b/ambf_ros_modules/ambf_client/python/tests/haptic_response_test.py @@ -59,7 +59,7 @@ def __init__(self, name): self.data_lim = 1000 if len(sys.argv) > 1: self.data_lim = int(sys.argv[1]) - print 'Taking {} data points'.format(sys.argv[1]) + print('Taking {} data points'.format(sys.argv[1])) self.data = np.zeros(self.data_lim) self.ctr = 0 self.name = name @@ -73,11 +73,11 @@ def compute_data_metrics(self): mean = np.mean(self.data) std_dev = np.std(self.data) - print '----------------------------------' - print 'Data Metrics for {}'.format(self.name) - print 'Mean = {}'.format(mean) - print 'Std Deviation = {}'.format(std_dev) - print '----------------------------------' + print('----------------------------------') + print('Data Metrics for {}'.format(self.name)) + print('Mean = {}'.format(mean)) + print('Std Deviation = {}'.format(std_dev)) + print('----------------------------------') def is_done(self): if self.ctr < self.data_lim: diff --git a/ambf_ros_modules/ambf_client/python/tests/message_latency.py b/ambf_ros_modules/ambf_client/python/tests/message_latency.py index 619a68b0..be4c7d9a 100755 --- a/ambf_ros_modules/ambf_client/python/tests/message_latency.py +++ b/ambf_ros_modules/ambf_client/python/tests/message_latency.py @@ -85,7 +85,7 @@ def capture_window_times(self, time): if not self.window_times_captured: self.time_window_lims[0] = time + 1.0 self.time_window_lims[1] += self.time_window_lims[0] - print 'Capturing Time from {} to {}'.format(self.time_window_lims[0], self.time_window_lims[1]) + print('Capturing Time from {} to {}'.format(self.time_window_lims[0], self.time_window_lims[1])) self.window_times_captured = True def obj_state_cb(self, data): @@ -97,9 +97,9 @@ def obj_state_cb(self, data): if self.is_first_run: self.capture_window_times(data.wall_time) self.initial_time_offset = ambf_sim_wall_time - data.wall_time - print 'ROS & AMBF Clock Offset in C++ Server: ', self.initial_time_offset - print 'AMBF Wall Time after offset : ', ambf_sim_wall_time - self.initial_time_offset - print 'Cur Process Wall Time after offset : ', process_wall_time - self.initial_time_offset + print('ROS & AMBF Clock Offset in C++ Server: ', self.initial_time_offset) + print('AMBF Wall Time after offset : ', ambf_sim_wall_time - self.initial_time_offset) + print('Cur Process Wall Time after offset : ', process_wall_time - self.initial_time_offset) self.is_first_run = False self.ambf_process_wall_time.append(ambf_sim_wall_time - self.initial_time_offset) @@ -117,15 +117,15 @@ def obj_state_cb(self, data): def compute_mean_latency(self): self.mean_latency = sum(self.latency_list) / len(self.latency_list) - print 'Mean Latency= ', self.mean_latency, ' | Itrs= ', len(self.latency_list), ' | Counter=', self.cb_counter + print('Mean Latency= ', self.mean_latency, ' | Itrs= ', len(self.latency_list), ' | Counter=', self.cb_counter) total_packets = (self.msg_counter_num[-1] + 1) - self.msg_counter_num[0] total_packets_rcvd = len(self.msg_counter_num) percent_packets_rcvd = (total_packets_rcvd * 1.0) / (total_packets * 1.0) - print 'Total packets sent by C++ Server: ', total_packets - print 'Total packets received by Client: ', total_packets_rcvd - print 'Percentage of packets received : {}%'.format(100 * percent_packets_rcvd) + print('Total packets sent by C++ Server: ', total_packets) + print('Total packets received by Client: ', total_packets_rcvd) + print('Percentage of packets received : {}%'.format(100 * percent_packets_rcvd)) def calculate_packets_dt(self, list): new_list = [] @@ -137,7 +137,7 @@ def run(self): rospy.init_node('message_latency_inspector') sub = rospy.Subscriber('/ambf/env/World/State', WorldState, self.obj_state_cb, queue_size=self.queue_size) - print 'X Axis = ', self.x_axis_dict[self.x_axis_type][0] + print('X Axis = ', self.x_axis_dict[self.x_axis_type][0]) x_axis_indx = self.x_axis_dict[self.x_axis_type][1] while not rospy.is_shutdown() and not self.done: diff --git a/ambf_ros_modules/ambf_client/python/tests/mtm_ambf_test.py b/ambf_ros_modules/ambf_client/python/tests/mtm_ambf_test.py index 4fd70d95..d01d6b3f 100644 --- a/ambf_ros_modules/ambf_client/python/tests/mtm_ambf_test.py +++ b/ambf_ros_modules/ambf_client/python/tests/mtm_ambf_test.py @@ -64,10 +64,10 @@ if len(sys.argv) > 1: tc = float(sys.argv[1]) - print 'Setting Time Constant to {}'.format(sys.argv[1]) + print('Setting Time Constant to {}'.format(sys.argv[1])) if len(sys.argv) > 2: scale = float(sys.argv[2]) - print 'Setting Scale to {}'.format(sys.argv[2]) + print('Setting Scale to {}'.format(sys.argv[2])) rospy.init_node('mtm_ambf_test') diff --git a/ambf_ros_modules/ambf_client/python/tests/occulus_view.py b/ambf_ros_modules/ambf_client/python/tests/occulus_view.py index 2ccd078c..6d846868 100644 --- a/ambf_ros_modules/ambf_client/python/tests/occulus_view.py +++ b/ambf_ros_modules/ambf_client/python/tests/occulus_view.py @@ -117,7 +117,7 @@ def main(): occulus_pub.publish(occulus_cmd) counter = counter + 1 if counter % 60 == 0: - print "- Publishing Occulus Pose ", format( round(rospy.get_time() - start, 3)), 's' + print("- Publishing Occulus Pose ", format( round(rospy.get_time() - start, 3)), 's') rate.sleep() diff --git a/ambf_ros_modules/ambf_client/python/tests/position_control.py b/ambf_ros_modules/ambf_client/python/tests/position_control.py index 94927b03..0c8603be 100644 --- a/ambf_ros_modules/ambf_client/python/tests/position_control.py +++ b/ambf_ros_modules/ambf_client/python/tests/position_control.py @@ -126,8 +126,8 @@ def ambf_cb(msg): last_delta_pos = delta_pos delta_pos = cmd_pos - cur_pos delta_delta_pos = (delta_pos - last_delta_pos) / dt - # print delta_pos, last_delta_pos - # print (D_lin * delta_delta_pos) / dtp + # print(delta_pos, last_delta_pos) + # print(D_lin * delta_delta_pos) / dtp) force = PU.K_lin * delta_pos + PU.D_lin * delta_delta_pos m_drot_prev = m_drot diff --git a/ambf_ros_modules/ambf_client/python/tests/rt_test.py b/ambf_ros_modules/ambf_client/python/tests/rt_test.py index d85243e0..5e280457 100644 --- a/ambf_ros_modules/ambf_client/python/tests/rt_test.py +++ b/ambf_ros_modules/ambf_client/python/tests/rt_test.py @@ -42,7 +42,7 @@ def main(): start_time = rospy.get_time() cur_time = start_time end_time = cur_time + episode - print cur_time + print(cur_time) while not rospy.is_shutdown() and cur_time <= end_time: cur_time = rospy.get_time() diff --git a/ambf_ros_modules/ambf_client/python/tests/study_analysis.py b/ambf_ros_modules/ambf_client/python/tests/study_analysis.py index 1fb65860..b6a2b954 100644 --- a/ambf_ros_modules/ambf_client/python/tests/study_analysis.py +++ b/ambf_ros_modules/ambf_client/python/tests/study_analysis.py @@ -73,7 +73,7 @@ def compute_number_of_clutches(topic_name, t_start=-1, t_end=-1): return num_clutches, clutch_press_times -print (os.listdir('.')) +print(os.listdir('.')) os.chdir('./user_study_data/') print(os.listdir('.')[0]) @@ -110,9 +110,9 @@ def compute_number_of_clutches(topic_name, t_start=-1, t_end=-1): mtmr_force_traj = get_force_trajectory('/ambf/env/simulated_device_1/MTML/State', t_end=final_time) mtml_force_traj = get_force_trajectory('/ambf/env/simulated_device_2/MTMR/State', t_end=final_time) - print "MTMR Path Length: ", mtmr_path_len - print "MTML Path Length: ", mtml_path_len - print "Number of Clutches: ", compute_number_of_clutches('/dvrk/footpedals/clutch', t_end=final_time) + print("MTMR Path Length: ", mtmr_path_len) + print("MTML Path Length: ", mtml_path_len) + print("Number of Clutches: ", compute_number_of_clutches('/dvrk/footpedals/clutch', t_end=final_time)) # fig = plt.figure() # ax = plt.axes(projection='3d') diff --git a/ambf_ros_modules/ambf_client/python/tests/test.py b/ambf_ros_modules/ambf_client/python/tests/test.py index 244c1c8b..2b3bae2c 100644 --- a/ambf_ros_modules/ambf_client/python/tests/test.py +++ b/ambf_ros_modules/ambf_client/python/tests/test.py @@ -51,7 +51,7 @@ client = Client() client.connect() -print client.get_obj_names() +print(client.get_obj_names()) obj = client.get_obj_handle(obj_name) if obj: @@ -63,5 +63,5 @@ time.sleep(0.01) else: - print obj_name, 'not found' + print(obj_name, 'not found') diff --git a/ambf_ros_modules/ambf_client/python/tests/time_dilation_analysis_tool.py b/ambf_ros_modules/ambf_client/python/tests/time_dilation_analysis_tool.py index dcb29736..aa546ea9 100755 --- a/ambf_ros_modules/ambf_client/python/tests/time_dilation_analysis_tool.py +++ b/ambf_ros_modules/ambf_client/python/tests/time_dilation_analysis_tool.py @@ -79,7 +79,7 @@ def __init__(self): def capture_window_times(self, time): self.time_window_lims[0] = time + 1.0 self.time_window_lims[1] += self.time_window_lims[0] - print 'Capturing Time from {} to {}'.format(self.time_window_lims[0], self.time_window_lims[1]) + print('Capturing Time from {} to {}'.format(self.time_window_lims[0], self.time_window_lims[1])) def obj_state_cb(self, data): if not self.done: @@ -90,7 +90,7 @@ def obj_state_cb(self, data): if self.first_run: self.capture_window_times(ambf_wall_time) self.initial_time_offset = rospy.Time.now().to_sec() - ambf_wall_time - print 'Adjusting Time Offset' + print('Adjusting Time Offset') self.first_run = False self.ambf_sim_time.append(ambf_sim_time) self.ambf_wall_time.append(ambf_wall_time) @@ -110,7 +110,7 @@ def run(self): rospy.init_node('time_dilation_inspector') sub = rospy.Subscriber('/ambf/env/World/State', WorldState, self.obj_state_cb, queue_size=10) - print 'X Axis = ', self.x_axis_dict[0][0] + print('X Axis = ', self.x_axis_dict[0][0]) x_axis_indx = self.x_axis_dict[0][1] for i in range(1, self.x_axis_dict.__len__()): diff --git a/ambf_ros_modules/ambf_client/python/tests/user_study.py b/ambf_ros_modules/ambf_client/python/tests/user_study.py index d8f4aee1..1b06747c 100644 --- a/ambf_ros_modules/ambf_client/python/tests/user_study.py +++ b/ambf_ros_modules/ambf_client/python/tests/user_study.py @@ -75,11 +75,11 @@ def call(self): date_time_str = str(datetime.now()).replace(' ', '_') self._rosbag_filepath = './user_study_data/' + e1.get() + '_' + b1.get() + '_' + date_time_str command = "rosbag record -O" + ' ' + self._rosbag_filepath + self._topic_names_str - print "Running Command", command + print("Running Command", command) command = shlex.split(command) self._rosbag_process = subprocess.Popen(command) else: - print "Already recording a ROSBAG file, please save that first before starting a new record" + print("Already recording a ROSBAG file, please save that first before starting a new record") def save(self):