2011/12/27 Rudy du Preez <r...@asmsa.co.za>:
> I am confused with G54 to G59. Look at the following code and run it on a
> simulation setup with Axis C rotation added:
>
> G10 L2 P1 x0  y0  C0
> G10 L2 P2 x10 y10 C0
> G10 L2 P3 x0  y0  C-45
>
> o100 sub
> G0 x25 y0
> G1 x30 f200
> G1 y5
> G1 x25
> G1 y0
> o100 endsub
>
> g54 G0 x0 y0 C0
> o100 call
> g55 G0 x0 y0 C0
> o100 call
> g56 G0 x0 y0 C0
> o100 call
>
> G54 x0 y0 C0
> m30
>
> In trivial kinematics it does three squares, the first one in untransformed
> coordinates, the second one with a shift of origin to x10 y10, and the 3rd
> one with a rotational shift of -45 degrees. All seems as expected.

Good to hear. So do I understand that the issue is solved?


> In world mode of a 4-axis system, with the inverse kinematics:
>
>  joints[0] = cos(C)*x - sin(C)*y;   joints[1] = sin(C)*x + cos(C)*y
>
> and forward kinematics:
>
>  x = cos(C)*joints[0] + sin(C)*joints[1];  y = -sin(C)*joints[0] +
> cos[C]*joints[1]
>
> it does the first and second squares in the same way as with trivialkins,
> but the 3rd square is placed in the original world coordinate position, even
> though the C-axis has been turned -45 degrees.
>
> My question is: why does the G55 shift work the same but not the G56?

Short answer to Your last question - because You are screwing it up.

For a longer answer to Your question I would urge You to return to my
initial question - to disclose full information of what You did and
what results did You obtain. The same goes here:
1) from Your email I do not understand, if You have noticed, that it
is completely different kinematics module. And I am sure that You
definitely have not noticed that it's goal is to _simulate_ rotary
table.
2) You have not said, if You did load rotatekins with appropriate line
in Your HAL file - if the module is not loaded, You cannot expect it
to work :)
3) You copied out 2 lines of totally different kinematics module and
ignored everything else. So I would like You to take account _all_
lines that are in rotatekins forward and inverse kinematics:
http://git.linuxcnc.org/gitweb?p=emc2.git;a=blob;f=src/emc/kinematics/rotatekins.c

  18 int kinematicsForward(const double *joints,
  19                       EmcPose * pos,
  20                       const KINEMATICS_FORWARD_FLAGS * fflags,
  21                       KINEMATICS_INVERSE_FLAGS * iflags)
  22 {
  23     double c_rad = -joints[5]*M_PI/180;
  24     pos->tran.x = joints[0] * cos(c_rad) - joints[1] * sin(c_rad);
  25     pos->tran.y = joints[0] * sin(c_rad) + joints[1] * cos(c_rad);
  26     pos->tran.z = joints[2];
  27     pos->a = joints[3];
  28     pos->b = joints[4];
  29     pos->c = joints[5];
  30     pos->u = joints[6];
  31     pos->v = joints[7];
  32     pos->w = joints[8];
  33
  34     return 0;
  35 }
  36
  37 int kinematicsInverse(const EmcPose * pos,
  38                       double *joints,
  39                       const KINEMATICS_INVERSE_FLAGS * iflags,
  40                       KINEMATICS_FORWARD_FLAGS * fflags)
  41 {
  42     double c_rad = pos->c*M_PI/180;
  43     joints[0] = pos->tran.x * cos(c_rad) - pos->tran.y * sin(c_rad);
  44     joints[1] = pos->tran.x * sin(c_rad) + pos->tran.y * cos(c_rad);
  45     joints[2] = pos->tran.z;
  46     joints[3] = pos->a;
  47     joints[4] = pos->b;
  48     joints[5] = pos->c;
  49     joints[6] = pos->u;
  50     joints[7] = pos->v;
  51     joints[8] = pos->w;
  52
  53     return 0;


It is not very hard to notice, that in forward kinematics in c_rad
definition there is "minus"sign before joint[5] value. And from
inverse kins we see that joints[5] = pos->c.
What does it all mean? It means that both rotations cancel each other
out and that is why You would not get any rotation. As the description
of that kinematics module says: "Simple example kinematics for a
rotary table in software". It is not meant to be used with machines,
which do actually have rotary table.

So if I understand correctly, You already have a working solution with
trivkins. Is that correct?

Viesturs

------------------------------------------------------------------------------
Write once. Port to many.
Get the SDK and tools to simplify cross-platform app development. Create 
new or port existing apps to sell to consumers worldwide. Explore the 
Intel AppUpSM program developer opportunity. appdeveloper.intel.com/join
http://p.sf.net/sfu/intel-appdev
_______________________________________________
Emc-users mailing list
Emc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-users

Reply via email to