# How can I determine the necessary joint angles given the position of this UR-3 robot?

I'm trying to perform inverse kinematics on this robotic arm with 6 DoF. However, I'm not exactly sure how to start. I know a technique when the last three joints make up a spherical wrist, however, I'm not sure if this robot fits that category. Because Joint 6's and Joint 4's Z-axis are facing the same direction. However, when Joint five moves the end effector 90 degrees CW, then Joint 6's z-axis would be facing into the page, and then it might be considered a spherical wrist.

• Robotics opensource libraries make this task simple. You do not need to write the IK solver from scratch. To help you with that, please let me know if you have experience with URDF and MoveIt. Commented Dec 9, 2023 at 11:28
• Is there a way to do this via Matlab? @Robotawi
– ARJ
Commented Dec 10, 2023 at 21:00
• Yes, @ARJ, I just added an answer considering that. Commented Dec 11, 2023 at 3:40

Here's a paper that includes the derivation of analytical IK solutions for the UR5, but says that the wrist is not spherical.

There's also an implementation of analytical IK here in the ur_kinematics package for ROS 1. There may be a limitation that these IK solutions only work with the nominal kinematic structure of the robot.

The UR robots store an internal factory calibration that describes the as-manufactured kinematics of the physical robot. This can be important for accurate IK solutions. See, for example the ROS 2 package ur_calibration.

I don't know if using the calibrated kinematics breaks some assumptions in the solution process or not. (For example, no real-world as-built robot has strictly parallel axes for the shoulder lift, elbow, and first wrist joint.)

I agree with other answers that I'd use an existing IK package. I've personally found that numerical inverse kinematics solutions are fast enough for anything I've done with UR arms.

If you do need closed-form solutions, you can take a look at the IKFast library. I also came across this library which uses IKFast to find solutions for the UR arms. It looks like the ur_kinematics ROS 1 package can also use an IKFast solution if it's available.

It's pretty uncommon to do this on your own/by hand: there are plenty of libraries that will do this for you. In ROS/ROS 2, the most frequently used is MoveIt, and the ROS-Industrial project maintains a configuration for the UR3 (among others). With that setup, you can follow the regular MoveIt tutorials to calculate and achieve joint trajectories/positions.

Here's the relevant ROS Industrial project, and here is the ROS MoveIt tutorials.

You don't mention ROS in your question so if that's not what you plan to use, you might also be interested in (for example) IKPy: provide a joint configuration and it'll manage the computation for you.

If you're trying to understand the underlying algorithm and how they operate, MoveIt uses OMPL under the hood, which has its own extensive documentation that you can dig into.

• OMPL knows nothing about inverse kinematics. These have to be supplied externally (if used at all, typically you only plan in joint space and use only FK). Commented Dec 10, 2023 at 21:23
• ? @SimonSchmeißer Not sure what you're referring to here. I haven't claimed that OMPL knows about the specific IK of the arm being used, I've said that it provides algorithm implementations for MoveIt (which, per the website, is accurate).
– cst0
Commented Dec 10, 2023 at 23:04

If you are interested in solving the Inverse Kinematics (IK) problem with Matlab, you can use the Inverse Kinematics Designer tool. This tool helps design an IK solver given a model from Matlab's robot library or URDF robot model.

Fortunately, the robot library already includes a model for the UR3 robot included in your question. Look at the examples part to see all the robot models in the library. If you want to use another robot, check the library or start from its URDF model.