Generic calling
McM
✭
Hello everyone, I'm new to RAPID programming and I'm trying to find a way to call different POSES with a generic name.
I have a TEST with several CASES, and for each one I want to call a different POSE to change it's value.
TEST GInputDnum(CodePLC)
case 1:
tpreadnum tpreadnum1," Value";
POSE1.trans.x:= tpreadnum1;
case 2:
tpreadnum tpreadnum1," Value";
POSE1.trans.y:= tpreadnum1;
etc etc
Is there a way to call those poses in a generic way? Something like this:
tpreadnum tpreadnum1," Value";
POSE(CASE).trans.(Coord_selection):= tpreadnum1;
0
Comments
-
Not sure if this is the function you´re looking for...but maybe you could do something like this:!Array of your posePERS pose My_pose_Array{20};PERS pose New_Pose;FUNC pose Get_Pose(dnum PoseCase\num x\num y\num z)VAR pose PoseTemp;PoseTemp:=My_pose_Array{PoseCase};!IF present(x) PoseTemp.trans.x:=x;IF present(y) PoseTemp.trans.x:=y;IF present(z) PoseTemp.trans.x:=z;!RETURN PoseTemp;!ENDFUNCPROC MyProc()VAR dnum CodePLC;VAR num tpreadnum1;New_Pose:=Get_Pose(CodePLC\x:=tpreadnum1);ENDPROC0
-
Hi,
you can use the instructions GetDataVal and SetDatVal.
Example:
pers pose pse1:=[[33,0,0],[1,0,0,0]];
PROC main()
ChangePose "pse1";
endproc
PROC ChangePose(string PoseDataName)
VAR pose pseTemp;
VAR num nValue;
GetDataVal PoseDataName,pseTemp;
nValue := UINumEntry(\Header:="Value "+PoseDataName\InitValue:=pseTemp.trans.x);
pseTemp.trans.x :=nValue;
SetDataVal PoseDataName,pseTemp;
endproc
/BR
Micky
0 -
Thank you both for your answers.I think what I want to do is an union of what you both said but I suppose it might get confusing.Name of the Num variable I want to change is defined by the text strings of the items in 4 lists (being the text strings in Item_List4 ([[""," X"],[""," Y"],[""," Z"]];)p(Item_List1)(Item_List2)_(Item_List3).trans.(Item_List4):= UIDnumEntry(etc etc);Is this possible to do?Thank you again for your time and answersRegards,MCM0
-
McM said:Thank you both for your answers.I think what I want to do is an union of what you both said but I suppose it might get confusing.Name of the Num variable I want to change is defined by the text strings of the items in 4 lists (being the text strings in Item_List4 ([[""," X"],[""," Y"],[""," Z"]];)p(Item_List1)(Item_List2)_(Item_List3).trans.(Item_List4):= UIDnumEntry(etc etc);Is this possible to do?Thank you again for your time and answersRegards,MCMI would look like this:Const listitem created for each listConst string stringArr created to save the text strings for each listConst num NumSel created to save the number selection for each list.SetDataVal "p"+StringArr_ItemsInList1{NumSel_List1}+StringArr_ItemsInList2{NumSel_List2}+"_"+StringArr_ItemsInList3{NumSel_List3}+".trans."+StringArr_ItemsInList4{NumSel_List4},tpreadnum1;Is this correct?Post edited by McM on0
-
Tried it today with an ABB 2400, working properly but I had to change the ".trans."+stringArr_ItemsInList4{NumSel_List4} because it can't understand the whole thing as a Num Variable.Instead I used a pose as David L suggested.0
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)
- 800 RAPID Programming
- AppStudio
- 3 RobotStudio AR Viewer
- 18 Wizard Easy Programming
- 105 Collaborative Robots
- 5 Job listings