Skip to content
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

Add XY Stage Agent for LATRt Stages #153

Merged
merged 15 commits into from
Apr 6, 2021
Merged

Add XY Stage Agent for LATRt Stages #153

merged 15 commits into from
Apr 6, 2021

Conversation

kmharrington
Copy link
Member

@kmharrington kmharrington commented Mar 30, 2021

Description

Adds an agent for interacting with the XY Stage controller we're using with the LATRt.

Motivation and Context

We want position readout in .g3 files. Which means we also need to control the device through OCS.

How Has This Been Tested?

It's been tested for the use-cases we need for beam mapping. The lower level controller has the safety features.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • Unless I am preparing a release, I have opened this PR onto the develop branch.

Copy link
Collaborator

@jlashner jlashner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! I have a few small comments, but I think the one thing that should probably be changed is how you call the init_xy_stage_task from the acq process.

agents/xy_stage/xy_ocs_agent.py Outdated Show resolved Hide resolved
self.is_moving = self.xy_stage.moving

data['data']['x'] = pos[0]
data['data']['y'] = pos[1]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Having 'is_moving in the data block might be nice for a grafana dashboard, or might be helpful for analysis later on.

Copy link
Member Author

@kmharrington kmharrington Apr 1, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

possibly, but adding it now is messing up the displays of the other data in grafana?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It shouldn't effect other displays unless your querying all fields with a wildcard or something

agents/xy_stage/xy_ocs_agent.py Outdated Show resolved Hide resolved
import numpy as np

## yes I shouldn't have named that module agent
from xy_agent.xy_connect import XY_Stage
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, where is this driver located? Any chance we can put it in the socs/agents directory?

Copy link
Member Author

@kmharrington kmharrington Apr 1, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Drivers are here: https://github.com/kmharrington/xy_stage_control

I don't want to add the client side of the drivers to socs because I need to be able to use it outside ocs as well. And that would require maintaining two sets of code that do the exact same thing.

@jlashner
Copy link
Collaborator

One more comment, so seems like k2so and sat are using a slightly different xy stage, so it'll also need it's own agent. Should we rename this so that it's unique to the latrt instead of a generic xy_stage?

Copy link
Member

@BrianJKoopman BrianJKoopman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is look good. One thing that should be added is a docs file in socs/docs/agents/. I usually work from one of the other agent's files. Please include an example ocs site config file block for configuring this Agent, and a description for installing any dependencies (if xy_agent doesn't make it into socs.)

If the plan is to build a Docker container for this, we should do that and include an example docker-compose block in the docs as well.

agents/xy_stage/xy_ocs_agent.py Outdated Show resolved Hide resolved
agents/xy_stage/xy_ocs_agent.py Outdated Show resolved Hide resolved
agents/xy_stage/xy_ocs_agent.py Outdated Show resolved Hide resolved
agents/xy_stage/xy_ocs_agent.py Outdated Show resolved Hide resolved
agents/xy_stage/xy_ocs_agent.py Outdated Show resolved Hide resolved
agents/xy_stage/xy_ocs_agent.py Outdated Show resolved Hide resolved
agents/xy_stage/xy_ocs_agent.py Outdated Show resolved Hide resolved
@kmharrington
Copy link
Member Author

I think the recent commit fix all the comments?

Copy link
Member

@BrianJKoopman BrianJKoopman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, one other comment to do with naming consistency among Agents that I missed in the first review but noticed after the renaming of the Agent class.

I also think if we're renaming to avoid future name conflicts, then the xy_stage/ directory name should be changed while we're at it.

agents/xy_stage/xy_latrt_agent.py Outdated Show resolved Hide resolved
@kmharrington
Copy link
Member Author

Alright, I think that fixes the other comments?

Copy link
Member

@BrianJKoopman BrianJKoopman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great, thanks for the changes. There are two additional spots that need updating with the class name underscores removed. Then I think we're good to merge.

configuration file. Here is an example configuration block using all of
the available arguments::

{'agent-class': 'LATRt_XY_StageAgent',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs underscores removed, and this needs to match the agent_class passed to site_config.parse_args(), so it should be 'LATRtXYAgent'.

docs/agents/latrt_xy_stage.rst Outdated Show resolved Hide resolved
Copy link
Collaborator

@jlashner jlashner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me! Thanks Katie

@BrianJKoopman BrianJKoopman self-requested a review April 6, 2021 13:52
Copy link
Member

@BrianJKoopman BrianJKoopman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great, I push one final fix to make the agent class name consistent with what you're using in your ocs-site-configs definitions. These need to match so that ocs can identify which configuration block to use for your Agent. I also renamed the class to keep consistent, even though this isn't technically required it is what that string is meant to reference.

Going to merge once checks pass one last time.

@BrianJKoopman BrianJKoopman merged commit 12d7bc4 into develop Apr 6, 2021
@BrianJKoopman BrianJKoopman deleted the xy_stage_add branch April 6, 2021 15:10
@BrianJKoopman BrianJKoopman mentioned this pull request May 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants