Skip to content

Commit

Permalink
Fix Python print methods
Browse files Browse the repository at this point in the history
  • Loading branch information
adnanmunawar committed Nov 12, 2024
1 parent 948a4d6 commit ddfecc7
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 28 deletions.
2 changes: 1 addition & 1 deletion ambf_models/descriptions/input_devices/input_devices.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ MTMR:


Geomagic Touch:
hardware name: PHANTOM Omni
hardware name: Touch
haptic gain: {linear: 10.0, angular: 0.0}
# controller gain: {
# linear: {P: 0.0, D: 0.0},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,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
Expand Down Expand Up @@ -50,11 +50,11 @@ def compute_data_metrics(self):
self._mean = np.mean(self.data)
self._std_dev = np.std(self.data)

print '----------------------------------'
print 'Data Metrics for {}'.format(self.name)
print 'Mean = {}'.format(self._mean)
print 'Std Deviation = {}'.format(self._std_dev)
print '----------------------------------'
print('----------------------------------')
print('Data Metrics for {}'.format(self.name))
print('Mean = {}'.format(self._mean))
print('Std Deviation = {}'.format(self._std_dev))
print('----------------------------------')

def get_mean(self):
return self._mean
Expand Down
6 changes: 3 additions & 3 deletions ambf_ros_modules/ambf_client/python/tests/spacenav_control.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ def main():

parsed_args = parser.parse_args()
print('Specified Arguments')
print parsed_args
print(parsed_args)

_spacenav_one_name = parsed_args.spacenav_name
_obj_one_name = parsed_args.obj_name
Expand All @@ -130,8 +130,8 @@ def main():
client.connect()

if _print_obj_names:
print ('Printing Found AMBF Object Names: ')
print client.get_obj_names()
print('Printing Found AMBF Object Names: ')
print(client.get_obj_names())
exit()

_pair_one_specified = True
Expand Down
24 changes: 12 additions & 12 deletions ambf_ros_modules/ambf_client/python/tests/study_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def compute_dist(topic_name, t_start=-1, t_end=-1):
dist = 0.0
dist = dist + 1000 * np.matmul((cur - last), (cur - last))
last = cur
# print dist
# print(dist)
return dist, trajectory


Expand Down Expand Up @@ -73,35 +73,35 @@ 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]
print(os.listdir('.')[0])

os.chdir(os.listdir('.')[3])
os.chdir('./Reduced')
files = os.listdir('.')

for cur_file in files:
print '--------------------------------'
print '--------------------------------'
print "Opening Bag file: ", cur_file
print('--------------------------------')
print('--------------------------------')
print("Opening Bag file: ", cur_file)

print(cur_file.split('_'))
control_type = cur_file.split('_')
# control_type = control_type[1] + ' ' + control_type[2]
print "Subject Name: ", control_type[1], "Control Type: ", control_type[2]
print("Subject Name: ", control_type[1], "Control Type: ", control_type[2])

cur_bag = rosbag.Bag(cur_file)

print cur_bag.get_end_time() - cur_bag.get_start_time()
print(cur_bag.get_end_time() - cur_bag.get_start_time())

ctr = 0
final_time = 0
for topic, msg, time in cur_bag.read_messages(['/ambf/env/user_study_time']):
# print 'TOPIC: ', topic
# print 'TIME: ', time
# print 'MESSAGE: ', msg
# print 'COUNTER: ', ctr
# print('TOPIC: ', topic)
# print('TIME: ', time)
# print('MESSAGE: ', msg)
# print('COUNTER: ', ctr)
ctr = ctr + 1
final_time = time

Expand Down
12 changes: 6 additions & 6 deletions ambf_ros_modules/ambf_client/python/tests/test_pc.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,22 @@
# AMBF Will have a default PC listener at /ambf/env/World/point_cloud'
pc_topics = rospy.get_param(topics_names_param)

print 'Existing Topics AMBF is listening to for Point Cloud'
print pc_topics
print('Existing Topics AMBF is listening to for Point Cloud')
print(pc_topics)

time.sleep(1.0)
# We can add topics by using the Param Server
pc_topics.append('/ambf/env/World/another_point_cloud')
rospy.set_param(topics_names_param, pc_topics)
print 'Adding another topic via the ROS Param server'
print('Adding another topic via the ROS Param server')

print 'Updated topics on the param server are now:'
print('Updated topics on the param server are now:')
pc_topics = rospy.get_param('/ambf/env/World/point_cloud_topics')
print pc_topics
print(pc_topics)

time.sleep(1.0)

print "We can similarly update the size of each individual PC"
print("We can similarly update the size of each individual PC")

pc_sizes = rospy.get_param(topics_size_param)
pc_sizes.append(10) # 10 pt size for first PC
Expand Down

0 comments on commit ddfecc7

Please sign in to comment.