Hello,
In a Karel program, I want to get the current TCP position in UFRAME.
I can't simply use the function CURPOS(i,j) since it gives the TCP cartesian position and the coordinates are not the same as in UFRAME..
Can you help me please?
Hello,
In a Karel program, I want to get the current TCP position in UFRAME.
I can't simply use the function CURPOS(i,j) since it gives the TCP cartesian position and the coordinates are not the same as in UFRAME..
Can you help me please?
I believe you need to set $UTOOL and $UFRAME prior to using CURPOS. Otherwise CURPOS will report out in the world frame and at the faceplate.
Alternately you can use the ':' operator to get the position of the TCP expressed in the Frame you want.
ex :
$GROUP[1].$UTOOL = $MOR_GRP[1].$NILPOS
$GROUP[1].$UFRAME = $MOR_GRP[1].$NILPOS
GET_VAR(ENTRY,'*SYSTEM*','$MNUFRAME[1,1]',frame,STATUS)
position = POS(0.0, 0.0, 100.0, 0.0, 0.0, 0.0, C)
tool_in_frm= frame:position
tool_in_frm should have the [0, 0, 100, ...] coordinates calculated in the user frame.
Thank you for your help!
I get the same coordinates with the CURPOS function and with this code..
Before editing your message you wrote something about the utool, now you deleted this line, was it not necessary?
This program seems to work when I check the contents of currentp.
Hi,
is there an option to set der UFRAME back to UFRAME 0 (World KOS).
$GROUP[1].$UFRAME=$MNUFRAME[1,0]
is false.
You do not even need karel for this if you only want to get the coordinates in the CURRENT selected frame.
There are some system variables where you can get this info, just check this ones:
$SV_INFO[1].$CART_POS -> Actual position in the World coordinates.
$SV_INFO[1].$CART_POS_UF -> Actual position in the current selected uframe.
I use the second one a lot while in BG logic in order to capture an orientation when a sensor is triggered, it works pretty well. I suppose you can also use it inside a karel routine if you need to.
Edit: ohh, sorry, I haven't seen this was a necro, but I think it may be usseful for anyone who needs to do this on the future.
$GROUP[1].$UTOOL = $MNUTOOL[1,1] --uTool 1
$GROUP[1].$UFRAME = $MNUFRAME[1,1] --uFrame 1
Adding these two lines to the main code solved my issue. Thank you.
Are you able to change the uframe? if you are insert new line before position and insert UFRAME_NUM=
And after the = add you desired uframe number. After the postion insert another UFRAME_NUM= and add after the equals the other uframe you had on before.
Hope this helps