Jump to content
OMRON Forums

# trigonometric function

## Recommended Posts

if I want call trigonometric function "cos" to move forward and backward on one axis, how should I write in programming?

• Replies 4
• Created
• Last Reply

#### Popular Days

One way to do this is to create a phantom (pretend) axis. For example, let's say you want the X axis to have a sinusoidal trajectory. Then create a phantom axis called V, and do circular interpolation in the X-V plane. There is no V, so it doesn't do a circle, it simply does sinusoidal motion on X.
##### Share on other sites

One way to do this is to execute a circular move on X and Y, where Y for example is a non-existent phantom axis. The real axis will then move in a sinusoidal fashion. Here is an example.

```[font=Courier]End Gat
Del Gat
Close
Undefine All

&1
#1->1000X			; cts/user units (e.g. mm, inches)

I113 = 10			; Segmentation Time

#define OutFreq  P100	; Output Frequency
#define OutMag	P101	; Output Magnitude
#define OutCycle	P102	; Cycle Counter

OutFreq = 1		; Sine Frequency [Hz]
OutMag = 5			; Sine magnitude, [user units]
OutCycle = 0		; Reset Cycle Counter

OPEN PROG 1 CLEAR
OutCycle = 0		; Reset cycle counter
HOME 1			; Circle starting point
ABS
TA 10				; Small accel time
TS 5				; Small S-Curve time
TM(1000 / OutFreq)	; Move time / Frequency
DWELL 0
NORMAL K-1
CIRCLE1

WHILE(OutCycle !> 3)
OutCycle = OutCycle + 1
X 0 Y 0 J(-OutMag)
ENDW

DWELL 0
CLOSE[/font]
```

##### Share on other sites

• 2 weeks later...

I would like to move on SINE WAVE CHARACTERISTIC and below is the sample program I get through and can below the graph consider as SINE WAVE…?

There are few question would like your advice base on the program as below..

1. The position for X(P103)=5000 and the graph that I get is just 3300pulse..please advice…

2. What is the function for OutMag J(-P101) currently I set it to 0..it doesn’t affect my motor moving while set it to 10..

graph.zip

##### Share on other sites

You have modified the example, and removed the home command. This is important for the X0Y0J() command because it specified the starting point, being at zero. I don't see you specifying anywhere in your motion program the start point of the "circle".

You need to learn about the CIRCLE command, and understand that what you program in the CIRCLE move X()Y()I()J() specifying the end point and radius is directly related to the very important start position.

Otherwise, I don't understand the first question. I don't see P103 anywhere in the code or X(P103). You have hard coded X5.

##### Share on other sites

This topic is now closed to further replies.

×
• Forums

• Calendar
• #### Browse

×
• Create New...