
robtarget X, Y, Z auf pos schreiben
-
AtoK09 -
May 30, 2022 at 11:01 AM -
Thread is Resolved
-
-
-
-
Code
Display MorePERS robtarget Pos1:=[[120.68520.39600],[0.0814337,0.702221,-0.704655,0.0609565],[0.0,-1.0],[4345.77.9E+9.9E+9.9E+9 .9E+9.9E+9 ]]; PROC Main() TransVal\rt:=Pos1\Trans_X:=120\Trans_Y:=68520\Trans_Z:=39600; END PROC PROC TransVal(\INOUT robtarget rt\num Trans_X\num Trans_Y\num Trans_Z) rt.trans.x:=Trans_X; rt.trans.y:=Trans_Y; rt.trans.y:=Trans_Z; END PROC
-
Code
Display MorePERS robtarget Pos1:=[[120.68520.39600],[0.0814337,0.702221,-0.704655,0.0609565],[0.0,-1.0],[4345.77.9E+9.9E+9.9E+9 .9E+9.9E+9 ]]; PROC Main() TransVal\rt:=Pos1\Trans_X:=120\Trans_Y:=68520\Trans_Z:=39600; END PROC PROC TransVal(\INOUT robtarget rt\num Trans_X\num Trans_Y\num Trans_Z) rt.trans.x:=Trans_X; rt.trans.y:=Trans_Y; rt.trans.y:=Trans_Z; END PROC
Stimmt. Warum einfach wenn es auch umständlich geht.
-
Danke für deinen Beitrag. Dieser ist jedoch an der Frage vorbei. Ich suchte nach einer eleganten Lösung. Der Programmiersklave hat das total richtig beantwortet. Dein Beitrag ist doch das gleiche was ich Eingangs schon schrieb, nur noch unübersichtlicher.
Edith sagt: diese Meldung ist an JMF gerichtet, Roland Keller hat sich einfach dazwischen gedrängelt^^
-
Bei JMF kannst du die Werte manuell eintragen, statt kopieren. War zwar nicht gefragt, hat aber auch eine gewisse Daseinsberechtigung.
-
The OP was looking for a "single liner" type of coding to make it a bit more "elegant".
Simply put, the way the way off p1.X:=p11.trans.x; p1.Y:=p11.trans.y;p1.Z:=p11.trans.z; is three lines of code for one rt. Its elegant as it is and the original way of doing things.
In my example, if you save the TransVal PROC in a System module and make it "NOVIEW", you can use it anywhere and modify each parameter as you like without making the whole program excessively long.
I the end, it is each to their own way of coding Rapid for them and the people working them. I just found it easier to explain to operators in the above way, if they need to change a parameter of a specific robtarget.
Take the following code for example:
rtShaft_1.trans.y:=nY;
rtShaft_1.trans.z:=nZ;
rtShaft_2.trans.y:=nY;
rtShaft_2.trans.z:=nZ;
rtShaft_3.trans.y:=nY;
rtShaft_3.trans.z:=nZ;
rtShaft_4.trans.y:=nY;
rtShaft_4.trans.z:=nZ;
rtShaft_5.trans.y:=nY;
rtShaft_6.trans.z:=nZ;
rtShaft_6.trans.y:=nY;
rtShaft_6.trans.z:=nZ;
Then the same code, just in a more readable and shorter way;
TransVal\rt:=rtShaft_1\Trans_Y:=nY\Trans_Z:=nZ;
TransVal\rt:=rtShaft_2\Trans_Y:=nY\Trans_Z:=nZ;
TransVal\rt:=rtShaft_3\Trans_Y:=nY\Trans_Z:=nZ;
TransVal\rt:=rtShaft_4\Trans_Y:=nY\Trans_Z:=nZ;
TransVal\rt:=rtShaft_5\Trans_Y:=nY\Trans_Z:=nZ;
TransVal\rt:=rtShaft_6\Trans_Y:=nY\Trans_Z:=nZ;
For myself and my operator, this is a lot better and more understanding.
As mentioned, each programmer uses their own way to make it simpler, better, more understandable for them.
-
Yeah, sometimes it's just fun to watch some peoples internal text processor working, just to find out it works completely different from my own. And sometimes it's slightly disturbing to know my own communication interface is incompatible to some humans next to me. JMF's code example is completely unreadable for me due to my brains limitations and could be laboriously interpreted character-wise only.
So, why not.
Der eigentliche Murks am Strukturtyp "robtarget" ist doch, dass er keine "pose" enthält, obwohl er das vom Gefühl her eigentlich müsste. Liegt vermutlich am Alter und Kompatibilitätsbestrebungen und spielt in der gleichen Liga wie KRLs FRAME/POS/E6POS/usw. Austauschbarkeit.
Ist für jeden, der mit mehr oder weniger strikten Datentypen programmieren gelernt hat, ein ständiger Quell der Verwirrung.
-
@JMV There is nothing wrong with your code, it is just not what AtoK09 wanted.
He wants to transfer the X,Y and Z values from a robtarget to a pos.
Your function changes the trans-values of a robtarget.
ABB Roboter Support Forum
Hilfe und Support für ABB Roboter Programmierung, Konfiguration, Inbetriebnahme finden Sie hier im ABB Roboter Forum.
ABB Rapid Programmierung ist einfach, die Roboterforum Community hilft sehr gerne.