-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DEV: added robot file #27
Open
brookeferber
wants to merge
13
commits into
xpdAcq:master
Choose a base branch
from
brookeferber:robot3
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+187
−47
Open
Changes from 2 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
3421e6b
DEV: added robot file
brookeferber 5ec2637
DEV: Added load_sample function
brookeferber 3824d9e
DEV: Planned next stages for robot in cmmnts
brookeferber af1daa5
DEV: Wrote robot class with ophyd
brookeferber 7d862ad
ENH: Added robot factory to dets
brookeferber 8ca4161
ENH: Revised robot method
brookeferber a522f44
DEV: robot test
brookeferber 0ea77c7
DEV: Revising Robot init method
brookeferber 8ee1004
ENH: Added robot to det and det_factory
brookeferber c53114c
ENH: Added robot functionaltiy to trigger_read
brookeferber f6656f5
ENH: Added sample num to robot test
brookeferber 699303a
ENH: Added sample map to robot test
brookeferber db47d44
DEV: Changed to Signals to fake device
brookeferber File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import bluesky.examples as be | ||
|
||
|
||
class Robot(be.Mover): | ||
def __init__(self, name, fields, initial_set, theta, sample_map=None): | ||
theta = be.Mover('theta', {'rad': lambda x: x}, {'x': 0}) | ||
self.theta = theta | ||
if sample_map is None: | ||
# sample_map maps positions with image cycles @ build_image_cycle | ||
# sample_map = {path (str): Cycler (iterable like object to cycle | ||
# through images} | ||
self._current_sample_geometry = None | ||
super().__init__(name, fields, initial_set, **kwargs) | ||
|
||
def load_sample(self, saple_number, sample_geometry=None): | ||
# If no sample is loaded, current_sample_number = 0 | ||
# is reported by the robot | ||
if self.current_sample_number.get() != 0: | ||
raise RuntimeError("Sample %d is already loaded." | ||
% self.current_sample_number.get()) | ||
|
||
#Rotate theta into loading position if necessary | ||
load_pos = self.TH_POS[sample_geometry]['load'] | ||
if load_post is not None: | ||
print('Moving theta to load position') | ||
self.theta.move(load_pos, wait=True) | ||
|
||
# Loading the sample is a three-step procedure: | ||
# Set sample_number; issue load_cmd; issue execute_cmd. | ||
set_and_wait(self.sample_number, sample_number) | ||
set_and_wait(self.load_cmd, 1) | ||
self.execute_cmd.put(1) | ||
print('Loading...') | ||
self._poll_until_idle() | ||
|
||
# Rotate theta into measurement position if necessary | ||
measure_pos = self.TH_POS[sample_geometry]['measure'] | ||
if measure_pos is not None: | ||
print('Moving theta to measure position') | ||
self.theta.move(measure_pos, wait=True) | ||
|
||
# Stash the current sample geomtery for reference when we unload | ||
self._current_sample_geometry = sample_geometry | ||
|
||
|
||
|
||
|
||
# What functions should be included? | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Spelling