add example for 2-axis piezo controller in device_configs/user_template.yaml #204

Merged
diaz merged 5 commits from 2axis_npoint_controller into main 2026-05-13 17:21:45 +02:00
Member

I was testing the devices/npoint.py ophyd to control the 3-axis and the 2-axis nPoint controllers with the help of Klaus. We found that the current way to change the settling time of the piezo is:

dev.npx.settling_time.put(0.08)

And this can be used to get the current value:

dev.npx.settling_time.get()

I checked that 2 axes form 2 different controllers can be added simultaneously in the yaml file. I have thus added an example to configure an axis from the 2-axis controller in the device_configs/user_template.yaml file. The main difference with the 3-axis controller is the hostname and the limits of the motion.

We think that they way it works is that when connecting to each controller, it reads the corresponding range directly from the controller, so that the correct conversion from voltage to distance in microns can be done. Perhaps we should check this once with a microscope, I will discuss this with @holler next week.

Perhaps another thing to report is that I typically had to load the config file in bec more than once until it worked... I found this a bit strange but as long as it works I am happy.

Thanks for your patience @wakonig_k

I was testing the devices/npoint.py ophyd to control the 3-axis and the 2-axis nPoint controllers with the help of Klaus. We found that the current way to change the settling time of the piezo is: dev.npx.settling_time.put(0.08) And this can be used to get the current value: dev.npx.settling_time.get() I checked that 2 axes form 2 different controllers can be added simultaneously in the yaml file. I have thus added an example to configure an axis from the 2-axis controller in the device_configs/user_template.yaml file. The main difference with the 3-axis controller is the hostname and the limits of the motion. We think that they way it works is that when connecting to each controller, it reads the corresponding range directly from the controller, so that the correct conversion from voltage to distance in microns can be done. Perhaps we should check this once with a microscope, I will discuss this with @holler next week. Perhaps another thing to report is that I typically had to load the config file in bec more than once until it worked... I found this a bit strange but as long as it works I am happy. Thanks for your patience @wakonig_k
diaz added 1 commit 2026-05-07 14:45:12 +02:00
add example for 2-axis piezo controller in devoces/user_template.yaml
CI for csaxs_bec / test (push) Successful in 1m31s
CI for csaxs_bec / test (pull_request) Successful in 1m30s
3ea4e9195a
diaz requested review from appel_c 2026-05-07 14:45:12 +02:00
diaz requested review from holler 2026-05-07 14:45:12 +02:00
diaz requested review from wakonig_k 2026-05-07 14:45:12 +02:00
Owner

@diaz

Perhaps another thing to report is that I typically had to load the config file in bec more than once until it worked... I found this a bit strange but as long as it works I am happy.

Was it complaining that it could not connect? Or any other error message?

@diaz >Perhaps another thing to report is that I typically had to load the config file in bec more than once until it worked... I found this a bit strange but as long as it works I am happy. Was it complaining that it could not connect? Or any other error message?
Author
Member

Yes, I think the complaints were about the connection. Typically, the first time it would complain, and the second time it was then asking weather to load all new parameters from the configuration, or to keep the values from previous ones (the question that it asks with 3 different possible answers)

Yes, I think the complaints were about the connection. Typically, the first time it would complain, and the second time it was then asking weather to load all new parameters from the configuration, or to keep the values from previous ones (the question that it asks with 3 different possible answers)
Owner

From the logs, it looks like it was able to connect but the initial read that it performs afterwards fails with a timeout. Maybe the controller needs more time after opening the connection. We could try to repeat the same readout 2-3 times, giving us a total timeout of 6 s (2 s per try) before giving up.

From the logs, it looks like it was able to connect but the initial read that it performs afterwards fails with a timeout. Maybe the controller needs more time after opening the connection. We could try to repeat the same readout 2-3 times, giving us a total timeout of 6 s (2 s per try) before giving up.
Author
Member

Yes, we could try that, thanks! My impression is that it needs longer time to establish the connection, indeed. I also noticed that it took a while from physically connecting to network (plug ethernet cable and turn controller on) until the controller was detected in PacketFence. It needs its time...

Yes, we could try that, thanks! My impression is that it needs longer time to establish the connection, indeed. I also noticed that it took a while from physically connecting to network (plug ethernet cable and turn controller on) until the controller was detected in PacketFence. It needs its time...
Owner

okay, I will add the retry to this branch

okay, I will add the retry to this branch
wakonig_k added 1 commit 2026-05-08 09:22:37 +02:00
feat(npoint): add retry to initial readout and improve error message
CI for csaxs_bec / test (push) Successful in 1m35s
CI for csaxs_bec / test (pull_request) Successful in 1m42s
9b09d5a64d
Owner

It will try it now 5 times with a 1s delay in between. Let's see if that "fixes" it

It will try it now 5 times with a 1s delay in between. Let's see if that "fixes" it
Owner

Regarding "settling_time" and "settle_time": We've had a discussion with Controls yesterday and we agreed that we would override the default ophyd property "settle_time" with what we currently have in "settling_time". This should make it more consistent: configurations are signals.

If you want, we can make the change already here for the NPoint. It is merely renaming

    settling_time = Cpt(Signal, value=0.1, kind="config")

to

    settle_time = Cpt(Signal, value=0.1, kind="config")
Regarding "settling_time" and "settle_time": We've had a discussion with Controls yesterday and we agreed that we would override the default ophyd property "settle_time" with what we currently have in "settling_time". This should make it more consistent: configurations are signals. If you want, we can make the change already here for the NPoint. It is merely renaming ```python settling_time = Cpt(Signal, value=0.1, kind="config") ``` to ```python settle_time = Cpt(Signal, value=0.1, kind="config") ```
Author
Member

