Skip to content

Conversation

@ShreyaSut
Copy link
Contributor

Added two new tasks to query the forward and reverse limits to see if they're triggered or not.

Description

Added two new tasks to query the forward and reverse limits to see if they're triggered or not. The argument can be any axis. (e.g. Axis "A" for motor A).

Motivation and Context

We ran into a new issue at site with the limit switches bouncing where they were flickering. We added capacitors in the electronics to try and debounce the limit switches, but were not able to check the state of the limits without the new tasks. Now we can query those forward and reverse limits to see if they're triggered or not.

How Has This Been Tested?

Tested the limits for the lead axes "A" and "C" in a script and they worked.

Types of changes

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

Checklist:

  • [x ] My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
    I think the documentation would need to be updated if a new task is added, but I'm unsure, but I can add that later if that's needed.

@ShreyaSut ShreyaSut self-assigned this Dec 15, 2025
Copy link
Contributor

@davidvng davidvng left a comment

Choose a reason for hiding this comment

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

Thanks for the updates! Just some small changes, including a typo that should fix the failing check.

return True, f"Axis {axis} forward limit: {human_state} (raw={state})"

@ocs_agent.param('axis', type=str)
def get_reverse_limitswitch(self, sesion, params):
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
def get_reverse_limitswitch(self, sesion, params):
def get_reverse_limitswitch(self, session, params):

return None, "unknown"

# --- Interpret raw
human_state = "not triggered" if state == 1 else "triggered" if state == 0 else f"unknown ({state})"
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
human_state = "not triggered" if state == 1 else "triggered" if state == 0 else f"unknown ({state})"
human_state = "not triggered" if state == 1 else ("triggered" if state == 0 else f"unknown ({state})")

return None, "unknown"

# --- Interpret raw
human_state = "not triggered" if state == 1 else "triggered" if state == 0 else f"unknown ({state})"
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
human_state = "not triggered" if state == 1 else "triggered" if state == 0 else f"unknown ({state})"
human_state = "not triggered" if state == 1 else ("triggered" if state == 0 else f"unknown ({state})")

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.

3 participants