Hello Guest it is March 28, 2024, 06:42:50 AM

Author Topic: Calculating workpiece angle through probing? (Missing arcus functions)  (Read 3203 times)

0 Members and 1 Guest are viewing this topic.

Hey,

Im actually implementing all my custom probing scripts. One of them tries to calculate the orientation of a workpiece with two probing points in X and the corresponding Y values.
with tan(alpha)=deltax/deltay

first of all, mach3 has no arcsin or arccos function
so I'm using atn for the arctan function.   atn(abs(deltax/deltay))
But it outputs crap and no correct angle.
Has anybody used atn before or could try a simple piece of code atn? converting this ratio, from lets say a=5 b=3, into an angle?

Thanks (:
Max

Offline Tweakie.CNC

*
  • *
  •  9,196 9,196
  • Super Kitty
    • View Profile
Re: Calculating workpiece angle through probing? (Missing arcus functions)
« Reply #1 on: November 28, 2014, 08:16:52 AM »
Hi Max,

This is what I use     b = Atn(X1pos/Y1pos)*(180/(4*Atn(1)))  but you have to be prepared to change the sign if moving into different quadrants.

This thread may be of interest  http://www.machsupport.com/forum/index.php/topic,22932.0.html

Tweakie.

PEACE

Offline stirling

*
  • *
  •  2,188 2,188
  • UK
    • View Profile
    • www.razordance.co.uk
Re: Calculating workpiece angle through probing? (Missing arcus functions)
« Reply #2 on: November 28, 2014, 10:07:26 AM »
atn works just fine as long as you remember it's in RADIANS not degrees.
Hence Tweakie's 180/4*Atn(1) (or of course 45/atn(1))  :)

Offline BR549

*
  •  6,965 6,965
    • View Profile
Re: Calculating workpiece angle through probing? (Missing arcus functions)
« Reply #3 on: November 28, 2014, 10:14:09 AM »
Brian and Art posted a formula years ago on teh Yahoo site that works well. AND there is a copy in one of the Wizards that works well and can solve for quadrants.  IF I have not deleted it yet I may can find it if needed.

(;-) TP
Re: Calculating workpiece angle through probing? (Missing arcus functions)
« Reply #4 on: November 28, 2014, 01:56:49 PM »
Thansk for responses!
I'll try tweakies Code and report! and thanks for the link, this looks pretty interesting (another feature I have to include.. it never ends)
I should've known that its in radiant ~

Thanks!