How to make a robtarget position dependent from a variable
I have about 10 robtarget positions whose x and y coordinates are all dependent from a which is an input variable so it cannot be constant. My robtarget positions look something like this:
VAR robtarget Target_10:=[[(10*a), (8*a), 0],.....];
VAR robtarget Target_20:=[[(18*a), (10*a), 0],.....];
But the problem is that the values in robtarget positions have to be constant.
So is it somehow possible to make my positions dependent from a?
VAR robtarget Target_10:=[[(10*a), (8*a), 0],.....];
VAR robtarget Target_20:=[[(18*a), (10*a), 0],.....];
But the problem is that the values in robtarget positions have to be constant.
So is it somehow possible to make my positions dependent from a?
Tagged:
0
Answers
-
You can do the following after the variable declarations:
Target_10.trans := [10*a, 8*a, 0];
0 -
You can also use functions if you don't want the robtarget to be changed by operators.
CONST robtarget a:=[[0,0,0],[1,0,0,0],[0,0,0,0],[9E9,9E9,9E9,9E9,9E9,9E9]]; FUNC robtarget Target_10() VAR robtarget ret; ret := a; ret.trans:= [10*a.trans.x, 8*a.trans.y, 0]; RETURN ret; ENDFUNC PROC main() MoveL a,v1000,z50,tool0\WObj:=wobj0; MoveL Target_10(),v1000,z50,tool0\WObj:=wobj0; ENDPROC
Systemintegrator - Web / C# / Rapid / Robotstudio
If I helped, please press Vote Up
☑️2024 - RobotStudio® User Group0 -
Thanks, that's really helpful! I'm gonna try it out later
0 -
@Tompanhuhu If you don't want a position to be modified by anyone at all, do this:
CONST robtarget myRobtarget:=[[471.96,165.24,337.40],[0.147458,0.375124,0.905628,0.131821],[0,0,0,0],[9E+9,9E+9,9E+9,9E+9,9E+9,9E+9]]; CONST robtarget myRobtarget10:=[[360.69,346.35,337.40],[0.116071,0.174066,0.964666,0.16015],[0,0,0,0],[9E+9,9E+9,9E+9,9E+9,9E+9,9E+9]]; CONST robtarget myRobtarget20:=[[328.12,315.08,266.77],[0.0483949,0.176969,0.980755,0.0667735],[0,0,0,0],[9E+9,9E+9,9E+9,9E+9,9E+9,9E+9]]; CONST robtarget pLockDown{3}:=[myRobtarget,myRobtarget10,myRobtarget20];
The controller will report a position modify error, without a clue as to why.Lee Justice0
Categories
- All Categories
- 5.5K RobotStudio
- 396 UpFeed
- 18 Tutorials
- 13 RobotApps
- 297 PowerPacs
- 405 RobotStudio S4
- 1.8K Developer Tools
- 250 ScreenMaker
- 2.8K Robot Controller
- 316 IRC5
- 61 OmniCore
- 7 RCS (Realistic Controller Simulation)
- 798 RAPID Programming
- AppStudio
- 3 RobotStudio AR Viewer
- 18 Wizard Easy Programming
- 105 Collaborative Robots
- 5 Job listings