Hey Wiggi.. Yeah the problem you had was possibly because a lot of the time I assume that people will sent a register that is setup as an integer.. But sometimes those registers can turn into pesky floats if you aren't careful.
You can check it on the routine:
data_type indicates the data type for the parameter, as follows:
1 : INTEGER
2: REAL
3: STRING
To make the code more robust you should probably change it to this
GET_TPE_PRM(3, data_type, Int_value, real_value, str_value, result)
IF data_type = 2 THEN
UF_Number = ROUND(real_value)
ELSE
UF_Number = int_value
ENDIF
But again your way is fine as long as you have the right frames active when you call the function.
I'm afraid I don't know about the frame 0. Seems strange that it wouldn't work. I would suggest you just pick a random empty frame and use that instead.
CPh
I never really meant this function for other people when I wrote it so actually only spent about 2 hours writing this routine. Hence it doesn't check for any errors etc.
For my application I got it working with the parameters as they were. If I was you though I imagine that you will need to tweak these parameters
POS2JOINT (in_pos, uframe, utool, config_ref, wjnt_cfg, ext_ang, out_jnt, and status).
I would potentially try using a cur_pos call and getting the current config you are in to replace my dummy variable I used.
Also possible that it simply cannot be done. The singularity avoidance deliberately drives around the singularities and doesn't follow the correct path.