Wiregrid Actuator Agent

The Wiregrid Actuator Agent controls the linear actuator to insert or eject the wire-grid via a GALIL motor controller. It communicates with the controller via an ethernet. It also reads ON/OFF of the limit-switches on the ends of the actuators and lock/unlock the stoppers to lock/unlock the actuators.

usage: python3 agent.py [-h] [--interval-time INTERVAL_TIME]
                        [--ip-address IP_ADDRESS] [--sleep SLEEP]
                        [--verbose VERBOSE]

Agent Options

--interval-time

Interval time for data taking

Default: 1.0

--ip-address

IP address of the actuator controller

Default: “192.168.1.100”

--sleep

Sleep time for every actuator command

Default: 0.05

--verbose

Verbosity level

Default: 0

Dependencies

This agent depends on GALIL controller libraries: gclib. gclib requires installation of other libraries and gclib itself and starting services(dbus, avahi-daemon, and gcapsd) in the docker. These preparations are automatically made in Dockerfile and wg-actuator-entrypoint.sh. Reference links for gclib:

Configuration File Examples

Below are configuration examples for the ocs config file and for running the Agent in a docker container.

OCS Site Config

An example site-config-file block:

{'agent-class': 'WiregridActuatorAgent',
 'instance-id': 'wgactuator',
 'arguments': [['--ip-address', '10.10.10.73']]},

Docker Compose

An example docker-compose configuration:

ocs-wgactuator-agent:
    image: simonsobs/ocs-wgactuator-agent:latest
    hostname: ocs-docker
    network_mode: "host"
    environment:
      - INSTANCE_ID=wgactuator
    volumes:
      - ${OCS_CONFIG_DIR}:/config:ro
  • Since the agent within the container needs to communicate with hardware on the host network you must use network_mode: "host" in your compose file.

Description

Functions

The agent has many functions, however most of them are for testing. The main functions are insert() and eject().

Main Functions
  • insert(): Insert the wire-grid into the inside of the forebaffle, which includes unlocking the stoppers

  • eject(): Eject the wire-grid from the inside of the forebaffle, which includes unlocking the stoppers

In the both of the functions, after the inserting/ejecting, the stopper locks the actuators again. However, the motor power is not turned ON or OFF during the both functions.

The parameter details are here:

  • speedrate: Actuator speed rate [0.0, 5.0] (default: 1.0)

Test Functions
  • check_limitswitch(): Check ON/OFF of the limit switches

  • check_stopper(): Check ON/OFF (lock/unlock) of the stoppers

  • insert_homing(): Insert very slowly

  • eject_homing(): Eject very slowly

  • insert_test(): Insert in a test mode

  • eject_test(): Eject in a test mode

  • motor_on(): Power ON the actuator motors

  • motor_off(): Power OFF the actuator motors (CAUTION: Take care of using this function since powering OFF the motor means that the wire-grid can slide down by its gravity if the stoppers do NOT lock the actuators.)

  • stop(): Stop the motion of the actuators (Change a STOP flag in Actuator class to True)

  • release(): Release the agent to receive the functions if it is locked in the software (Change a STOP flag in Actuator class to False)

  • reconnect(): Reconnect to the actuator controller

In the test mode, you can choose the moving distance [mm] and speed rate. The parameter details are here:

  • distance: Actuator moving distance [mm] (default: 10)

  • speedrate: Actuator speed rate [0.0, 5.0] (default: 0.2)

Hardware Configurations

There are several limit-switches and stoppers. These list are configured in limitswitch_config.py and stopper_config.py.

Agent API

class socs.agents.wiregrid_actuator.agent.WiregridActuatorAgent(agent, ip_address='192.168.1.100', interval_time=1.0, sleep=0.05, verbose=0)[source]

Agent to control the linear actuator to insert or eject the wire-grid via a GALIL motor controller. It communicates with the controller via an ethernet. It also reads ON/OFF of the limit-switches on the ends of the actuators and lock/unlock the stoppers to lock/unlock the actuators.

Parameters:
  • ip_address (str) – IP address for the GALIL motor controller

  • interval_time (float) – Interval time for dat acquisition

  • sleep (float) – sleep time for every commands

  • controller (the motor)

insert(speedrate=1.0, high_speed=False)[source]

Task - Insert the wire-grid into the forebaffle interface above the SAT.

Parameters:
  • speedrate (float) – Actuator speed rate [0.0, 5.0] (default: 1.0) DO NOT use speedrate > 1.0 if el != 90 deg!

  • high_speed (bool) – If False, speedrate is limited to 1.0. Defaults to False.

eject(speedrate=1.0, high_speed=False)[source]

Task - Eject the wire-grid from the forebaffle interface above the SAT.

Parameters:
  • speedrate (float) – Actuator speed rate [0.0, 5.0] (default: 1.0) DO NOT use speedrate > 1.0 if el != 90 deg!

  • high_speed (bool) – If False, speedrate is limited to 1.0. Defaults to False.

check_limitswitch(io_name)[source]

Task - Print limit-switch ON/OFF state.

Parameters:

io_name (string) – The IO name to be printed. Names configured in limitswitch_config.py. If None, all limit-switches are printed.

check_stopper(io_name)[source]

Task - Print stopper ON/OFF (ON: lock the actuator, OFF: release the actuator)

Parameters:

io_name (string) – The IO name to be printed. Names configured in stopper_config.py. If None, all stoppers are printed.

insert_homing()[source]

Task - Insert slowly the wire-grid into the forebaffle interface above the SAT until the inside limit-switch becomes ON.

eject_homing()[source]

Task - Eject slowly the wire-grid from the forebaffle interface above the SAT until the outside limit-switch becomes ON.

insert_test(distance=10, speedrate=0.2, high_speed=False)[source]

Task - Insert slowly the wire-grid into the forebaffle interface above the SAT with a small distance.

Parameters:
  • distance (float) – Actuator moving distance [mm] (default: 10)

  • speedrate (float) – Actuator speed rate [0.0, 5.0] (default: 0.2) DO NOT use speedrate > 1.0 if el != 90 deg!

  • high_speed (bool) – If False, speedrate is limited to 1.0. Defaults to False.

eject_test(distance=10, speedrate=0.2, high_speed=False)[source]

Task - Eject slowly the wire-grid from the forebaffle interface above the SAT with a small distance.

Parameters:
  • distance (float) – Actuator moving distance [mm] (default: 10)

  • speedrate (float) – Actuator speed rate [0.0, 5.0] (default: 0.2) DO NOT use speedrate > 1.0 if el != 90 deg!

  • high_speed (bool) – If False, speedrate is limited to 1.0. Defaults to False.

motor_on()[source]

Task - Power ON the motors of the actuators.

motor_off()[source]

Task - Power OFF the motors of the actuators.

stop()[source]

Task - Emergency stop of the wire-grid actuator. (Disable the actuator motion.)

Note

This command can be excuted even if the other command is running.

release()[source]

Task - Enable the actuator moving.

reconnect()[source]

Task - Reconnect to the actuator controller.

Warning

This command turns OFF the motor power!

acq()[source]

Process - Run data acquisition.

Parameters:

interval-time – interval time for data acquisition

Notes

The most recent data collected is stored in session.data in the structure:

>>> response.session['data']
{'fields':
    {
     'motor':
        0 or 1
     'limitswitch':
     {   'LSR1': 0 or 1, (0: OFF, 1:ON)
         'LSR2': 0 or 1, (0: OFF, 1:ON)
         .
         .
         },
     'stopper':
     {   'STR1': 0 or 1, (0: OFF, 1:ON)
         'STR2': 0 or 1, (0: OFF, 1:ON)
         .
         .
         }
    },
 'timestamp':1601925677.6914878
}

Example Clients

Below is an example client to insert and eject the actuator:

from ocs.ocs_client import OCSClient
wgactuator = OCSClient('wgactuator')

# Insert the actuator
wgactuator.insert()

# Eject the actuator
wgactuator.eject()

Supporting APIs

class socs.agents.wiregrid_actuator.drivers.Actuator.Actuator(ip_address='192.168.1.100', sleep=0.05, ls_list=[], st_list=[], verbose=0)[source]

The Actuator class is for writing commands and reading status of the actuator via the Galil actuator controller.

Parameters:
  • ip_address (string) – IP address of the actuator controller

  • sleep (float) – sleep time for every commands

  • ls_list (list) – limit-switch IO configurations

  • st_list (list) – stopper IO configurations

  • verbose (int) – verbosity level

class socs.agents.wiregrid_actuator.drivers.DigitalIO.DigitalIO(name, io_list, g, get_onoff_reverse=False, set_onoff_reverse=False, verbose=0)[source]

The digital IO class to read & control the digital IOs via the Galil actuator controller.

Parameters:
  • name (string) – Name of this instance

  • io_list (list) – IO configurations

  • g (gclib.py()) – Actuator controller library

  • get_onoff_reverse (bool) – Return 1/0 in _get_onoff() if IO input is 0/1

  • set_onoff_reverse (bool) – Send SB(1)/CB(0) to the controller in _set_onoff() if “onoff” argument is False/True

  • verbose (int) – Verbosity level

get_onoff(io_name=None)[source]

Get True/False (ON/OFF) for the digital IOs.

Parameters:

io_name (str or list) – A string of a IO name or list of IO names.

Returns:

A list of True/Falses or a single True/False depending on the value of io_name. If io_name is None, return a list of the ON/OFFs for all the IOs. If io_name is a list, return a list of the ON/OFFs for asked IOs. If io_name is a string (one IO), return one ON/OFF. Here True means ON and False means OFF.

Return type:

list or str

set_onoff(onoff=0, io_name=None)[source]

Set True/False (ON/OFF) for the digital IOs.

Parameters:
  • onoff (int) – 0 (OFF) or 1 (ON)

  • io_name (str or list) – a string of a IO name or list of IO names. If None, set all possible IOs ON/OFF. If a list, set all specified IOs ON/OFF. If a string (one IO), set the given IO ON/OFF.