You are correct in observing, that a MoveL command will always use the “shortest route” to the given pose.
You could consider using MoveJ, as this will move to the specified unique joint positions, and not the pose given.
If you have a pose, that you would like to convert to a unique set of joint positions, the script code get_inverse_kin()
can be used, while specifying the qnear
parameter.
You can also use the is_within_safety_limits()
script code, which will return whether a position is within the safety limits. If the parameter given is a joint vector, the joint position limits are also taken into account, which I believe is what you are aiming for.
Combining get_inverse_kin()
and is_within_safety_limits()
could perform the check that you mention above.