Skip to content

Commit

Permalink
LATRt Updates (#419)
Browse files Browse the repository at this point in the history
* xy_latrt_agent

* Revert "xy_latrt_agent"

This reverts commit 8ed55f6.

* update agents for 2023 testing

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Add method signature overrides to docstrings

Also fixed a typo in the set_disabled() docstring 's/enabled/disabled'.

---------

Co-authored-by: simonscryo <[email protected]>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Brian Koopman <[email protected]>
  • Loading branch information
4 people authored Nov 15, 2024
1 parent ae733af commit 9718035
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 4 deletions.
2 changes: 1 addition & 1 deletion socs/agents/fts_aerotech/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ def init_stage(self, session, params=None):
# so does not require the lock
self.initialized = True
if self.auto_acq:
self.agent.start('acq')
self.agent.start('acq', params={'sampling_frequency': self.sampling_frequency})
return True, 'Stage Initialized.'

@ocs_agent.param('_')
Expand Down
37 changes: 34 additions & 3 deletions socs/agents/xy_stage/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def init_xy_stage(self, session, params=None):
# so does not require the lock
self.initialized = True
if self.auto_acq:
self.agent.start('acq')
self.agent.start('acq', params={'sampling_frequency': self.sampling_frequency})
return True, 'XY Stages Initialized.'

@ocs_agent.param('distance', type=float)
Expand Down Expand Up @@ -164,7 +164,39 @@ def set_position(self, session, params):
self.xy_stage.position = params['position']
return True, "Position Updated"

@ocs_agent.param('sampling_frequency', type=float)
@ocs_agent.param('_')
def set_enabled(self, session, params=None):
"""set_enabled()
**Task** - Tell the controller to hold stages enabled.
"""
with self.lock.acquire_timeout(timeout=3, job='set_enabled') as acquired:
if not acquired:
self.log.warn(
f"Could not set position because lock held by {self.lock.job}")
return False, "Could not acquire lock"

self.xy_stage.enable()
return True, "Enabled"

@ocs_agent.param('_')
def set_disabled(self, session, params=None):
"""set_disabled()
**Task** - Tell the controller to hold stages disabled.
"""
with self.lock.acquire_timeout(timeout=3, job='set_disabled') as acquired:
if not acquired:
self.log.warn(
f"Could not set position because lock held by {self.lock.job}")
return False, "Could not acquire lock"

self.xy_stage.disable()
return True, "Disabled"

@ocs_agent.param('sampling_frequency', default=None, type=float)
def acq(self, session, params=None):
"""acq(sampling_frequency=2)
Expand Down Expand Up @@ -265,7 +297,6 @@ def main(args=None):
args = site_config.parse_args(agent_class='LATRtXYStageAgent',
parser=parser,
args=args)

agent, runner = ocs_agent.init_site_agent(args)

xy_agent = LATRtXYStageAgent(agent, args.ip_address, args.port, args.mode, args.sampling_frequency)
Expand Down

0 comments on commit 9718035

Please sign in to comment.