Need Help! How to setup kinematics RTCP in KmotionCNC - Page 2

# Thread: How to setup kinematics RTCP in KmotionCNC

1. ## Re: How to setup kinematics RTCP in KmotionCNC

Hi Amit,

My X,Y,Z axes have output gain -1. Then x and y are going in right direction, as left arrow means negative and right arrow means positive.

For y axis up arrow means positive down arrow means negative
That description isn't helpful. + and - normally are in terms of the tool relative to the part. I assume your table moves in X and Y? So for example pushing the right arrow key should make the X DRO become more + but the table should move to the left. Is that what is happening?

Similarly for the "up" Y arrow, the Y DRO should become more + and the table should move toward you.

For z axis up arrow means dro is increasing value but it is going in reverse direction. As it is going downwards but dro is increasing its coordinates
If the Head is moving down when you push the up arrow, then reverse the Z axis direction.

My A axes has output gain 1 and at +90 angle, working bed is visible and in -90 angle working bed is on opposite side.
I believe what you describe is backwards. Do you understand the right hand rule? Point your right thumb in the +X direction (to the right). Your curved fingers then point in what should be the +A direction. However again this should be in relation to the tool relative to the part. Since you are moving table instead of the tool the table should move in the opposite direction.

It helps me to think of drawing with a pen on paper. If given a command to draw a line on the paper in the +X direction, I can either move the pen to the right, or the paper to the left.

Can you help me in settings it right by sending Initspindle6axis.c in which X, Y, Z, A, C has correct settings.
No. That's impossible to do without all the specifics of your machine. There are many things which effect the direction. The simple thing to do is to check the direction of each axis, and if wrong, reverse it.

Did you think 5 Axes RTCP would be easy

2. ## Re: How to setup kinematics RTCP in KmotionCNC

Hi Tom,

I assume your table moves in X and Y?
Yes it is right.

So for example pushing the right arrow key should make the X DRO become more + but the table should move to the left. Is that what is happening?
Slightly opposite, when i am pushing right arrow key X DRO becomes more+ but table is moving to the right.

Similarly for the "up" Y arrow, the Y DRO should become more + and the table should move toward you.
Again opposite for this also, for up Y arrow Y DRO becoming more + and table is moving far away from me.

I believe what you describe is backwards. Do you understand the right hand rule?
Yes i do understand the right hand rule.

Since you are moving table instead of the tool the table should move in the opposite direction.
You mean i should change the direction of A too, or A is right ????

There are many things which effect the direction.
What are the things which affects the direction other than Output gain and Motor stepper reversing?????

The simple thing to do is to check the direction of each axis, and if wrong, reverse it.
Yes i will do it.

And here is the file i attached with init file of mine and direction i told you earlier let me know if this is right. And one more thing i want to ask is Our homing of Z is in the max so is there any way of defining homing limit when i home the machine. i mean i want to make z home to some positive coordinates that is the Z max limit. So how to do that also????

Thank You

3. ## Re: How to setup kinematics RTCP in KmotionCNC

Hi Tom,

I did what you discussed ealier on my machine.

Now all axes are moving with respect to tool, ealier it was table.

But now one problem i am facing is, When i am running trial runs, tool center point is maintained but it cutting direction or tool vector is not normal to the surface.

Tool vector should be normal to the surface always while maintaining Tool Center Point in cutting operation.

I am attaching videos of simulation in CAM program, actual run on machine, Gcode File, and post processor file.

Simulation in CAM software and machine running should be same for proper cutting in my opinion.

So please solve this issue i am facing. In which part there is problem ?

Thank You

4. ## Re: How to setup kinematics RTCP in KmotionCNC

Hi Amit,

The 5-axes GCode from the CAM seems correct. I ran it in the KMotionCNC Viewer

Your A Axis still seems backwards. The Table should follow the Left-Hand-Rule As I tried to explain opposite of the commanded tool orientation.

The GCode first commands:

N40 G0 A0. C0.

Then:

N65 G0 A58.922 C-124.217

The A Axis is commanded positive so should "roll away" toward the back of the machine as the Left-Hand-Rule. But the video seems to show it rotating the opposite way to face the front. We need to fix this first.

If that messes up the RTCP then something else must be wrong. Possibly the ASaddleZCenterpoint? What is it? Where is your Z origin?

