Skip to content

Commit 588018b

Browse files
committed
Normalize all the line endings
1 parent 0370b4a commit 588018b

20 files changed

+2088
-2088
lines changed

bench.py

+47-47
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,47 @@
1-
#!/usr/bin/env python
2-
3-
"""
4-
Usage: python bench.py
5-
6-
Performs simply benchmarks on how long it takes to list devices, open a device
7-
and performing a status query
8-
"""
9-
from __future__ import absolute_import
10-
from __future__ import print_function
11-
12-
import pylibftdi
13-
import pyAPT
14-
import time
15-
16-
def main(args):
17-
print('Looking for APT controllers')
18-
drv = pylibftdi.Driver()
19-
20-
st = time.time()
21-
controllers = drv.list_devices()
22-
print('\tlist_devices:',time.time()-st)
23-
24-
if controllers:
25-
for con in controllers:
26-
print('Found %s %s S/N: %s'%con)
27-
st = time.time()
28-
with pyAPT.MTS50(serial_number=con[2]) as con:
29-
print('\topen:',time.time()-st)
30-
st = time.time()
31-
status = con.status()
32-
print('\tstatus:',time.time()-st)
33-
34-
print('\tController status:')
35-
print('\t\tPosition: %.2fmm'%(status.position))
36-
print('\t\tVelocity: %.2fmm'%(status.velocity))
37-
print('\t\tStatus:',status.flag_strings())
38-
39-
return 0
40-
else:
41-
print('\tNo APT controllers found. Maybe you need to specify a PID')
42-
return 1
43-
44-
45-
if __name__ == '__main__':
46-
import sys
47-
sys.exit(main(sys.argv))
1+
#!/usr/bin/env python
2+
3+
"""
4+
Usage: python bench.py
5+
6+
Performs simply benchmarks on how long it takes to list devices, open a device
7+
and performing a status query
8+
"""
9+
from __future__ import absolute_import
10+
from __future__ import print_function
11+
12+
import pylibftdi
13+
import pyAPT
14+
import time
15+
16+
def main(args):
17+
print('Looking for APT controllers')
18+
drv = pylibftdi.Driver()
19+
20+
st = time.time()
21+
controllers = drv.list_devices()
22+
print('\tlist_devices:',time.time()-st)
23+
24+
if controllers:
25+
for con in controllers:
26+
print('Found %s %s S/N: %s'%con)
27+
st = time.time()
28+
with pyAPT.MTS50(serial_number=con[2]) as con:
29+
print('\topen:',time.time()-st)
30+
st = time.time()
31+
status = con.status()
32+
print('\tstatus:',time.time()-st)
33+
34+
print('\tController status:')
35+
print('\t\tPosition: %.2fmm'%(status.position))
36+
print('\t\tVelocity: %.2fmm'%(status.velocity))
37+
print('\t\tStatus:',status.flag_strings())
38+
39+
return 0
40+
else:
41+
print('\tNo APT controllers found. Maybe you need to specify a PID')
42+
return 1
43+
44+
45+
if __name__ == '__main__':
46+
import sys
47+
sys.exit(main(sys.argv))

get_info.py

+30-30
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,30 @@
1-
#!/usr/bin/env python
2-
"""
3-
Usage: python get_info.py [<serial>]
4-
5-
Gets the controller information of all APT controllers, or the one specified
6-
"""
7-
from __future__ import absolute_import
8-
from __future__ import print_function
9-
10-
import pyAPT
11-
12-
from runner import runner_serial
13-
14-
@runner_serial
15-
def info(serial):
16-
with pyAPT.Controller(serial_number=serial) as con:
17-
info = con.info()
18-
print('\tController info:')
19-
labels=['S/N','Model','Type','Firmware Ver', 'Notes', 'H/W Ver',
20-
'Mod State', 'Channels']
21-
22-
for idx,ainfo in enumerate(info):
23-
print('\t%12s: %s'%(labels[idx], bytes(ainfo)))
24-
25-
if __name__ == '__main__':
26-
import sys
27-
sys.exit(info())
28-
29-
30-
1+
#!/usr/bin/env python
2+
"""
3+
Usage: python get_info.py [<serial>]
4+
5+
Gets the controller information of all APT controllers, or the one specified
6+
"""
7+
from __future__ import absolute_import
8+
from __future__ import print_function
9+
10+
import pyAPT
11+
12+
from runner import runner_serial
13+
14+
@runner_serial
15+
def info(serial):
16+
with pyAPT.Controller(serial_number=serial) as con:
17+
info = con.info()
18+
print('\tController info:')
19+
labels=['S/N','Model','Type','Firmware Ver', 'Notes', 'H/W Ver',
20+
'Mod State', 'Channels']
21+
22+
for idx,ainfo in enumerate(info):
23+
print('\t%12s: %s'%(labels[idx], bytes(ainfo)))
24+
25+
if __name__ == '__main__':
26+
import sys
27+
sys.exit(info())
28+
29+
30+

get_position.py

