Hello Guys,
I have written a little program for test purposes to draw a hexagon on a IRB2400 with S4C+ Controller. But when trying to running the program there are Syntax errors shown.
Here is the hexagon code:
MODULE MainModule
CONST jointtarget jpos10:=[[0,0,0,0,0,0],[0,0,0,9E+09,9E+09,9E+09]];
TASK PERS wobjdata wobj1:=[FALSE,FALSE,"STN1",[[0,0,0],[1,0,0,0]],[[0,0,0],[1,0,0,0]]];
CONST robtarget p10:=[[200,0,100],[0.7071,0,0.7071,0],[0,0,0,0],[0,0,0,9E+09,9E+09,9E+09]];
CONST robtarget p20:=[[1662.50,0.00,2055.00],[0.707107,0,0.707107,0],[0,0,0,0],[0,0,0,9E+09,9E+09,9E+09]];
PROC main()
MoveAbsJ jpos10\NoEOffs, v100, z50, tool0;
!MoveJ p10, v1000, z50, tool0\WObj:=wobj1;
DrawHexagon(); ! Call the procedure to draw the hexagon
ENDPROC
PROC DrawHexagon()
! Assuming the hexagon is centered at p20 and has a side length of 200 mm.
VAR numSides := 6; ! Number of sides (hexagon)
! Calculate the angle (in radians) between each vertex of the hexagon.
VAR angleIncrement := 2 * PI / numSides;
! Define the side length of the hexagon.
CONST sideLength := 200;
! Move to the starting position (vertex 1)
MoveL p20, v100, fine, tool0\WObj:=wobj1;
FOR i FROM 1 TO numSides DO
! Calculate the next vertex position.
VAR nextX := p20[1] + sideLength * cos(angleIncrement * i);
VAR nextY := p20[2] + sideLength * sin(angleIncrement * i);
VAR nextPosition := [nextX, nextY, p20[3]];
! Move to the next vertex position.
MoveL nextPosition, v100, fine, tool0\WObj:=wobj1;
ENDFOR
! Move back to the starting position to complete the hexagon.
MoveL p20, v100, fine, tool0\WObj:=wobj1;
ENDPROC
PROC TestInterpSingPos()
SingArea\Wrist;
MoveL Offs(p20,0,-400, 0), v100, fine, tool0;
MoveL Offs(p20,0, 400, 0), v100, fine, tool0;
SingArea\Off;
ConfL\Off;
MoveL Offs(p20,0,200, 20), v100, fine, tool0;
MoveL Offs(p20,0, -200, 20), v100, fine, tool0;
ConfL\On;
ENDPROC
ENDMODULE
And this are the error messages shown:
1. line 7 "trap" statement expected
2. line 15 "endtrap" expected
3. line 24 "identifier" expected
4. line 34 same
5. "and" operator expected
Really can`t find a solution for the errors. Anyone an idea!?