Oriental Motor BLH Agent
This agent is designed to interface with Oriental Motor’s BLH series motor controllers. Only controllers with a model number that includes ‘-KD’ are compatible with this agent. The controller is identified as a serial port, and you can specify the device file using the –port option in the argument. On Ubuntu, the device is recognized without requiring any driver installation and will appear as /dev/ttyACM* (e.g., /dev/ttyACM0, /dev/ttyACM1, etc.), where the number varies depending on the system. A symbolic link to the device file is also available under /dev/serial/by-id/ as usb-ORIENTAL_MOTOR_CO._LTD._ORIENTAL_MOTOR_USB-Deviice_0000000000-if00.
usage: python3 agent.py [-h] [--port PORT]
Agent Options
- --port
Default: “/dev/ttyACM0”
Configuration File Examples
Below are configuration examples for the ocs config file.
OCS Site Config
An example site-config-file block:
{'agent-class': 'BLHAgent',
'instance-id': 'blh',
'arguments': [ '--port', '/dev/ttyACM0']
},
Description
The LAT stimulator employs a BLH-series motor controller to rotate the chopper. This agent is responsible for starting and stopping the motor, monitoring the rotation speed,and controlling operational parameters such as the rotation speed. To prevent the controller from stopping the rotation due to inactivity over a certain period, this agent continuously reads the rotation speed during its operation.
The acceleration and deceleration of the motor can be controlled by specifying the time required to reach the desired rotation speed.
Agent API
- class socs.agents.orientalmotor_blh.agent.BLHAgent(agent, port='/dev/ttyACM0')[source]
OCS agent class for BLH motor driver
- Parameters:
port (string) – Port to connect, default to /dev/ttyACM0
- acq()[source]
Process - Monitor status of the motor.
- Parameters:
sampling_frequency (float, optional) – Sampling frequency in Hz, defaults to 2.5 Hz
Notes
An example of the session data:
>>> response.session['data'] {'RPM': 0.0, 'timestamp': 1736541796.779634 }
- set_values(speed=None, accl_time=None, decl_time=None)[source]
Task - Set parameters for BLH motor driver.
- Parameters:
speed (int, optional) – Motor rotation speed in RPM. Values must be in range [50, 3000].
accl_time (float, optional) – Acceleration time. Values must be in range [0.5, 15]
decl_time (float, optional) – Deceleration time. Values must be in range [0.5, 15]
Supporting APIs
- class socs.agents.orientalmotor_blh.drivers.BLH(port='/dev/ttyACM0')[source]
BLH motor driver controller
- set_accl_time(sec, accl=True)[source]
Set acceleration time
- Parameters:
sec (float) – Acceleration time in seconds
accl (bool, default True) – True: Acceleration setting False: Decceleration setting
- start(forward=True)[source]
Start rotation.
Parameter
- forwardbool, default True
Move forward if True
- returns:
result – True if rotation command published correctly.
- rtype:
bool