# scarakins axis follow problem in -x and -y zone

03 Jan 2024 12:34 - 05 Jan 2024 19:21 #289653 by bkt
Hi at all,

on Lcnc 2.9.1 and scarakins standard ....
not understand why but I observe these never test before now: when reach x-500 y+1 position trought x-500 y-1  position in world mode I have an estop event ... think because these row inside kins foward:
```        *iflags = 0;
if (joint[1] < 90)
*iflags = 1;

than in Inverse:

[code]    /* joint 1 angle needed to make arm length match sqrt(rsq) */
cc = (rsq - D2*D2 - D4*D4) / (2*D2*D4);
if(cc < -1) cc = -1;
if(cc > 1) cc = 1;
q1 = acos(cc);
if (*iflags)
q1 = -q1;

but not understand why exactly seems x and c axis try to moove into undesired point (with estop obtain follow error on joint 0 and joint3 so X and C axis) ... these not happens in positive area +X and +Y or +X and -Y or -X and -Y ... only during moovement trought -Y to +Y if I'm on -X area ..... but is these logical?  a3 or C axis not change angle during these motion from -n to +n or inverse ....

any suggestion is appreciate

p.s.:
axis limit for test is set to +6000mm and -6000
mm... but robot can reach only 900mm. joint limit is set to +720° and -720° so is not a limit problem ...```
[/code]
Last edit: 05 Jan 2024 19:21 by bkt.

Please Log in or Create an account to join the conversation.

05 Jan 2024 19:21 - 20 Jan 2024 22:18 #289891 by bkt
seems a simply solution can be follow:
```static int scaraKinematicsInverse(const EmcPose * world,
double * joint,
const KINEMATICS_INVERSE_FLAGS * iflags,
KINEMATICS_FORWARD_FLAGS * fflags)
{
double a3;
double q0, q1;
double xt, yt, xt1, yt1, rsq, cc;
double x, y, z, c;

x = world->tran.x;
y = world->tran.y;
z = world->tran.z;
c = world->c;

/* convert degrees to radians */
a3 = c * ( PM_PI / 180 );

/* center of end effector (correct for D6) */
xt = x - D6*cos(a3);
yt = y - D6*sin(a3);
xt1 = xt;
yt1 = yt;

/* horizontal distance (squared) from end effector centerline
to main column centerline */
rsq = xt*xt + yt*yt;
/* joint 1 angle needed to make arm length match sqrt(rsq) */
cc = (rsq - D2*D2 - D4*D4) / (2*D2*D4);
if(cc < -1) cc = -1;
if(cc > 1) cc = 1;
q1 = acos(cc);

if (*iflags)
q1 = -q1;

/* angle to end effector */
q0 = atan2(yt, xt);

/* end effector coords in inner arm coord system */
xt = D2 + D4*cos(q1);
yt = D4*sin(q1);

/* inner arm angle */
//q0 = q0 - atan2(yt, xt);
if((xt1<0) && (yt1>=0)){q0 = q0 - atan2(yt, xt) - 2*M_PI;}
else{q0 = q0 - atan2(yt, xt);}

/* q0 and q1 are still in radians. convert them to degrees */
q0 = q0 * (180 / PM_PI);
q1 = q1 * (180 / PM_PI);

joint[0] = q0;
joint[1] = q1;
joint[2] = D1 + D3 - D5 - z;
joint[3] = c - ( q0 + q1);
joint[4] = world->a;
joint[5] = world->b;

*fflags = 0;

return (0);
} // scaraKinematicsInverse()```

not tested on real machine for now ... only on openGL test windows.

regards
Last edit: 20 Jan 2024 22:18 by bkt.
The following user(s) said Thank You: tommylight

Please Log in or Create an account to join the conversation.

20 Jan 2024 22:22 #291224 by bkt
sorry seems I deleted the previous my answer by posting this new possible solution for -x & -y scara working zone, when end-point passes trought Y=0 ....

Please Log in or Create an account to join the conversation.

23 Jan 2024 20:35 - 23 Jan 2024 20:52 #291462 by bkt
because i use reverse geometry of scara joint the file must be modify in these way:

(see txt file)

#### File Attachment:

File Name: scarakins-behind.txt
File Size:2 KB

tested on my 950mm machine ... not tested on other machinery.
##### Attachments:
Last edit: 23 Jan 2024 20:52 by bkt.
The following user(s) said Thank You: Aciera

Please Log in or Create an account to join the conversation.

Time to create page: 0.068 seconds