-
Notifications
You must be signed in to change notification settings - Fork 0
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
3151beb
commit 6734cb1
Showing
2 changed files
with
29 additions
and
0 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
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 |
---|---|---|
@@ -0,0 +1,27 @@ | ||
from ..service_proxy import ServiceProxy | ||
|
||
import numpy as np | ||
|
||
|
||
@ServiceProxy.register_service_interface('thorlabs_cube_motor_kinesis') | ||
class ThorlabsCubeMotorKinesisProxy(ServiceProxy): | ||
def move_absolute(self, position): | ||
position = self.resolve_position(position) | ||
self.command.submit_data(np.array([position], dtype='float64')) | ||
|
||
def move_relative(self, distance): | ||
current_position = self.current_position.get()[0] | ||
new_position = current_position + distance | ||
self.move_absolute(new_position) | ||
|
||
def resolve_position(self, position_name): | ||
if type(position_name) == str: | ||
# The position is a named position. | ||
position = self.positions[position_name] | ||
# The position may still be a named position, so try to resolve deeper. | ||
return self.resolve_position(position) | ||
else: | ||
return position_name | ||
|
||
def positions(self): | ||
return self.config['positions'] |