+42-42
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,42 @@
1-
#!/usr/bin/env python
2-
"""
3-
Usage: python get_position.py [<serial>]
4-
5-
This program reads the position of all APT controllers found, or the one
6-
specified
7-
"""
8-
from __future__ import absolute_import
9-
from __future__ import print_function
10-
11-
import time
12-
import pylibftdi
13-
import pyAPT
14-
15-
def main(args):
16-
print('Looking for APT controllers')
17-
drv = pylibftdi.Driver()
18-
controllers = drv.list_devices()
19-
20-
if len(args)>1:
21-
serial = args[1]
22-
else:
23-
serial = None
24-
25-
if serial:
26-
controllers = [x for x in controllers if x[2] == serial]
27-
28-
if controllers:
29-
for con in controllers:
30-
print('Found %s %s S/N: %s'%con)
31-
with pyAPT.MTS50(serial_number=con[2]) as con:
32-
print('\tPosition (mm) = %.2f [enc:%d]'%(con.position(), con.position(raw=True)))
33-
34-
return 0
35-
else:
36-
print('\tNo APT controllers found. Maybe you need to specify a PID')
37-
return 1
38-
39-
if __name__ == '__main__':
40-
import sys
41-
sys.exit(main(sys.argv))
42-
1+
#!/usr/bin/env python
2+
"""
3+
Usage: python get_position.py [<serial>]
4+
5+
This program reads the position of all APT controllers found, or the one
6+
specified
7+
"""
8+
from __future__ import absolute_import
9+
from __future__ import print_function
10+
11+
import time
12+
import pylibftdi
13+
import pyAPT
14+
15+
def main(args):
16+
print('Looking for APT controllers')
17+
drv = pylibftdi.Driver()
18+
controllers = drv.list_devices()
19+
20+
if len(args)>1:
21+
serial = args[1]
22+
else:
23+
serial = None
24+
25+
if serial:
26+
controllers = [x for x in controllers if x[2] == serial]
27+
28+
if controllers:
29+
for con in controllers:
30+
print('Found %s %s S/N: %s'%con)
31+
with pyAPT.MTS50(serial_number=con[2]) as con:
32+
print('\tPosition (mm) = %.2f [enc:%d]'%(con.position(), con.position(raw=True)))
33+
34+
return 0
35+
else:
36+
print('\tNo APT controllers found. Maybe you need to specify a PID')
37+
return 1
38+
39+
if __name__ == '__main__':
40+
import sys
41+
sys.exit(main(sys.argv))
42+

get_status.py

+26-26
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,26 @@
1-
#!/usr/bin/env python
2-
"""
3-
Usage: python get_status.py [<serial>]
4-
5-
Gets the status of all APT controllers, or of the one specified
6-
"""
7-
from __future__ import absolute_import
8-
from __future__ import print_function
9-
import pyAPT
10-
11-
from runner import runner_serial
12-
13-
@runner_serial
14-
def status(serial):
15-
with pyAPT.MTS50(serial_number=serial) as con:
16-
status = con.status()
17-
print('\tController status:')
18-
print('\t\tPosition: %.3fmm (%d cnt)'%(status.position, status.position_apt))
19-
print('\t\tVelocity: %.3fmm'%(status.velocity))
20-
print('\t\tStatus:',status.flag_strings())
21-
22-
23-
if __name__ == '__main__':
24-
import sys
25-
sys.exit(status())
26-
1+
#!/usr/bin/env python
2+
"""
3+
Usage: python get_status.py [<serial>]
4+
5+
Gets the status of all APT controllers, or of the one specified
6+
"""
7+
from __future__ import absolute_import
8+
from __future__ import print_function
9+
import pyAPT
10+
11+
from runner import runner_serial
12+
13+
@runner_serial
14+
def status(serial):
15+
with pyAPT.MTS50(serial_number=serial) as con:
16+
status = con.status()
17+
print('\tController status:')
18+
print('\t\tPosition: %.3fmm (%d cnt)'%(status.position, status.position_apt))
19+
print('\t\tVelocity: %.3fmm'%(status.velocity))
20+
print('\t\tStatus:',status.flag_strings())
21+
22+
23+
if __name__ == '__main__':
24+
import sys
25+
sys.exit(status())
26+

get_velocity_params.py

+26-26
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,26 @@
1-
#!/usr/bin/env python
2-
"""
3-
Usage: python get_status.py [<serial>]
4-
5-
Gets the status of all APT controllers, or of the one specified
6-
"""
7-
from __future__ import absolute_import
8-
from __future__ import print_function
9-
import pyAPT
10-
11-
from runner import runner_serial
12-
13-
@runner_serial
14-
def get_vel_params(serial):
15-
with pyAPT.MTS50(serial_number=serial) as con:
16-
min_vel, acc, max_vel = con.velocity_parameters()
17-
raw_min_vel, raw_acc, raw_max_vel = con.velocity_parameters(raw=True)
18-
print('\tController velocity parameters:')
19-
print('\t\tMin. Velocity: %.2fmm/s (%d)'%(min_vel, raw_min_vel))
20-
print('\t\tAcceleration: %.2fmm/s/s (%d)'%(acc, raw_acc))
21-
print('\t\tMax. Velocity: %.2fmm/s (%d)'%(max_vel, raw_max_vel))
22-
23-
if __name__ == '__main__':
24-
import sys
25-
sys.exit(get_vel_params())
26-
1+
#!/usr/bin/env python
2+
"""
3+
Usage: python get_status.py [<serial>]
4+
5+
Gets the status of all APT controllers, or of the one specified
6+
"""
7+
from __future__ import absolute_import
8+
from __future__ import print_function
9+
import pyAPT
10+
11+
from runner import runner_serial
12+
13+
@runner_serial
14+
def get_vel_params(serial):
15+
with pyAPT.MTS50(serial_number=serial) as con:
16+
min_vel, acc, max_vel = con.velocity_parameters()
17+
raw_min_vel, raw_acc, raw_max_vel = con.velocity_parameters(raw=True)
18+
print('\tController velocity parameters:')
19+
print('\t\tMin. Velocity: %.2fmm/s (%d)'%(min_vel, raw_min_vel))
20+
print('\t\tAcceleration: %.2fmm/s/s (%d)'%(acc, raw_acc))
21+
print('\t\tMax. Velocity: %.2fmm/s (%d)'%(max_vel, raw_max_vel))
22+
23+
if __name__ == '__main__':
24+
import sys
25+
sys.exit(get_vel_params())
26+

0 commit comments

Comments
 (0)