1
- #!/usr/bin/env python
2
-
1
+ #! /usr/bin/env python
3
2
# Copyright (c) 2013-2018, Rethink Robotics Inc.
4
3
#
5
4
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -40,12 +39,12 @@ def clean_line(line, names):
40
39
#convert the line of strings to a float or None
41
40
line = [try_float (x ) for x in line .rstrip ().split (',' )]
42
41
#zip the values with the joint names
43
- combined = zip (names [1 :], line [1 :])
42
+ combined = list ( zip (names [1 :], line [1 :]) )
44
43
#take out any tuples that have a none value
45
44
cleaned = [x for x in combined if x [1 ] is not None ]
46
45
#convert it to a dictionary with only valid commands
47
46
command = dict (cleaned )
48
- right_command = dict ((key , command [key ]) for key in command .keys ()
47
+ right_command = dict ((key , command [key ]) for key in list ( command .keys () )
49
48
if key [:- 2 ] == 'right_' )
50
49
return (command , right_command , line )
51
50
@@ -64,10 +63,10 @@ def map_file(filename, limb, loops=1):
64
63
first column is the time stamp
65
64
"""
66
65
limb_interface = intera_interface .Limb (limb )
67
- has_gripper = True
66
+ has_gripper = False
68
67
try :
69
68
gripper = intera_interface .Gripper (limb + '_gripper' )
70
- except ValueError :
69
+ except :
71
70
has_gripper = False
72
71
rospy .loginfo ("Could not detect a gripper attached to the robot" )
73
72
@@ -78,7 +77,7 @@ def map_file(filename, limb, loops=1):
78
77
if not gripper .is_calibrated ():
79
78
gripper .calibrate ()
80
79
81
- print ("Playing back: %s" % (filename ,))
80
+ print (( "Playing back: %s" % (filename ,) ))
82
81
with open (filename , 'r' ) as f :
83
82
lines = f .readlines ()
84
83
keys = lines [0 ].rstrip ().split (',' )
@@ -109,7 +108,7 @@ def map_file(filename, limb, loops=1):
109
108
if has_gripper and gripper .name in cmd :
110
109
gripper .set_position (cmd [gripper .name ])
111
110
rate .sleep ()
112
- print
111
+ print ()
113
112
return True
114
113
115
114
def main ():
0 commit comments