Hallo ihr lieben, ich möchte meinen ABB2400 an einem S4C+ kontrollieren können. Er soll ein Hexagon in die Luft nachfahren. Übertragen wird per USB an den controller. Leider krieg ich auf dem flexpendant noch 2 Syntaxfehler angezeigt
40705 Syntaxfehler line =7 , column = 1: Expected Identifier
40700 Syntaxfehler Expected := but found ,
Vielleicht kann ja jemand von euch helfen!?
%%%
VERSION:1
LANGUAGE:ENGLISH
%%%
MODULE
VAR robtarget start_pos, target_pos;
VAR num i := sides;
CONST num num_sides := 6;
CONST num side_length := 300; ! Adjust this value to control the size of the hexagon
PROC main()
! Define the starting position (Change the values according to your robot setup)
start_pos := [[100, 0, 0], [0, 0, 0]];
! Set the number of sides for the hexagon
sides := num_sides;
! Move to the starting position
MoveJ start_pos, v100, fine, tool0;
! Loop to draw the hexagon
FOR i FROM 1 TO sides DO
! Calculate the target position for the next point on the hexagon
target_pos := CalcNextPoint(start_pos, i, side_length);
! Move to the target position
MoveL target_pos, v100, fine, tool0;
ENDFOR
! Move back to the starting position to complete the shape
MoveL start_pos, v100, fine, tool0;
ENDPROC
PROC CalcNextPoint(robtarget start, num side_num, num side_length)
! Calculate the angle for each side of the hexagon
CONST num angle_increment := 360 / num_sides;
! Calculate the angle for the current side
VAR num angle := angle_increment * side_num;
! Calculate the target position coordinates based on the side length and angle
VAR num x_target := start.pos.x + side_length * cos(angle * (pi/180));
VAR num y_target := start.pos.y + side_length * sin(angle * (pi/180));
VAR num z_target := start.pos.z; ! Set the same z-coordinate to keep the hexagon flat
! Create a new target position variable
VAR robtarget target;
target.pos := [x_target, y_target, z_target];
target.orient := start.orient; ! Keep the same orientation as the starting position
RETURN target;
ENDPROC
ENDMODULE