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

Oriental Motor BLH controller agent for stimulator #690

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

dixilo
Copy link
Contributor

@dixilo dixilo commented Jun 11, 2024

Description

This pull request adds a new agent to operate motor to be used in the stimulator for LAT.
The motor cotroller is Orienta Motor's BLH series with USB controll capability.
This agent communicate with the controller to start or stop rotation and change parameter settings such as rotation speed.

Motivation and Context

Since the BLH series motor controller will be used in the LAT stimulator,
the agent should be contained in this repository.

How Has This Been Tested?

Test was done using an actual motor controller and an ARM-based single board computer.

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.

@dixilo dixilo added the new agent New OCS agent needs to be created label Jun 11, 2024
@dixilo dixilo requested a review from BrianJKoopman June 11, 2024 09:18
@dixilo dixilo assigned dixilo and unassigned dixilo Jun 11, 2024
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.

Thank you for the PR! This looks great overall. Many of my comments will be similar/identical to @BrianJKoopman's review of #694.

Since this agent is using a direct serial connection, and you've tested using a single board computer, I imagine this will not be run on the daq-lat node as most other agents. Other cases where this occurs would be the LS240s, whose agents are usually run on a NUC that either has direct USB connection or USB-to-fiber adapters. What is the plan for this agent?

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks for the documentation! Could you add a "Supporting APIs" section for drivers.py?

'instance-id': 'blh',
'arguments': [ '--port', '/dev/ttyACM0']
},

Copy link
Contributor

Choose a reason for hiding this comment

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

Add a "Docker Compose" section here to include an example of the docker compose configuration.

Copy link
Contributor

Choose a reason for hiding this comment

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

Remember to use """triple double quotes""", not single quotes, for docstrings.

Comment on lines +26 to +31
'''
Parameters
----------
port : string
Port to connect
'''
Copy link
Contributor

Choose a reason for hiding this comment

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

Move up to class docstring.


def start_acq(self, session, params):
'''Starts acquiring data.
'''
Copy link
Contributor

Choose a reason for hiding this comment

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


return True, 'Set values for BLH'

def start_rotation(self, session, params=None):
Copy link
Contributor

Choose a reason for hiding this comment

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

Similar to other tasks, you can add a param decorator here.

Comment on lines +211 to +213
self._blh.start(forward=forward)

return True, 'BLH rotation started.'
Copy link
Contributor

Choose a reason for hiding this comment

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

You should handle the case where the start command failed to run properly, thus the return statement that the rotation started would be incorrect. See my comment in drivers.py.

forward : bool, default True
Move forward if True
'''
self._wr(MOVE_FWD if forward else MOVE_BKW)
Copy link
Contributor

Choose a reason for hiding this comment

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

If this returns something, you should return it at the end of this function too. This could then be handled in the agent to see whether the command worked as intended.


def stop(self):
'''Stop rotation'''
self._wr(STOP)
Copy link
Contributor

Choose a reason for hiding this comment

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

Same comment as for start.

Comment on lines +226 to +228
self._blh.stop()

return True, 'BLH rotation stop command was published.'
Copy link
Contributor

Choose a reason for hiding this comment

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

Same comment as in start_rotation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hardware: stimulator new agent New OCS agent needs to be created
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants