Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions roles/deploy_ioc/vars/smaract.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
# Variables for the smaract role
deploy_ioc_template_root_path: "{{ deploy_ioc_required_module_path }}"
deploy_ioc_required_module: motorsmaract_ab4dfeb
deploy_ioc_use_common: false
deploy_ioc_executable: smarAct
deploy_ioc_req_file_list:
- name: auto_settings.req
macros: ""
- name: auto_positions.req
macros: ""
- name: info_settings.req
macros: ""
- name: info_positions.req
macros: ""
deploy_ioc_device_specific_env:
PORT: SMARACT
CONTROLLER_IP: 127.0.0.1
MODEL: MCS2
NUM_AXES: 3
AXES_MASK: "0x7"
4 changes: 4 additions & 0 deletions roles/device_roles/smaract/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# SmarAct Role

This role deploys EPICS IOCs for SmarAct MCS and MCS2 motor controllers,
providing support for precise piezo motor positioning systems.
4 changes: 4 additions & 0 deletions roles/device_roles/smaract/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
device_roles_smaract_moving_poll_period: 0.05
device_roles_smaract_idle_poll_period: 1
device_roles_smaract_disable_speed: 0
38 changes: 38 additions & 0 deletions roles/device_roles/smaract/example.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
---

SmarAct:
type: "smaract"
model: "MCS2"
num_axes: 3
environment:
PREFIX: "XF:31ID1-ES{SMARACT:Dev-1}"
ENGINEER: "C. Engineer"
CONTROLLER_IP: "192.168.1.100"
PORT: "SMARACT"
MODEL: "MCS2"
NUM_AXES: 3
AXES_MASK: "0x7"
substitutions:
smaract:
templates:
- filepath: "$(MOTOR)/db/basic_asyn_motor.db"
pattern: ["P", "N", "M", "DTYP", "PORT", "ADDR", "DESC",
"EGU", "DIR", "VELO", "VBAS", "ACCL", "BDST",
"BVEL", "BACC", "MRES", "PREC", "DHLM", "DLLM",
"INIT"]
instances:
- ["$(PREFIX)", 1, "{MCS2-Ax:1}Mtr", "asynMotor",
"$(PORT)", 0, "mm", "Pos", 0, 0, 0, 0, 1, 0.2,
0.000001, 6, 0, 0, "", ""]
- ["$(PREFIX)", 2, "{MCS2-Ax:2}Mtr", "asynMotor",
"$(PORT)", 1, "mm", "Pos", 0, 0, 0, 0, 1, 0.2,
0.000001, 6, 0, 0, "", ""]
- ["$(PREFIX)", 3, "{MCS2-Ax:3}Mtr", "asynMotor",
"$(PORT)", 2, "mm", "Pos", 0, 0, 0, 0, 1, 0.2,
0.000001, 6, 0, 0, "", ""]
- filepath: "$(SMARACT)/db/MCS2_Extra.db"
pattern: ["P", "N", "M", "PORT", "ADDR", "TIMEOUT"]
instances:
- ["$(PREFIX)", 1, "{MCS2-Ax:1}Mtr", "$(PORT)", 0, 1.0]
- ["$(PREFIX)", 2, "{MCS2-Ax:2}Mtr", "$(PORT)", 1, 1.0]
- ["$(PREFIX)", 3, "{MCS2-Ax:3}Mtr", "$(PORT)", 2, 1.0]
29 changes: 29 additions & 0 deletions roles/device_roles/smaract/schema.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---

type: enum("smaract")
model: enum("MCS", "MCS2")
num_axes: int(min=1, required=True)
environment:
PREFIX: str(required=True)
ENGINEER: str(required=False)
CONTROLLER_IP: any(ip(), hostname(), required=True)
PORT: str(required=True)
NUM_AXES: int(min=1, required=True)
MODEL: enum("MCS", "MCS2", required=True)
AXES_MASK: str(required=False)
substitutions:
smaract:
templates:
- filepath: enum("$(MOTOR)/db/basic_asyn_motor.db")
pattern: list(any(enum("P"), enum("N"), enum("M"),
enum("DTYP"), enum("PORT"), enum("ADDR"),
enum("DESC"), enum("EGU"), enum("DIR"),
enum("VELO"), enum("VBAS"), enum("ACCL"),
enum("BDST"), enum("BVEL"), enum("BACC"),
enum("MRES"), enum("PREC"), enum("DHLM"),
enum("DLLM"), enum("INIT")))
instances: list(list(min=20, max=20))
- filepath: enum("$(SMARACT)/db/MCS2_Extra.db")
pattern: list(any(enum("P"), enum("N"), enum("M"),
enum("PORT"), enum("ADDR"), enum("TIMEOUT")))
instances: list(list(min=6, max=6))
33 changes: 33 additions & 0 deletions roles/device_roles/smaract/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---

- name: Deploy base startup script
ansible.builtin.template:
src: base.cmd.j2
dest: "{{ deploy_ioc_ioc_directory }}/iocBoot/base.cmd"
mode: "0664"
owner: "{{ host_config.softioc_user }}"
group: "{{ host_config.softioc_group }}"

- name: Install autosave settings req file
ansible.builtin.template:
src: auto_settings.req.j2
dest: "{{ deploy_ioc_as_directory }}/req/auto_settings.req"
mode: "0664"
owner: "{{ host_config.softioc_user }}"
group: "{{ host_config.softioc_group }}"

- name: Install autosave positions req file
ansible.builtin.template:
src: auto_positions.req.j2
dest: "{{ deploy_ioc_as_directory }}/req/auto_positions.req"
mode: "0664"
owner: "{{ host_config.softioc_user }}"
group: "{{ host_config.softioc_group }}"

- name: Deploy postInit script
ansible.builtin.template:
src: postInit.cmd.j2
dest: "{{ deploy_ioc_ioc_directory }}/iocBoot/postInit.cmd"
mode: "0664"
owner: "{{ host_config.softioc_user }}"
group: "{{ host_config.softioc_group }}"
3 changes: 3 additions & 0 deletions roles/device_roles/smaract/templates/auto_positions.req.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{% for axis in ioc.substitutions.smaract.templates[0].instances %}
file "asyn_motor_positions.req", P=$(PREFIX), M={{ axis[2] }}
{% endfor %}
3 changes: 3 additions & 0 deletions roles/device_roles/smaract/templates/auto_settings.req.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{% for axis in ioc.substitutions.smaract.templates[0].instances %}
file "asyn_motor_settings.req", P=$(PREFIX), M={{ axis[2] }}
{% endfor %}
21 changes: 21 additions & 0 deletions roles/device_roles/smaract/templates/base.cmd.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
## Register all support components
dbLoadDatabase("{{ deploy_ioc_required_module_path }}/dbd/smarAct.dbd")
smarAct_registerRecordDeviceDriver(pdbbase)

# Configure the low level communication port
{% if ioc.model == "MCS2" %}
drvAsynIPPortConfigure("$(PORT)_ETH", "$(CONTROLLER_IP):55551", 0, 0, 0)
MCS2CreateController("$(PORT)", "$(PORT)_ETH", "$(NUM_AXES)",
{{ device_roles_smaract_moving_poll_period * 1000 }},
{{ device_roles_smaract_moving_poll_period * 1000 }},
Copy link

Copilot AI Nov 4, 2025

Choose a reason for hiding this comment

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

Line 10 uses device_roles_smaract_moving_poll_period * 1000 but should likely use device_roles_smaract_idle_poll_period * 1000 based on the parameter naming convention and the non-MCS2 branch which uses separate moving and idle periods.

Suggested change
{{ device_roles_smaract_moving_poll_period * 1000 }},
{{ device_roles_smaract_idle_poll_period * 1000 }},

Copilot uses AI. Check for mistakes.
$(AXES_MASK))
{% else %}
drvAsynIPPortConfigure("$(PORT)_ETH", "$(CONTROLLER_IP):55551", 0, 0, 0)
smarActMCSCreateController("$(PORT)", "$(PORT)_ETH", {{ ioc.num_axes }},
{{ device_roles_smaract_moving_poll_period }},
{{ device_roles_smaract_idle_poll_period }},
{{ device_roles_smaract_disable_speed }})
{% for i in range(ioc.num_axes) %}
smaraActMCSCreateAxis("$(PORT)", {{ i }}, {{ i }})
Copy link

Copilot AI Nov 4, 2025

Choose a reason for hiding this comment

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

Corrected spelling of 'smaraActMCSCreateAxis' to 'smarActMCSCreateAxis'. The function name has a typo with 'smara' instead of 'smarAct'.

Suggested change
smaraActMCSCreateAxis("$(PORT)", {{ i }}, {{ i }})
smarActMCSCreateAxis("$(PORT)", {{ i }}, {{ i }})

Copilot uses AI. Check for mistakes.
{% endfor %}
{% endif %}
11 changes: 11 additions & 0 deletions roles/device_roles/smaract/templates/postInit.cmd.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
motorUtilInit("$(PREFIX)")

makeAutosaveFileFromDbInfo("$(TOP)/as/req/info_settings.req",
"autosaveFields")
makeAutosaveFileFromDbInfo("$(TOP)/as/req/info_positions.req",
"autosaveFields_pass0")

cd $(TOP)

dbl > /tmp/{{ deploy_ioc_ioc_name }}-records.dbl
date
6 changes: 6 additions & 0 deletions roles/install_module/vars/motorsmaract_ab4dfeb.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
motorsmaract_ab4dfeb:
name: motorSmarAct
url: https://github.com/epics-motor/motorSmarAct
version: ab4dfeb
executable: smarAct