Notifications
Clear all

Determining the Direction/Angle a CNC Machine is Traveling

3 Posts
2 Users
0 Likes
1,367 Views
(@mafokken)
Member
Joined: 2 years ago
Posts: 2
Topic starter  

Hello!

 

I am wondering if there is a way to determine what direction or angle a CNC machine is traveling. In relation to the X and Y only. 

 

So for instance, if the machine is at point A -> x: 0, y: 0 and travels to point B -> x: 100, y: 100. I would think that it would be traveling on a path of 45 degrees (or maybe it would be a path of 135 degrees??). But how would you get the computer to figure out that the CNC is traveling at that angle.

 

Is there a formula that would help figure out the angle of the path from point A to point B?

 

I think I figured some of it out. Just need to make sure my calculator is in degrees (or convert from radians to degrees). degrees = radians * 180 / pi

But using point B:

inverse tan (y/x) = the angle

This only helps me if I'm only in quadrant 1, though. Because the angle will be different if x and/or y are negative.

 

But I guess I could do a test like these.

IF x = positive and y = positive THEN quadrant 1

IF x = negative and y = positive THEN quadrant 2

IF x = negative and y = negative THEN quadrant 3

IF x = positive and y = negative THEN quadrant 4

 

And then add or subtract 90, 180, 270, or 360 degrees. (Whatever the right answer it would be. I'm just trying to get the initial idea out of my head.)

 

But if any of the x or y are zero, then I would need to test for that first.

 

Am I missing something?


   
Quote
robotBuilder
(@robotbuilder)
Member
Joined: 5 years ago
Posts: 2042
 

   
ReplyQuote
(@mafokken)
Member
Joined: 2 years ago
Posts: 2
Topic starter  

@robotbuilder 

OOOOHHHH!

That is very close to what I will need.

 

Eventually the idea will be to figure out the angle of travel, even between two different points. But that may be as simple as: 

x:  x_Point_B - x_Point_A = x value to use in your formula

y:  y_Point_B - y_Point_A = y value to use in your formula

 

 

Thank you!


   
ReplyQuote