Forum Migration Notice
We're transitioning to a more modern community platform by the end of this year. Learn about the upcoming changes and what to expect.
Robot studio isn't telling me where my syntax errors are
I'm working on some code in Rapid, but RobotStudio doesn't tell where or why my code doesn't work.
I think the line below might be the problem.
checkpoint := IsReachable(point, printhead, wobj0);
I'm not sure how to fix it
Below is the rest of the code
MODULE MainModule
I think the line below might be the problem.
checkpoint := IsReachable(point, printhead, wobj0);
I'm not sure how to fix it
Below is the rest of the code
MODULE MainModule
! (name), started 11 27 2018
! This code read a file of eight positions per set and checks if the robot can reach each set
! This done for a workspace analysis
VAR iodev reader;
VAR iodev writer;
VAR pos corner;
VAR string word;
VAR bool check;
VAR bool checkpoint;
VAR robtarget point;
PERS tooldata printhead := [ TRUE, [[ 85.22, 0, 79.57], [0.707170, 0, 0.707170, 0]], [0.79496, [16.02,9.4,44.26], [1, 0, 0, 0], 0, 0, 0]];
! This function is from msalminen on the ABB forums
FUNC bool IsReachable(robtarget pReach, PERS tooldata ToolReach, PERS wobjdata WobjReach)
! Check if specified robtarget can be reach with given tool and wobj.
!
! Output:
! Return TRUE if given robtarget is reachable with given tool and wobj
! otherwise return FALSE
!
! Parameters:
! pReach - robtarget to be checked, if robot can reach this robtarget
! ToolReach - tooldata to be used for possible movement
! WobjReach - wobjdata to be used for possible movement
VAR bool bReachable;
VAR jointtarget jntReach;
bReachable := TRUE;
jntReach := CalcJointT(pReach, ToolReach\Wobj:=WobjReach);
RETURN bReachable;
ERROR
IF ERRNO = ERR_ROBLIMIT THEN
bReachable := FALSE;
TRYNEXT;
ENDIF
ENDFUNC
PROC main()
Open "U:/RAMSeniorDesign/RobotStudio Stations/Workspace/ReadTest1.txt", reader \Read;
Rewind reader;
Open "U:/RAMSeniorDesign/RobotStudio Stations/Workspace/ReadTest1b.txt", writer \Append;
word := ReadStr(reader);
check := StrToVal(word,corner);
point := [ [ corner.x, corner.y, corner.z], [0.707170, 0, 0.707170, 0], [0,0,0,0], [ 9E9, 9E9, 9E9, 9E9, 9E9, 9E9]];
checkpoint := IsReachable(point, printhead, wobj0);
Write writer, ""\Pos:=corner;
Write writer, ""\Bool:=checkpoint;
Close reader;
Close writer;
ENDPROC
ENDMODULE
0
Comments
-
Hello,I've test your code, all works fine...I've this text on ReadTest1.txt:
[200,0,0]<br>
Can you give us your error text?PS: When you paste code on post, use Code format (in pilcrow down list).
☑️2024 - RobotStudio® User Group0 -
Funnily enough the code started working the next day. I don't know why it didn't work before0
Categories
- All Categories
- 5.6K RobotStudio
- 401 UpFeed
- 21 Tutorials
- 16 RobotApps
- 306 PowerPacs
- 407 RobotStudio S4
- 1.8K Developer Tools
- 250 ScreenMaker
- 2.9K Robot Controller
- 365 IRC5
- 86 OmniCore
- 8 RCS (Realistic Controller Simulation)
- 854 RAPID Programming
- 37 AppStudio
- 4 RobotStudio AR Viewer
- 19 Wizard Easy Programming
- 111 Collaborative Robots
- 5 Job listings