Hi Dave,
Thank you and APS team for sharing your code and findings.
The changes you suggested in the Stop() function work much better!!
Before the motor actually stopped, after ~30 seconds. One needed to be patient and not panic. I made this discovery accidently.
I have done ~ 50 tests. When one makes a long move and presses stop, it does stop after a few (up to 10 sec ) delay. In most cases the target position is updated to the current position and the motor stays at rest. In a few cases,
however, the target position is not updated, and the motor moves again after checking on other motors, ( a while). It seems after the second stop it is updated.
Also, I added a the stop command after limits detection in the poll(). And this actually works quite well. The motor power output stops almost immediately after reporting a limit, and when the targeted position is not updated, and
the move command comes again, it gets updated the second time.
This code also address the situation when motor is on the pos limit for example and is commanded to go positive. It did output power before, now it doesn't
Poll()
………………………..
if (status == "backward limit reached") then
low_lim = 1
local request = {
jsonrpc = "2.0",
method = "com.attocube.amc.control.setControlMove",
params = { AXIS, false},
id = AXIS,
api = 2 }
send(request)
end
if (status == "forward limit reached") then
high_lim = 1
local request = {
jsonrpc = "2.0",
method = "com.attocube.amc.control.setControlMove",
params = { AXIS, false},
id = AXIS,
api = 2 }
send(request)
end
It would be nice to push all these updates to the github.
For the enabling output, I enabled the motors via vendor app, and yes, it gets disabled after the power cycle.
With best regards,
Oksana
-----Original Message-----
From: Cyl, David C. <davecyl at anl.gov>
Sent: Wednesday, October 19, 2022 4:28 PM
To: Peterson, Kevin M. <kmpeters at anl.gov>; Ivashkevych, Oksana <oksana at bnl.gov>; Lang, Keenan C. <klang at anl.gov>; Tech-talk
<tech-talk at aps.anl.gov>
Subject: Re: Attocube AMC100
Another issue I ran into was with the stage enable, on the web view you can enable or disable a stage. I tried to do this via the setControlOutput command using the torque enable/disable button and it did toggle the enable state but
when I then read back this state via the getControlOutput it was flipping from true/false and I still have no idea why. I did open a case with attocube and if I get an answer I will post here.
Here is a snippet of the code that gets executed upon a closedLoop state change.
if(closedLoop) then
local request = {
jsonrpc = "2.0",
method =
"com.attocube.amc.control.setControlOutput",
params = { AXIS, 1 },
id = AXIS,
api = 2 }
send(request)
else
local request = {
jsonrpc = "2.0",
method =
"com.attocube.amc.control.setControlOutput",
params = { AXIS, 0 },
id = AXIS,
api = 2 }
send(request)