Hi Klaus. I am not sure I completely understand. Would this mean that we can set the settling time of the piezo in the configuration? How?

Hi Klaus. I am not sure I completely understand. Would this mean that we can set the settling time of the piezo in the configuration? How?
Owner

Yes, this would be a side-effect once merged. It would then behave like a normal signal, allowing you to do something like

npx:
  description: nPoint x axis on the big (3-axis) npoint controller
  deviceClass: csaxs_bec.devices.npoint.npoint.NPointAxis
  deviceConfig:
    axis_Id: A
    host: "nPoint000003.psi.ch"
    limits:
    - -50
    - 50
    port: 23
    sign: 1
    settle_time: 0.08
  enabled: true
  onFailure: buffer
  readOnly: false
  readoutPriority: baseline
  connectionTimeout: 20
  deviceTags:
  - npoint

If you want, I can make the required changes

Yes, this would be a side-effect once merged. It would then behave like a normal signal, allowing you to do something like ```yaml npx: description: nPoint x axis on the big (3-axis) npoint controller deviceClass: csaxs_bec.devices.npoint.npoint.NPointAxis deviceConfig: axis_Id: A host: "nPoint000003.psi.ch" limits: - -50 - 50 port: 23 sign: 1 settle_time: 0.08 enabled: true onFailure: buffer readOnly: false readoutPriority: baseline connectionTimeout: 20 deviceTags: - npoint ``` If you want, I can make the required changes
Author
Member

This sounds great, Klaus, thank you!
Should I test the branch before merging? - Did you make a branch?

This sounds great, Klaus, thank you! Should I test the branch before merging? - Did you make a branch?
wakonig_k added 1 commit 2026-05-12 19:36:44 +02:00
fix: rename settling_time to settle_time to override ophyd property
CI for csaxs_bec / test (pull_request) Successful in 1m28s
CI for csaxs_bec / test (push) Successful in 1m28s
40e1efa329
wakonig_k force-pushed 2axis_npoint_controller from acdc3728b9 to 40e1efa329 2026-05-12 19:36:44 +02:00 Compare
Owner

This sounds great, Klaus, thank you!
Should I test the branch before merging? - Did you make a branch?

I pushed it now to this branch. We can merge it and test it the next time we find the opportunity. I would be particularly interested in the startup behavior (as discussed above) and whether the repeated readout attempt improves the stability.

Ana, feel free to merge :)

> This sounds great, Klaus, thank you! > Should I test the branch before merging? - Did you make a branch? I pushed it now to this branch. We can merge it and test it the next time we find the opportunity. I would be particularly interested in the startup behavior (as discussed above) and whether the repeated readout attempt improves the stability. Ana, feel free to merge :)
Author
Member

OK, thanks!
I am trying to figure out how to merge. I have button here that says: "rebase, then fast-forward"
And a message:
"The merge will not be signed as the base commit is not signed.
This pull request can be merged automatically"
But I don't see a clear button saying "merge"

OK, thanks! I am trying to figure out how to merge. I have button here that says: "rebase, then fast-forward" And a message: "The merge will not be signed as the base commit is not signed. This pull request can be merged automatically" But I don't see a clear button saying "merge"
Owner

You can press the rebase button (see https://bec.readthedocs.io/latest/how-to/git/merge-changes-to-main.html). Rebasing is similar to merge but puts the commits on top of the main branch, not just mingles them in between.

You can press the rebase button (see https://bec.readthedocs.io/latest/how-to/git/merge-changes-to-main.html). Rebasing is similar to merge but puts the commits on top of the main branch, not just mingles them in between.
Author
Member

OK, now I was reading the instructions and I think it is clear. Thank you. It's just that the buttons have nothing to do with logic or intuition... I guess I need to learn all this
I have a chance to test the piezos today, so I am going to test on the branch, maybe add the settling time in the config template, and I will then merge

OK, now I was reading the instructions and I think it is clear. Thank you. It's just that the buttons have nothing to do with logic or intuition... I guess I need to learn all this I have a chance to test the piezos today, so I am going to test on the branch, maybe add the settling time in the config template, and I will then merge
Owner

OK, now I was reading the instructions and I think it is clear. Thank you.

That's great to hear!

[...] maybe add the settling time in the config template

Please note that it is now called settle_time, not settling_time

>OK, now I was reading the instructions and I think it is clear. Thank you. That's great to hear! > [...] maybe add the settling time in the config template Please note that it is now called `settle_time`, not `settling_time`
bec_bl_push-gitea added 1 commit 2026-05-13 16:06:43 +02:00
wakonig_k added 1 commit 2026-05-13 17:09:39 +02:00
fix(npoint): retry on wait_for_connection
CI for csaxs_bec / test (pull_request) Successful in 1m31s
Read the Docs Deploy Trigger / trigger-rtd-webhook (push) Successful in 2s
CI for csaxs_bec / test (push) Successful in 1m33s
abca4364bd
wakonig_k force-pushed 2axis_npoint_controller from 1c4165f301 to abca4364bd 2026-05-13 17:09:39 +02:00 Compare
diaz merged commit abca4364bd into main 2026-05-13 17:21:45 +02:00
diaz deleted branch 2axis_npoint_controller 2026-05-13 17:21:45 +02:00
Author
Member

Merged!
Thanks for your help, Klaus!

Merged! Thanks for your help, Klaus!
Sign in to join this conversation.
No labels
3 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: bec/csaxs_bec#204