Hi,
I suspect the problem is that you must tell the motor record that your axis has “gain support” in order for it to call setClosedLoop.
This is where that is done in the Newport XPS driver.
https://github.com/epics-motor/motorNewport/blob/63b90d2f652437eb23e59bd2779f7455bc973e52/newportApp/src/XPSAxis.cpp#L158
Mark
Sent from my iPhone
On Aug 12, 2021, at 8:32 PM, yue zongyang <yuezy at ihep.ac.cn> wrote:
Hellow Mark,
I’m so sorry, this is my fault. I’m so tired yesterday that there were several mistakes in my email.
The version of motor is R7-1.
The name of field is CNEN, which is used to enable/disable closed-loop position control.
When I change the state of CNEN field , just the motorUpdateStatus_ function that is called
and the motorClosedLoop_ function cann’t be called. This make me confused.
To explain my questions explicitly, I copy part of code from asynMotorController.cpp
-----------------------
asynStatus asynMotorController::writeInt32(asynUser *pasynUser, epicsInt32 value)
{
int function = pasynUser->reason;
asynStatus status=asynSuccess;
asynMotorAxis *pAxis;
int axis;
static const char *functionName = "writeInt32";
pAxis = getAxis(pasynUser);
if (!pAxis) return asynError;
axis = pAxis->axisNo_;
/* Set the parameter and readback in the parameter library. */
pAxis->setIntegerParam(function, value);
if (function == motorStop_) {
double accel;
getDoubleParam(axis, motorAccel_, &accel);
status = pAxis->stop(accel);
} else if (function == motorDeferMoves_) {
status = setDeferredMoves(value);
} else if (function == motorClosedLoop_) {
status = pAxis->setClosedLoop(value);
} else if (function == motorUpdateStatus_) {
bool moving;
/* Do a poll, and then force a callback */
poll();
status = pAxis->poll(&moving);
pAxis->statusChanged_ = 1;
}
…
…
…
return status;
}
----------------------
Best regards!
Zongyang yue
发件人: Mark Rivers<mailto:rivers at cars.uchicago.edu>
发送时间: 2021年8月12日 19:40
收件人: yue zongyang<mailto:yuezy at ihep.ac.cn>
抄送: tech-talk at aps.anl.gov<mailto:tech-talk at aps.anl.gov>
主题: Re:
Hi Zongyang,
What version of the motor record are you using? The current master branch of the motor record does not contain a field called CENE.
https://github.com/epics-modules/motor/blob/master/motorApp/MotorSrc/motorRecord.dbd
Is this something that was locally added to the motor record?
Mark
________________________________
From: Tech-talk <tech-talk-bounces at aps.anl.gov> on behalf of yue zongyang via Tech-talk <tech-talk at aps.anl.gov>
Sent: Thursday, August 12, 2021 4:03 AM
To: tech-talk at aps.anl.gov
Subject:
Hi,
I is writing motor device driver based on Model 3.
But I meet some problem which about rewriting WriteInt32 (asynUser *pasynUser, epicsInt32 value) function.
However, I changed the value of $(motor).CENE field in motor OPI, my WriteInt32() function cann’t be called.
And the value of other fields changed can call this function.
My WriteInt32() function is as follow:
------------------------------------------
asynStatus PDICLController::writeInt32(asynUser* pasynUser, epicsInt32 value)
{
int function = pasynUser->reason;
int status = asynSuccess;
PDICLAxis* pAxis;
static const char* functionName = "writeInt32";
pAxis = this->getAxis(pasynUser);
if (!pAxis) return asynError;
status = pAxis->setIntegerParam(function, value);
epicsPrintf("test :104 line :The function name:%d and the value :%d\n",function,value);
if (function == PDICLJoggingPosMethod_)
{
if(value!=0)
{
status = pAxis->Jogging_move_pos();
}
}
if (function == PDICLJoggingNegMethod_)
{
if(value!=0)
{
status = pAxis->Jogging_move_neg();
}
}
else {
// Call base class method
status = asynMotorController::writeInt32(pasynUser, value);
}
pAxis->callParamCallbacks();
return (asynStatus)status;
}
-------------------------
When I change the state of $(motor).CENE field , just the motorUpdateStatus_ function that is called which mark is 26
and the motorClosedLoop_ function cann’t be called which mark is 19.
Mennwhile I test the motorStop_ function which mark is 4.
The test result of the shell of ioc is as follow
-------------------------
epics> test :104 line :The function name:26 and the value :0
test :104 line :The function name:4 and the value :0
test :104 line :The function name:26 and the value :0
test :104 line :The function name:26 and the value :0
-------------------------
I see other motor module’s device driver have done as same.
What’s going wrong about my code?
Any suggestions or comments would be appreciated.
Best regards!
Zongyang yue
- References:
- [no subject] yue zongyang via Tech-talk
- Re: Mark Rivers via Tech-talk
- Navigate by Date:
- Prev:
RE: Getting started talking to a device Leblanc, Gregory via Tech-talk
- Next:
RE: Archiver Appliance mgmt tomcat issue Manoussakis, Adamandios via Tech-talk
- Index:
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
<2021>
2022
2023
2024
- Navigate by Thread:
- Prev:
Re: Mark Rivers via Tech-talk
- Next:
IOC PVA on mTCA CPU requires environment variables to be set Meeus Kris via Tech-talk
- Index:
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
<2021>
2022
2023
2024
|