-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0370b4a
commit 588018b
Showing
20 changed files
with
2,088 additions
and
2,088 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,47 +1,47 @@ | ||
#!/usr/bin/env python | ||
|
||
""" | ||
Usage: python bench.py | ||
Performs simply benchmarks on how long it takes to list devices, open a device | ||
and performing a status query | ||
""" | ||
from __future__ import absolute_import | ||
from __future__ import print_function | ||
|
||
import pylibftdi | ||
import pyAPT | ||
import time | ||
|
||
def main(args): | ||
print('Looking for APT controllers') | ||
drv = pylibftdi.Driver() | ||
|
||
st = time.time() | ||
controllers = drv.list_devices() | ||
print('\tlist_devices:',time.time()-st) | ||
|
||
if controllers: | ||
for con in controllers: | ||
print('Found %s %s S/N: %s'%con) | ||
st = time.time() | ||
with pyAPT.MTS50(serial_number=con[2]) as con: | ||
print('\topen:',time.time()-st) | ||
st = time.time() | ||
status = con.status() | ||
print('\tstatus:',time.time()-st) | ||
|
||
print('\tController status:') | ||
print('\t\tPosition: %.2fmm'%(status.position)) | ||
print('\t\tVelocity: %.2fmm'%(status.velocity)) | ||
print('\t\tStatus:',status.flag_strings()) | ||
|
||
return 0 | ||
else: | ||
print('\tNo APT controllers found. Maybe you need to specify a PID') | ||
return 1 | ||
|
||
|
||
if __name__ == '__main__': | ||
import sys | ||
sys.exit(main(sys.argv)) | ||
#!/usr/bin/env python | ||
|
||
""" | ||
Usage: python bench.py | ||
Performs simply benchmarks on how long it takes to list devices, open a device | ||
and performing a status query | ||
""" | ||
from __future__ import absolute_import | ||
from __future__ import print_function | ||
|
||
import pylibftdi | ||
import pyAPT | ||
import time | ||
|
||
def main(args): | ||
print('Looking for APT controllers') | ||
drv = pylibftdi.Driver() | ||
|
||
st = time.time() | ||
controllers = drv.list_devices() | ||
print('\tlist_devices:',time.time()-st) | ||
|
||
if controllers: | ||
for con in controllers: | ||
print('Found %s %s S/N: %s'%con) | ||
st = time.time() | ||
with pyAPT.MTS50(serial_number=con[2]) as con: | ||
print('\topen:',time.time()-st) | ||
st = time.time() | ||
status = con.status() | ||
print('\tstatus:',time.time()-st) | ||
|
||
print('\tController status:') | ||
print('\t\tPosition: %.2fmm'%(status.position)) | ||
print('\t\tVelocity: %.2fmm'%(status.velocity)) | ||
print('\t\tStatus:',status.flag_strings()) | ||
|
||
return 0 | ||
else: | ||
print('\tNo APT controllers found. Maybe you need to specify a PID') | ||
return 1 | ||
|
||
|
||
if __name__ == '__main__': | ||
import sys | ||
sys.exit(main(sys.argv)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,30 @@ | ||
#!/usr/bin/env python | ||
""" | ||
Usage: python get_info.py [<serial>] | ||
Gets the controller information of all APT controllers, or the one specified | ||
""" | ||
from __future__ import absolute_import | ||
from __future__ import print_function | ||
|
||
import pyAPT | ||
|
||
from runner import runner_serial | ||
|
||
@runner_serial | ||
def info(serial): | ||
with pyAPT.Controller(serial_number=serial) as con: | ||
info = con.info() | ||
print('\tController info:') | ||
labels=['S/N','Model','Type','Firmware Ver', 'Notes', 'H/W Ver', | ||
'Mod State', 'Channels'] | ||
|
||
for idx,ainfo in enumerate(info): | ||
print('\t%12s: %s'%(labels[idx], bytes(ainfo))) | ||
|
||
if __name__ == '__main__': | ||
import sys | ||
sys.exit(info()) | ||
|
||
|
||
#!/usr/bin/env python | ||
""" | ||
Usage: python get_info.py [<serial>] | ||
Gets the controller information of all APT controllers, or the one specified | ||
""" | ||
from __future__ import absolute_import | ||
from __future__ import print_function | ||
|
||
import pyAPT | ||
|
||
from runner import runner_serial | ||
|
||
@runner_serial | ||
def info(serial): | ||
with pyAPT.Controller(serial_number=serial) as con: | ||
info = con.info() | ||
print('\tController info:') | ||
labels=['S/N','Model','Type','Firmware Ver', 'Notes', 'H/W Ver', | ||
'Mod State', 'Channels'] | ||
|
||
for idx,ainfo in enumerate(info): | ||
print('\t%12s: %s'%(labels[idx], bytes(ainfo))) | ||
|
||
if __name__ == '__main__': | ||
import sys | ||
sys.exit(info()) | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,42 +1,42 @@ | ||
#!/usr/bin/env python | ||
""" | ||
Usage: python get_position.py [<serial>] | ||
This program reads the position of all APT controllers found, or the one | ||
specified | ||
""" | ||
from __future__ import absolute_import | ||
from __future__ import print_function | ||
|
||
import time | ||
import pylibftdi | ||
import pyAPT | ||
|
||
def main(args): | ||
print('Looking for APT controllers') | ||
drv = pylibftdi.Driver() | ||
controllers = drv.list_devices() | ||
|
||
if len(args)>1: | ||
serial = args[1] | ||
else: | ||
serial = None | ||
|
||
if serial: | ||
controllers = [x for x in controllers if x[2] == serial] | ||
|
||
if controllers: | ||
for con in controllers: | ||
print('Found %s %s S/N: %s'%con) | ||
with pyAPT.MTS50(serial_number=con[2]) as con: | ||
print('\tPosition (mm) = %.2f [enc:%d]'%(con.position(), con.position(raw=True))) | ||
|
||
return 0 | ||
else: | ||
print('\tNo APT controllers found. Maybe you need to specify a PID') | ||
return 1 | ||
|
||
if __name__ == '__main__': | ||
import sys | ||
sys.exit(main(sys.argv)) | ||
#!/usr/bin/env python | ||
""" | ||
Usage: python get_position.py [<serial>] | ||
This program reads the position of all APT controllers found, or the one | ||
specified | ||
""" | ||
from __future__ import absolute_import | ||
from __future__ import print_function | ||
|
||
import time | ||
import pylibftdi | ||
import pyAPT | ||
|
||
def main(args): | ||
print('Looking for APT controllers') | ||
drv = pylibftdi.Driver() | ||
controllers = drv.list_devices() | ||
|
||
if len(args)>1: | ||
serial = args[1] | ||
else: | ||
serial = None | ||
|
||
if serial: | ||
controllers = [x for x in controllers if x[2] == serial] | ||
|
||
if controllers: | ||
for con in controllers: | ||
print('Found %s %s S/N: %s'%con) | ||
with pyAPT.MTS50(serial_number=con[2]) as con: | ||
print('\tPosition (mm) = %.2f [enc:%d]'%(con.position(), con.position(raw=True))) | ||
|
||
return 0 | ||
else: | ||
print('\tNo APT controllers found. Maybe you need to specify a PID') | ||
return 1 | ||
|
||
if __name__ == '__main__': | ||
import sys | ||
sys.exit(main(sys.argv)) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,26 @@ | ||
#!/usr/bin/env python | ||
""" | ||
Usage: python get_status.py [<serial>] | ||
Gets the status of all APT controllers, or of the one specified | ||
""" | ||
from __future__ import absolute_import | ||
from __future__ import print_function | ||
import pyAPT | ||
|
||
from runner import runner_serial | ||
|
||
@runner_serial | ||
def status(serial): | ||
with pyAPT.MTS50(serial_number=serial) as con: | ||
status = con.status() | ||
print('\tController status:') | ||
print('\t\tPosition: %.3fmm (%d cnt)'%(status.position, status.position_apt)) | ||
print('\t\tVelocity: %.3fmm'%(status.velocity)) | ||
print('\t\tStatus:',status.flag_strings()) | ||
|
||
|
||
if __name__ == '__main__': | ||
import sys | ||
sys.exit(status()) | ||
#!/usr/bin/env python | ||
""" | ||
Usage: python get_status.py [<serial>] | ||
Gets the status of all APT controllers, or of the one specified | ||
""" | ||
from __future__ import absolute_import | ||
from __future__ import print_function | ||
import pyAPT | ||
|
||
from runner import runner_serial | ||
|
||
@runner_serial | ||
def status(serial): | ||
with pyAPT.MTS50(serial_number=serial) as con: | ||
status = con.status() | ||
print('\tController status:') | ||
print('\t\tPosition: %.3fmm (%d cnt)'%(status.position, status.position_apt)) | ||
print('\t\tVelocity: %.3fmm'%(status.velocity)) | ||
print('\t\tStatus:',status.flag_strings()) | ||
|
||
|
||
if __name__ == '__main__': | ||
import sys | ||
sys.exit(status()) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,26 @@ | ||
#!/usr/bin/env python | ||
""" | ||
Usage: python get_status.py [<serial>] | ||
Gets the status of all APT controllers, or of the one specified | ||
""" | ||
from __future__ import absolute_import | ||
from __future__ import print_function | ||
import pyAPT | ||
|
||
from runner import runner_serial | ||
|
||
@runner_serial | ||
def get_vel_params(serial): | ||
with pyAPT.MTS50(serial_number=serial) as con: | ||
min_vel, acc, max_vel = con.velocity_parameters() | ||
raw_min_vel, raw_acc, raw_max_vel = con.velocity_parameters(raw=True) | ||
print('\tController velocity parameters:') | ||
print('\t\tMin. Velocity: %.2fmm/s (%d)'%(min_vel, raw_min_vel)) | ||
print('\t\tAcceleration: %.2fmm/s/s (%d)'%(acc, raw_acc)) | ||
print('\t\tMax. Velocity: %.2fmm/s (%d)'%(max_vel, raw_max_vel)) | ||
|
||
if __name__ == '__main__': | ||
import sys | ||
sys.exit(get_vel_params()) | ||
#!/usr/bin/env python | ||
""" | ||
Usage: python get_status.py [<serial>] | ||
Gets the status of all APT controllers, or of the one specified | ||
""" | ||
from __future__ import absolute_import | ||
from __future__ import print_function | ||
import pyAPT | ||
|
||
from runner import runner_serial | ||
|
||
@runner_serial | ||
def get_vel_params(serial): | ||
with pyAPT.MTS50(serial_number=serial) as con: | ||
min_vel, acc, max_vel = con.velocity_parameters() | ||
raw_min_vel, raw_acc, raw_max_vel = con.velocity_parameters(raw=True) | ||
print('\tController velocity parameters:') | ||
print('\t\tMin. Velocity: %.2fmm/s (%d)'%(min_vel, raw_min_vel)) | ||
print('\t\tAcceleration: %.2fmm/s/s (%d)'%(acc, raw_acc)) | ||
print('\t\tMax. Velocity: %.2fmm/s (%d)'%(max_vel, raw_max_vel)) | ||
|
||
if __name__ == '__main__': | ||
import sys | ||
sys.exit(get_vel_params()) | ||
|
Oops, something went wrong.