tuning Servo Parameters of XY stage without load and horizontal on the table

This commit is contained in:
2017-02-03 11:40:31 +01:00
parent 3fafe53c39
commit ebad56c0d1
12 changed files with 1219 additions and 15 deletions

View File

@@ -2,7 +2,7 @@
[RTUSRCCODE]
usrrtmodule=/tmp/usralgo.ko
#ServoCtrlName2=usr_servo_ctrl_2
ServoCtrlName2=usr_servo_ctrl_2
ServoCtrlName3=usr_servo_ctrl_3
#ServoCtrlName4=user_pid_ctrl

View File

@@ -55,6 +55,7 @@ void user_phase( struct MotorData *Mptr)
double usr_servo_ctrl_2(MotorData *Mptr)
{
pshm->P[2000]=pshm->P[2000]*.9999+abs(Mptr->PosError)*0.0001; //lowpass of Position error
return pshm->ServoCtrl(Mptr);
}
@@ -66,6 +67,8 @@ float lutFric[275]={
double usr_servo_ctrl_3(MotorData *Mptr)
{
//Structure of shared memory file is at: /opt/eldk-4.2/PPMAC_rootfs-7-wheezy/opt/ppmac/rtpmac/RtGpShm.h
//compensate_friction_servo_ctrl for motor 3
static int cnt=0;
float p,c;
@@ -82,15 +85,25 @@ double usr_servo_ctrl_3(MotorData *Mptr)
else
c=lutFric[idx]+(lutFric[idx+1]-lutFric[idx])*(p-idx);
c=0.f;
c=0.f; //do not use friction lut
if(Mptr->DesVel>0)
{
c+=28.2405057332f;
//c+=45.f;
//c+=100.f;
}
else if (Mptr->DesVel<0)
{
c-=61.2462872333f;
//c+=45.f;
//c-=100.f;
}
else
{
c+=(28.2f-61.2f)/2.f;
}
//c-=550.f;//compensate if stage is vertically
c/=11.f; //no friction compensation at all
c=0.f; //no friction compensation at all
pshm->P[3000]=pshm->P[3000]*.9999+abs(Mptr->PosError)*0.0001; //lowpass of Position error
// The default servo algo.
ctrl_out=pshm->ServoCtrl(Mptr);