# Get_inverse_kin closest solution criteria

What is the criteria for the closest solution return by get_inverse_kin ?
Is it the sum of absolute error, the sum of squared error or something else ?

Do you plan to add the get_forward_kin function in URScript ?

There is already a get_forward_kin() method in URScript, use it in almost every program we write. It returns the current position of the robot.

I just did a search of the 3.3 docs and do not see the method in there though so maybe it should be added or maybe itâ€™s deprecated, not sure honestly but I know it works.

In our before start we will do something like

``````global currentPos = get_forward_kin()
movej(currentPos)
``````

Lets us start the program without the user having to use the auto button to send the robot to the first waypoint. We will also develop a homing routine so the the robot can safely get home at the start of the program.

Yes, the get_forward_kin() exist but it do not take arguments, so it is the same as get_current_tcp_pose().
get_forward_kin(q) with q a joint positions is the function I would like to have.

Ah, ok. Thatâ€™s different than the original question you posed. Just out of my own curiosity, how would you plan to use that in actual use on the robot? I understand what it calculates, I just donâ€™t understand when you would use that for motion.

@malacasse
In short, it is the sum of squared error. But it is a bit more complicated than that.

2 Likes

@mbush
Suppose you have a target joint positions q that you would like to offset in cartesian space. With a get_forward_kin(q) function you could call something like pose_trans(get_forward_kin(q), dp ).
Do you think their is a way to do that with actual urscript functions ?

@malacasse

I do not see a clean way to do that with the current URScript, however in reading through the docs, several of the move types use forward kinematics to calculate the move based on being supplied a joint position which tells me that the method exists, UR has just not exposed it to us via script

Not sure if that is something that they could expose in a future release of URScript or not.

Would not hurt to add it to the feature request area of the forum

The function:
`get_forward_kin(q=â€™current_joint_positionsâ€™,tcp=â€™active_tcpâ€™)`
was added to Polyscope version 3.6