# Trajectory in time-domain

**URL:** <https://tech-community.robotics.abb.com/t/trajectory-in-time-domain/3335>\
**Category:** Robot Controller\
**Created:** [February 1, 2010, 3:52pm UTC](https://tech-community.robotics.abb.com/t/trajectory-in-time-domain/3335 "2010-02-01T15:52:58Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![faz](https://avatars.discourse-cdn.com/v4/letter/f/85e7bf/32.png) [@faz](https://tech-community.robotics.abb.com/u/faz)\
**Post date:** [February 1, 2010, 3:52pm UTC](https://tech-community.robotics.abb.com/t/trajectory-in-time-domain/3335/1 "2010-02-01T15:52:58Z")

</div>

Hi,

I want to assign as joint trajectory a trigonometric function in time domain (sine or cosine). How can I do it in RAPID?

Thanks  
bye!!

---

<div class="post-metadata">

**Author:** ![Henrik\_Berlin](https://dub1.discourse-cdn.com/flex005/user_avatar/tech-community.robotics.abb.com/henrik_berlin/32/1011_2.png) [@Henrik\_Berlin](https://tech-community.robotics.abb.com/u/Henrik_Berlin)\
**Post date:** [February 2, 2010, 10:13am UTC](https://tech-community.robotics.abb.com/t/trajectory-in-time-domain/3335/2 "2010-02-02T10:13:15Z")

</div>

Hi,

Here is an example for the IRB140. You can enable “TCP Trace” to view the trajetory.

MODULE Module1

CONST robtarget pHome:=[[506.291651245987,1.29490239543512E-12,679.5],[0.499999999999998,0,0.866025403784439,0],[0,0,0,0],[9E9,9E9,9E9,9E9,9E9,9E9]];

CONST robtarget pCenter:=[[554.479956268792,1.73273580794849E-12,533.699988807741],[4.22133561439608E-09,0,1,0],[0,0,0,0],[9E9,9E9,9E9,9E9,9E9,9E9]];

CONST robtarget pStart:=[[554.479955451763,-200.00000706809,533.699989666025],[1.44838108079029E-08,7.56676097447419E-17,1,-5.22428873538805E-09],[-1,0,-1,0],[9E9,9E9,9E9,9E9,9E9,9E9]];

PROC Path\_10()

Reset doTrace;

MoveJ pHome,v1000,z100,tool0WObj:=wobj0;

MoveJ pStart,v1000,fine,tool0WObj:=wobj0;

SetDO doTrace,1;

MoveSin pStart,v1000,fine,tool0,wb:=wobj0;

Reset doTrace;

MoveJ pHome,v1000,z100,tool0WObj:=wobj0;

ENDPROC

!\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*

! Procedure: MoveSin

! Description:

! The robot moves along a sine wave

!

!\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*

PROC MoveSin(

robtarget StPoint,

speeddata sp,

zonedata zn,

PERS tooldata tl

PERS wobjdata wb)

VAR robtarget pTmp;

CONST num n:=100; !steps

CONST num h:=360/n;

VAR num offset\_x:=0;

VAR num offset\_y:=0;

VAR num offset\_z:=0;

!

CONST num amplitude := 100; !mm

CONST num wavelength := 400; !mm

VAR clock clock2;

VAR num t:=0;

VAR num t0:=0;

VAR num t\_t0:=0;

VAR num alpha:=0;

ClkReset clock2;

ClkStart clock2;

t0 := ClkRead(clock2);

alpha := 360/6; ! empirical constant

ConfL Off;

FOR i FROM 0 TO n DO

t := ClkRead(clock2);

t\_t0 := t - t0;

TPWrite "t - t0 = ",Num:=t\_t0;

TPWrite "(t - t0) \* alpha = ",Num:=t\_t0\*alpha;

offset\_x := amplitude \* Sin(t\_t0 \* alpha);

offset\_y := wavelength \* i / n;

pTmp:=Offs(StPoint,offset\_x,offset\_y,0);

MoveL pTmp,sp,zn,tl,Wobj:=wb;

WaitTime 0.01;

!!!

ENDFOR

MoveL pTmp,sp,fine,tl,Wobj:=wb; !fine poitn

ENDPROC

PROC main()

Path\_10;

ENDPROC

ENDMODULE

---

<div class="post-metadata">

**Author:** ![faz](https://avatars.discourse-cdn.com/v4/letter/f/85e7bf/32.png) [@faz](https://tech-community.robotics.abb.com/u/faz)\
**Post date:** [February 2, 2010, 2:34pm UTC](https://tech-community.robotics.abb.com/t/trajectory-in-time-domain/3335/3 "2010-02-02T14:34:11Z")

</div>

Hi,  
Thank you for your reply.  
I have another question:  
the speed of my trajectory is also a trigonometric function in time domain, it’s possible to implementate that in RAPID?

---

<div class="post-metadata">

**Author:** ![Henrik\_Berlin](https://dub1.discourse-cdn.com/flex005/user_avatar/tech-community.robotics.abb.com/henrik_berlin/32/1011_2.png) [@Henrik\_Berlin](https://tech-community.robotics.abb.com/u/Henrik_Berlin)\
**Post date:** [February 2, 2010, 2:58pm UTC](https://tech-community.robotics.abb.com/t/trajectory-in-time-domain/3335/4 "2010-02-02T14:58:40Z")

</div>

Hi,

I haven’t tried it but I suppose you can write a FUNC that returns a speedata that you use in the move instruction. Something like

MoveL pTarget1,myspeed(time),fine,tool1,Wobj:=wobj1;

where myspeed is defined like

FUNC speeddata myspeed(num time)  
RETURN v20; ! replace with your speedata calculation  
ENDFUNC

Check the RAPID manuals that are included in RS for reference.

---

<div class="post-metadata">

**Author:** ![faz](https://avatars.discourse-cdn.com/v4/letter/f/85e7bf/32.png) [@faz](https://tech-community.robotics.abb.com/u/faz)\
**Post date:** [February 15, 2010, 2:58pm UTC](https://tech-community.robotics.abb.com/t/trajectory-in-time-domain/3335/5 "2010-02-15T14:58:01Z")

</div>

Hi,

I tried to give a sine trajectory to the first joint, but I found a problem: the joint stops at every reference point and then restart. So the movement is not accurate, but is jerkily.Does it exist a function to do an accurate movement also at high speeds?

Thanks  
Bye.

---

<div class="post-metadata">

**Author:** ![Henrik\_Berlin](https://dub1.discourse-cdn.com/flex005/user_avatar/tech-community.robotics.abb.com/henrik_berlin/32/1011_2.png) [@Henrik\_Berlin](https://tech-community.robotics.abb.com/u/Henrik_Berlin)\
**Post date:** [February 15, 2010, 4:09pm UTC](https://tech-community.robotics.abb.com/t/trajectory-in-time-domain/3335/6 "2010-02-15T16:09:00Z")

</div>

My example above used **fine** as zonedata. It is defined as a **stop point** which means that the motion stops for each instruction and then restarts just as you mentioned. You can try to use **z0** instead of fine. The zonedata z0 is defined as a **fly-by point**. Please read about the **zonedata** datatype in the RAPID reference manual. You can either use any of the pre-defined data or define your own.

---

<div class="post-metadata">

**Author:** ![faz](https://avatars.discourse-cdn.com/v4/letter/f/85e7bf/32.png) [@faz](https://tech-community.robotics.abb.com/u/faz)\
**Post date:** [February 18, 2010, 10:27am UTC](https://tech-community.robotics.abb.com/t/trajectory-in-time-domain/3335/7 "2010-02-18T10:27:08Z")

</div>

Hi,  
has it sense to use RRI to give a reference joint position as an application data to the controller??. I use this referential position in a MoveabsJ instruction like this:

MoveabsJ([[joint\_reference,0,0,0,0,0] [9E9,9E9,9E9,9E9,9E9,9E9,]],V1000T:=0.004,z0,tool0);

in this case i want that the instruction is executed in 0.004 s like the resolution of the data trasmission. But actually the Robot has longer execution time (e.g. 0.05s). How can i reduce this time?

the rapid program that i use is the following:

MODULE RRI\_MAIN  
PROC main()  
SiConnect TestDevice;

SiGetCyclic TestDevice, ReplyMessage, SampleRate;  
SiSetCyclic TestDevice, RobotMessage, SampleRate;

WHILE TRUE DO

MoveAbsJ [[ReplyMessage.App.B1,0,0,0,0,0 [9E9,9E9,9E9,9E9,9E9,9E9]],vmaxT:=0.004,z0,tool0WObj:=wobj0;  
ENDWHILE

SiClose TestDevice;  
ENDPROC

ENDMODULE

ReplyMessage.App.B1 is the variable which changes every 0.004s.

---

<div class="post-metadata">

**Author:** ![Henrik\_Berlin](https://dub1.discourse-cdn.com/flex005/user_avatar/tech-community.robotics.abb.com/henrik_berlin/32/1011_2.png) [@Henrik\_Berlin](https://tech-community.robotics.abb.com/u/Henrik_Berlin)\
**Post date:** [February 18, 2010, 12:26pm UTC](https://tech-community.robotics.abb.com/t/trajectory-in-time-domain/3335/8 "2010-02-18T12:26:56Z")

</div>

Moved to RobotWare Forum
