# Creating move Function

**URL:** <https://tech-community.robotics.abb.com/t/creating-move-function/3030>\
**Category:** RobotStudio\
**Created:** [September 9, 2009, 3:21am UTC](https://tech-community.robotics.abb.com/t/creating-move-function/3030 "2009-09-09T03:21:57Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![hud\_uitm](https://avatars.discourse-cdn.com/v4/letter/h/dbc845/32.png) [@hud\_uitm](https://tech-community.robotics.abb.com/u/hud_uitm)\
**Post date:** [September 9, 2009, 3:21am UTC](https://tech-community.robotics.abb.com/t/creating-move-function/3030/1 "2009-09-09T03:21:57Z")

</div>

Hi there, my name is Hud.

I?\_Tm new in this Robotic field. I do some study about Robotic welding. One of my welding activity is welding on function path such as (y=sin ?, y=cos ? or y=x2+2x+4). Is anyone known about this? If so please do help me.

Thanks?\_?..

---

<div class="post-metadata">

**Author:** ![mattdavis](https://avatars.discourse-cdn.com/v4/letter/m/8e7dd6/32.png) [@mattdavis](https://tech-community.robotics.abb.com/u/mattdavis)\
**Post date:** [September 9, 2009, 4:17am UTC](https://tech-community.robotics.abb.com/t/creating-move-function/3030/2 "2009-09-09T04:17:05Z")

</div>

I have not done this for welding, but for cutting pipe I have generated a path in autocad and then imported this into robotstudio and used create path from curve with reasonable success.

In simplest forms you could generate the coordinates in excel with your function and then create all the points in robstudio using the x,y,z coordinates.

---

<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:** [September 11, 2009, 8:51am UTC](https://tech-community.robotics.abb.com/t/creating-move-function/3030/3 "2009-09-11T08:51:27Z")

</div>

Hi,

As stated above, creating the curve in a CAD-program where you can enter explicit mathematical expressions for the curve and then importing that into RS would be the most convenient solution.

Alternatively, if you are familiar with .NET development, you can write some code to generate the targets on the function using VSTA that comes with RS.

You can also approach this from a lower level, by implementing instructions direcly in the RAPID language of the controller. RAPID is a powerful language which is similar to any procedural programming language. The main difference that it also contains motion instructions. The language is flexible and allows you to implement you own move instructions using the exisiting ones as building blocks. Example: ArcSine …, ArcCos,…

The last option is hard work! Just enter the coordinates and create the targets where you want them.

---

<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:** [September 29, 2009, 12:35pm UTC](https://tech-community.robotics.abb.com/t/creating-move-function/3030/4 "2009-09-29T12:35:25Z")

</div>

There is a good example (“draw\_square”) in the manual “Introduction to RAPID”, see below:

![](http://forums.robotstudio.com/webwiz/772/DrawSquare.jpg)

Please also check my example code for a IRB140 below :

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()  
MoveJ pHome,v1000,z100,tool0WObj:=wobj0;  
MoveJ pStart,v1000,fine,tool0WObj:=wobj0;  
MoveSin pStart,v1000,z0,tool0,wb:=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;  
CONST num amplitude := 100; !mm  
CONST num wavelength := 400; !mm  
ConfL Off;  
FOR i FROM 0 TO n DO  
offset\_x := amplitude \* Sin(i \* h);  
offset\_y := wavelength \* i / n;  
pTmp:=Offs(StPoint,offset\_x,offset\_y,0);  
MoveL pTmp,sp,zn,tl,Wobj:=wb;  
ENDFOR  
ENDPROC  
PROC main()  
Path\_10;  
ENDPROC  
ENDMODULE

If want to use this instruction from RS you can add it using the “Instruction Template Manager”

---

<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:** [September 29, 2009, 12:56pm UTC](https://tech-community.robotics.abb.com/t/creating-move-function/3030/5 "2009-09-29T12:56:01Z")

</div>

I couldn’t resist…  
[webwiz/772/MathematicalRobot.zip](http://forums.robotstudio.com/webwiz/772/MathematicalRobot.zip)

(You may need to install the XVID codec to view the recording, see [http://www.xvidmovies.com/codec/](http://www.xvidmovies.com/codec/))

---

<div class="post-metadata">

**Author:** ![hud\_uitm](https://avatars.discourse-cdn.com/v4/letter/h/dbc845/32.png) [@hud\_uitm](https://tech-community.robotics.abb.com/u/hud_uitm)\
**Post date:** [October 25, 2009, 4:42am UTC](https://tech-community.robotics.abb.com/t/creating-move-function/3030/6 "2009-10-25T04:42:11Z")

</div>

Hi, I’ve seen the video of the moveSin. I also done it in my robotstudio and its working. But the path line (yellow) does not appear. Can you tell me how can I apear the movement or path like you have done in the video.

Thank You..

---

<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:** [October 28, 2009, 5:40pm UTC](https://tech-community.robotics.abb.com/t/creating-move-function/3030/7 "2009-10-28T17:40:34Z")

</div>

| |
| --- |
|   
Simulation tab → Simulation Monitor → Check “TCP Trace” option  
  
Kind regards,  
Henrik  
  
 |

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/flex005/user_avatar/tech-community.robotics.abb.com/system/32/6_2.png) [@system](https://tech-community.robotics.abb.com/u/system)\
**Post date:** [October 29, 2009, 9:25am UTC](https://tech-community.robotics.abb.com/t/creating-move-function/3030/8 "2009-10-29T09:25:23Z")

</div>

Hi,

Great!It’s helpful for me!

---

<div class="post-metadata">

**Author:** ![hud\_uitm](https://avatars.discourse-cdn.com/v4/letter/h/dbc845/32.png) [@hud\_uitm](https://tech-community.robotics.abb.com/u/hud_uitm)\
**Post date:** [November 2, 2009, 11:55am UTC](https://tech-community.robotics.abb.com/t/creating-move-function/3030/9 "2009-11-02T11:55:11Z")

</div>

To Henrik Berlin…

I’m using IRB2400\_16. Did you obtain the quadratic motion? I do it but the motion is only move along Y axis direction. So you mean there are no problems with my program? I’ll try after this.

Hud…  
P.S. Sorry to reply this message using this forum. Your PM inbox is full.
