Thank you for your help.
Best Regards
Paul-Elie GUILLOT
Technology Manager in Automation and Robotics
Téléphone: +33 (0)4 76 44 9893
20 rue du Tour de l'Eau
F-38400 St Martin d’Hères Cedex
Phone : +33 (0)4 76 44 12 96
irelec-alcen.com <http://www.irelec-alcen.com/en>
*IRELEC after sales services – please send your request to
support at irelec-alcen.zendesk.com <mailto:support at irelec-alcen.zendesk.com> *
Any disclosure, use, dissemination or reproduction (either whole or
partial) of this message or the information contained herein is strictly
prohibited without prior consent of Irelec.
*De :*Torsten Bögershausen <Torsten.Bogershausen at ess.eu>
*Envoyé :* mercredi 17 janvier 2024 11:48
*À :* Paul-Elie GUILLOT <peguillot at irelec-alcen.com>; tech-talk at aps.anl.gov
*Objet :* Re: Questions about creating a Model 3 Driver for stepper
motor axis
Salut Paul-Elie,
welcome to the world of motion and EPICS.
I try to answer some.
First of all, we do our microstepping, hadnling the encoder,
and calculating EGU (mm) inside the Beckhoff, using TwinCAT and
the motion libraries. (NC in TwinCAT speech).
(I need to mention that we also have a complete different solution,
where not TwinCAT is used, but Linux. This does include an EPICS driver
and everything.
Please see https://github.com/epics-modules/ecmc
<https://github.com/epics-modules/ecmc> )
If you go for TwinCAT, what do you use ?
We have defined ‘interface structures’ inside the PLC program,
and then written a model 3 driver, that talks to the PLC.
Of course, the PLC program must match the EPICS driver, and vice versa.
Over the years, there are 2 generations of PLC/EPICS, the first one more
straightforward, the second one more advanced.
Both versions of the PLC code are (still) in one EPICS module .
The first generation of an Axis is here :
<https://github.com/EuropeanSpallationSource/m-epics-ethercatmc/blob/master/ethercatmcApp/src/ethercatmcAxis.cpp <https://github.com/EuropeanSpallationSource/m-epics-ethercatmc/blob/master/ethercatmcApp/src/ethercatmcAxis.cpp>>
(And then you find the other stuff as well, I think).
HTH
/Torsten, happy to answer more questions
*From: *Tech-talk <tech-talk-bounces at aps.anl.gov
<mailto:tech-talk-bounces at aps.anl.gov>> on behalf of Paul-Elie GUILLOT
via Tech-talk <tech-talk at aps.anl.gov <mailto:tech-talk at aps.anl.gov>>
*Reply to: *Paul-Elie GUILLOT <peguillot at irelec-alcen.com
<mailto:peguillot at irelec-alcen.com>>
*Date: *Wednesday, 17 January 2024 at 11:11
*To: *"tech-talk at aps.anl.gov <mailto:tech-talk at aps.anl.gov>"
<tech-talk at aps.anl.gov <mailto:tech-talk at aps.anl.gov>>
*Subject: *Questions about creating a Model 3 Driver for stepper motor axis
Hello to everyone at tech-talk,
I am currently working on implementing an EPICS driver for controlling
axis which are stepper motors with absolute encoders.
My hardware controller is a Beckhoff PLC I am programming to interface
with. I am planning to use mm as EGU.
I have read multiple documentation and I have started to implement a
driver based on the Model 3 drivers, I have heavily inspired myself from
the MCB4B Driver for ACS and the Phytron driver.
I am starting to get a better understanding on how it works but I still
need clarifications on some points. Would you be so kind to help me on
those matters?
First of all,
* I see that when creating an axis controller using the class
asynMotorController, it creates a lot of parameters then linked to a
motor record by their names (the string passed to the createParam()
function), is that correct?
* How does each axis has its own set of parameters while connected to
the same asynMotorController, is it because the asynMotorAxis class
creates an AsynUser which connects to the controller?
By doing this, it creates a separate set of parameters for the axis
with the pasynUser_?
* I heavily rely on the record programming to carry out advanced
functions, such as backlash compensation and closed loop motion on
the encoder.
Do you have experience in those matters? How will the system reach a
specific encoder position? Will it use a linear term between encoder
ticks and motor steps?
But if the axis is not linear enough, there will be issues in
reaching the position?
If I understand correctly, usually motors use the FRAC and RTRY
mechanism to reach a encoder position with a certain number of retry?
In practice, how do most people operate with an encoder? Do they
use the motor in open loop and monitor the encoder, or do they set
UEIP at 1 and use FRAC motion?
* My motors are able to do microstepping (decomposing a full step in
64 microsteps), should I implement this in the MRES field of the
record, as not being 200 full steps but 12800 microsteps?
I think so because I intend to give the motor positions in
microsteps. Is there a low limit on the MRES value?
* On the system, we will be using absolute encoders, in that regard
the encoder ratio is always 1 to transfer to encoder counts, correct?
From my understanding, encoder ratio is mainly to interface with
incremental encoders converting to raw A/B ticks in full encoder tick.
Because from what I gathered the motorEncoderPosition_ must be linked to
the Field REP and is the hardware counter of the encoder.
* Is there a filter of some sorts on the encoder counts field or
should I implement one directly on my Beckhoff controller and then
use the delayAfterMove parameter to allow the encoder counts to
stabilize?
* As I have absolute encoder on all axis, for an axis the parameter
motorhasEncoder_ is always at 1 as well as the motorStatusHomed_ .
However, to use and encoder, the record needs to have the record
field UEIP at 1.
Is it defined by the user, or should initialize UEIP at 1, in my
template defined in “motor.substitutions.irelec” adding the field UEIP
to my .db file (which is derived from basic_asyn_motor.db with some
field added)?
* From what I understand, the motor record is defined by the
motorRecord.cc and motorRecord.dbd and Model 3 drivers mainly
interface with the devMotorAsyn.c, is it correct?
A change on a field of the record will be processed by
motorRecord.cc and use the different functions I have redefined for
my Driver (move, poll, etc…), is it correct?
Does the devMotorAsyn.c defines the support entry table required to
process the record commands? (with the function start_trans,
build_trans and end_trans)
Looking through the code, I understood that for Model 2 Driver and
Support, one needs to defined the support entry table to process the
record commands? (ex: MCB4B_build_trans function)
In Model 3, it seems the asynMotorController directly handles the
modification of its parameters by calling the needed function of an
axis. How does the record interface with the asynMotorController parameters?
I can’t find where devMotorAsyn.c writes to the asynMotorController
parameters.
Bottom line of this topic is: Can I use the record advanced functions
such as backlash compensation even with a Model 3 Driver?
* The record always feed steps command to the controller if I
understood the code correctly.
However as I don’t have a home routine (due to absolute encoders),
the open loop (step count) is reset at each hardware controller
power reset.
Thus, the user should never do move_absolute in openloop. To disable
it, I would like the UEIP to be always at 1? Or something should be
done to set the open loop position using setposition based on the
absolute encoder at the start of the controller?
It could be the home procedure, just sending a setposition() to the
stepper based on the encoder position? Or does the home position require
motion?
* I noticed there is no process of error catching on the motor and
error resetting, is that correct?
Should I always reset an axis in Error on my Beckhoff hardware
controller or should I include command on my EPICS driver to do so,
thus adding record for those specific actions?
Because for example, if my motor reaches a hardware limit switch
while in motion it will put itself in error state, which then needs
an error reset using the MC_Reset.
I need it’s a lot of questions, I hope it is clear enough.
In any case, thank you for your time and help.
Paul-Elie GUILLOT
Technology Manager in Automation and Robotics
Téléphone: +33 (0)4 76 44 9893
20 rue du Tour de l'Eau
F-38400 St Martin d’Hères Cedex
Phone : +33 (0)4 76 44 12 96
irelec-alcen.com <http://www.irelec-alcen.com/en>
*IRELEC after sales services – please send your request to
support at irelec-alcen.zendesk.com <mailto:support at irelec-alcen.zendesk.com> *
Any disclosure, use, dissemination or reproduction (either whole or
partial) of this message or the information contained herein is strictly
prohibited without prior consent of Irelec.