You asked before on setting the Z home position at the top to Z Max. You can do that with EnableAxisDest(Zaxis,ZMax); But it shouldn't really matter where the origin is as long as all positions are properly defined relative to it.

Regards

5. ## Re: How to setup kinematics RTCP in KmotionCNC

Hi, Tom

As you said earlier i have changed my A axis by changing the direction in amplifier.

If that messes up the RTCP then something else must be wrong
Yes this is messing up my RTCP everything is wrong now RTCP is working wrong.

And my settings in kinematics class are

CKinematics5AxisTableAC::CKinematics5AxisTableAC()
{
CTableAZeroZZero = 0; //Machine Z coordinate of C table face when A=0
CTableAZeroXCenterpoint = 0; //Machine X coordinate of C rotation axis when A=0
CTableAZeroYCenterpoint = 0; //Machine Y coordinate of C rotation axis when A=0
ASaddleYCenterpoint = 0; //Machine Y coordinate of A rotation axis
//Set A to 90,-90 and measure the centerpoint and give result in machine coordinates
//Ideally this is equal to CTableAZeroYCenterpoint, but reality is rarely so nice
ASaddleZCenterpoint = 0.511811023; //Machine Z coordinate of A rotation axis
//Use CTableAZeroZZero and the measurements from ASaddleXCenterpoint (compensated for
//tool centerpoint) to define an arc to find the center of rotation in machine coordinate Z

m_MotionParams.MaxLinearLength = 0.05; // limit the segment lengths for nonlinear systems
m_MotionParams.MaxAngularChange = 0.5; // limit the segment angle change for nonlinear systems
m_MotionParams.MaxRapidFRO = 1.0; // limit the increase in Rapid HW FRO
m_MotionParams.UseOnlyLinearSegments = true;
m_MotionParams.DoRapidsAsFeeds = true;

and my z origin is on the c table in program. but in my case A axis lies 13mm above the table. So i changed the parameter ASaddleZCenterpoint to 0.511811023 inches or 13 mm

You asked before on setting the Z home position at the top to Z Max. You can do that with EnableAxisDest(Zaxis,ZMax);
This is done.

But it shouldn't really matter where the origin is as long as all positions are properly defined relative to it.
How it is possible, origin should be defined in machine coordinates before TCP. ?

Please help me in sorting it out. i already sent initialization file. Now what changes in which program i have to make to correct RTCP.

Thank You

6. ## Re: How to setup kinematics RTCP in KmotionCNC

Hi Amit,

I didn't notice before in the video that the C axis was backwards also. Did you fix it also? I think we want both to follow the Left-hand-rule.

Then I believe the 'a' and 'c' angles in my math are backwards. Change:

// Determine where the commanded XYZ point will be after C rotation
Rotate3(CTableAZeroXCenterpoint, CTableAZeroYCenterpoint, CTableAZeroZZero, x, y, z, 0, 0, c, &CP_Rotated_C_x, &CP_Rotated_C_y, &CP_Rotated_C_z);
// Determine where the commanded XYZ point will be after A rotation
Rotate3(CTableAZeroXCenterpoint, ASaddleYCenterpoint, ASaddleZCenterpoint, CP_Rotated_C_x, CP_Rotated_C_y, CP_Rotated_C_z, a, 0, 0, &CP_Rotated_AC_x, &CP_Rotated_AC_y, &CP_Rotated_AC_z);

to

// Determine where the commanded XYZ point will be after C rotation
Rotate3(CTableAZeroXCenterpoint, CTableAZeroYCenterpoint, CTableAZeroZZero, x, y, z, 0, 0, -c, &CP_Rotated_C_x, &CP_Rotated_C_y, &CP_Rotated_C_z);
// Determine where the commanded XYZ point will be after A rotation
Rotate3(CTableAZeroXCenterpoint, ASaddleYCenterpoint, ASaddleZCenterpoint, CP_Rotated_C_x, CP_Rotated_C_y, CP_Rotated_C_z, -a, 0, 0, &CP_Rotated_AC_x, &CP_Rotated_AC_y, &CP_Rotated_AC_z);

Does that fix the RTCP? If not, please provide a clear example of what happens for a simple angular move.

Regards

7. ## Re: How to setup kinematics RTCP in KmotionCNC

Hi Tom,

RTCP is working same as before i did , necessary change that you said earlier.

And i want to know that , RTCP applies to Machine coordinates (Coordinates in Orange) or according to Work offsets (Coordinates in Green).

What if i apply some fixture offsets (G54, G55 or G92)

Does RTCP will mess up or run according to machine coordinates.?

Thank You

8. ## Re: How to setup kinematics RTCP in KmotionCNC

Hi Amit,

RTCP is working same as before i did , necessary change that you said earlier.
I don't understand what that means. I believe it means you reversed the AC Axis as the Left-hand-rule and made the code changes and now RTCP is working and the Tool has the proper angle as in the CAD simulation? Could you please put more effort into your responses?

And i want to know that , RTCP applies to Machine coordinates (Coordinates in Orange) or according to Work offsets (Coordinates in Green).

What if i apply some fixture offsets (G54, G55 or G92)

Does RTCP will mess up or run according to machine coordinates.?
The RTCP math must use Machine coordinates (Orange). It needs to know absolutely where everything is in order to do the Kinematics correctly.

However I believe Axis and Fixture Offsets should now work properly. Those are simply alternate ways to command the tool position somewhere. ie:

Offsets zero + GCode Move to X=1,Y=1,Z=1 -> Machine Position X=1,Y=1,Z=1

or

Offsets X=1,Y=1,Z=1 + GCode Move to X=0,Y=0,Z=0 -> Machine Position X=1,Y=1,Z=1

In both cases the Tool Tip should be at Machine Position X=1,Y=1,Z=1

AC Angle changes should then keep the tool tip at the same place relative to the table platen.

Could you try it?

I believe Tool Offsets are a different thing. In this case the offsets need to tell the Kinematics the Tool Tip Control Point is at a different position. We need to add a few lines of code for this. I've been waiting for the basics to be working before adding this. I think you are saying they are. Please try changing/adding the red lines below.

Code:
```int CKinematics5AxisTableAC::TransformCADtoActuators(double x, double y, double z, double a, double b, double c, double *Acts, bool NoGeo)
{
double CP_Rotated_C_x,CP_Rotated_C_y,CP_Rotated_C_z;
double CP_Rotated_AC_x,CP_Rotated_AC_y,CP_Rotated_AC_z;

x -= m_MotionParams.TCP_X;
y -= m_MotionParams.TCP_Y;
z -= m_MotionParams.TCP_Z;

// Determine where the commanded XYZ point will be after C rotation
Rotate3(CTableAZeroXCenterpoint, CTableAZeroYCenterpoint, CTableAZeroZZero, x, y, z, 0, 0, -c, &CP_Rotated_C_x, &CP_Rotated_C_y, &CP_Rotated_C_z);
// Determine where the commanded XYZ point will be after A rotation
Rotate3(CTableAZeroXCenterpoint, ASaddleYCenterpoint, ASaddleZCenterpoint, CP_Rotated_C_x, CP_Rotated_C_y, CP_Rotated_C_z, -a, 0, 0, &CP_Rotated_AC_x, &CP_Rotated_AC_y, &CP_Rotated_AC_z);

// Translate XYZ target for AC rotation
x = CP_Rotated_AC_x + m_MotionParams.TCP_X;
y = CP_Rotated_AC_y + m_MotionParams.TCP_Y;
z = CP_Rotated_AC_z + m_MotionParams.TCP_Z;

if (!NoGeo) GeoCorrect(x,y,z,&x,&y, &z);

Acts[0] = x*m_MotionParams.CountsPerInchX;
Acts[1] = y*m_MotionParams.CountsPerInchY;
Acts[2] = z*m_MotionParams.CountsPerInchZ;
Acts[3] = a*m_MotionParams.CountsPerInchA;
Acts[4] = b*m_MotionParams.CountsPerInchB;
Acts[5] = c*m_MotionParams.CountsPerInchC;

return 0;
}```
Note that for Tool Lengths/Offsets to be active they must be enabled with G43 Hn,

You will also need to come up with some scheme of handling tool lengths. For example change the Kinematics so the Tool Chuck does RTCP with no tool length, then enter into the tool table how far each Tool extends out of the Tool Check as its length.

HTH
Regards

9. ## Re: How to setup kinematics RTCP in KmotionCNC

Hi Tom,

As i said earlier RTCP for AC table i modified that machine zero values.

and i tested RTCP for AC table by moving X, Y, Z.

But in case of G code i generate from CAM software. G-Code generated for AC Table is not working for our Machine but G-Code generated for BC Table is working fine in my Case.

So in order to run the program perfectly for out machine i had to replace B by A and Interchange X and Y both. Then RTCP is working fine.

Is there in part in 5axiskinematicsAC.cpp which is still working for BC table only. ?

i mean replacing B with A and Interchange X and Y every time when i want to run the machine is quite extensive task.

So please tell me how do i overcome this problem.

10. ## Re: How to setup kinematics RTCP in KmotionCNC

Hi Amit,

Sorry we are having difficulty communicating. Sorry I don't speak your language. We seem to be going in circles. Do you have a friend that speaks better English?

As i said earlier RTCP for AC table i modified that machine zero values.
I don't understand what this means

and i tested RTCP for AC table by moving X, Y, Z.
I don't understand what this means

I understand you have a problem. We are trying to solve the problem. That is why we are asking you to verify things, make changes, run tests, and report what happened.

Could we go back to my Post #18 and do one thing at a time.

Please make that change and report what happened.

Regards

11. ## Re: How to setup kinematics RTCP in KmotionCNC

Hi tom,

This is Vignesh Here, Amit told me about having difficulty in communications so i will try my best to convey the thought.

I believe the controller we procured had TCP based on kinematics5AxisTableBC and kinematics5AxisTableAB. But we required a TCP based on kinematics5AxisTableAC. Which you kindly obliged by sending us a new TCP file as requested, The TCP worked fine while Jogging but failed when we tried to run the machines using G-Codes generated by the CAM software specifically for AC Table.

Fortunately after many trails and errors we found that the file sent by you (kinematics5AxisTableAC-class) worked perfectly under the following conditions:

1. In the post processor of the CAM software we set Machine definition for BC Table.
2. Generated the G-Codes of the Component.
3. We Interchanged the position of letters X & Y and replaced the letter "B" by letter "A" in the G-Code file generated by the CAM Software.

Note: Point to note here is that we are not changing the Position or the value of the digits(Numbers), Its Just the texts.

For Example: N15 G01 X10 Y15 Z2.5 B2 C5 (BY CAM SOFTWARE)

N15 G01 Y10 X15 Z2.5 A2 C5 (G code that works fine for our Machine)

Also i tried to operate the machine as per your suggestions in post 18 i.e., replacing a with -a, c with -c in kinematics5AxisTableAC.cpp and rebuilding it using visual studio 2015.

Kindly help us by making a true kinematics5AxisTableAC Class which works with Machine definition for AC Table in the post processor of the CAM software.

Thank you,
Vignesh M

12. ## Re: How to setup kinematics RTCP in KmotionCNC

Hi Amit/Vignesh,

This is Vignesh Here, Amit told me about having difficulty in communications so i will try my best to convey the thought.

I believe the controller we procured had TCP based on kinematics5AxisTableBC and kinematics5AxisTableAB. But we required a TCP based on kinematics5AxisTableAC. Which you kindly obliged by sending us a new TCP file as requested, The TCP worked fine while Jogging but failed when we tried to run the machines using G-Codes generated by the CAM software specifically for AC Table.
Yes I understand this. I believe the reason for this is because the A and C Axes were configured to move the wrong direction and the Kinematics5AxisTableAC had the wrong sign for A and C.

I was expecting fixing these two issues should make RTCP work correctly.

It isn't clear to me what direction is positive for the A and C axes. After much discussion I thought we had an understanding but then the Video showed them moving opposite what we discussed. Angles are usually specified with regard to the Tool using the Right-Hand-Rule. Since we are moving the Table instead of the tool the Table needs to rotate the opposite direction. Please describe the directions the tables move when commanded in the + direction.

Assuming the both directions are correct and the code was changed replacing a with -a, c with -c in kinematics5AxisTableAC.cpp correctly then RTCP should work. If it doesn't then there is something wrong somewhere and we will need your help to figure out what is wrong by performing very simple tests and reporting exactly what happens.

The first simple test would be to move the tool tip to the center of rotations of both tables. That should be Machine Coordinate X=0 Y=0 Z=13mm. Jogging the A and C angles should cause no XYZ motion. You can observe and record the axis positions by running KMotion.exe and observing the Axis Screen Destinations.

Regards

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•