# How to compare UR3 robot model to hardware test positions using inverse kinematics in Robotics Toolbox R2022a?

14 ビュー (過去 30 日間)
MathWorks Support Team 2023 年 1 月 20 日

I have a couple potentially related questions about using the 'inverseKinematics' function to simulate positions of my UR3 robot.
1. The home position (set all joint angles to 0) is different between the Simulink model of the UR3 robot and the physical robot. How do I deal with this difference?
2. When performing inverse kinematics, using the position and orientation of the 'tool0' (end-effector) of the robot and comparing the Simulink model to the physical robot, the position of the 'tool0' matches, but the orientation doesn't. How can I reconcile this difference?
3. I know that using inverse kinematics may result in different joint angles (this robot has 6 joints), that all satisfy the equations and achieve the desired 'tool0' position, so my next step is to use the 'analyticalInverseKinematics' function to add constraints. However, the UR3 robot throws an error when using this function because the type of joints of this robot are not consistent with the function. What are my options from here?

### 採用された回答

MathWorks Support Team 2024 年 4 月 18 日

Generally, the following links should be useful for troubleshooting the robot.
Here is a Support Package that enables connectivity and control of simulated robots:
Also, here is an example that shows you how to use the “inverseKinematicsDesigner.” This allows you to 1) view the positions that you are setting the robot to, 2) adjust solver settings (in the top toolbar), and 3) by opening the “Report Status” window (also in the top toolbar), you can evaluate the status of the IK solution.
Specifically for the questions posed above:
1. The home position (set all joint angles to 0) is different between the Simulink model of the UR3 robot and the physical robot. How can this difference be reconciled?
This difference is due to the difference in how the "Zero" position is defined in the rigid body tree model. Specifically, the base joint in the rigid body tree robot model's "Zero" position and the UR3 hardware's "Zero" position has offset of 180 degrees. Due to this offset, the cartesian position values are inverted.
The solution to this is to manually rotate the base joint by 180 degrees such that the "Zero" position of the rigid body tree model is now aligned with the "Zero" position of the hardware.
A sample code for this fix is as follows:
show(ur3);
tformZYX = eul2tform([pi 0 0]);
setFixedTransform(ur3.Base.Children{1,1}.Joint,tformZYX);
figure;
show(ur3);
Also, here is a discussion on the same issue on the URForum for reference:
2. When performing inverse kinematics, using the position and orientation of the 'tool0' (end-effector) of the robot and comparing the Simulink model to the physical robot, the position of the 'tool0' matches, but the orientation does not. Is there a way to fix this issue?
If the robot model (i.e. the “RigidBodyTree” object) differs from the physical model, then IK will not produce accurate results. Ensuring that the “RigidBodyTree” and physical robot are the same is the first step.
Next, in the reproduction code, the orientation is weighted less than the position:
weights = [0.25 0.25 0.25 1 1 1];
If the user wishes to satisfy both, they should use uniform weights:
weights =  [1 1 1 1 1 1];
Lastly, it is important to check whether the IK succeeds or not. This is done by looking at the second output of the inverse kinematics solver to see whether the solver has succeeded or simply provided the best possible answer. If the solver has simply provided the best possible answer, it may be necessary to tune the solver to get an accurate solution, e.g. by increasing the number of iterations or modifying an appropriate tolerance.
3. If I know that using inverse kinematics may result in different joint angles that all satisfy the equations and achieve the desired 'tool0' position, then my desired next step is to use the 'analyticalInverseKinematics' function to add constraints. However, the UR3 robot throws an error when using this function because the type of joints of this robot are not consistent with requirement of the function. What are my options from here?
Unfortunately, the UR-series robots are not currently supported by our analytical inverse kinematics solvers, which only work for robots that include a 6-DoF chain in which the last three axes intersect at a point (i.e. there is a wrist).
While the UR robots appear to have a wrist, the axes do not intersect at a single point, so the method used to compute analytical inverse kinematics is not applicable. We are aware of the limitation and working to expand the set of supported robots, but that requires some different solution approaches.
This does not mean that you cannot constrain the robot to avoid collisions.  This can be done with two different approaches while using “generalInverseKinematics.” The first is to use a “Cartesian Bounds Constraint,” the example at this link goes through performing this alongside use of the “inverseKinematicsDesigner”:
The second option is to use a “constraintDistanceBounds” which restricts a body within a distance bound from the reference body. This example walks through how to accomplish this:

サインインしてコメントする。

### カテゴリ

Help Center および File ExchangeMobile Robot Modeling についてさらに検索

R2022a

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by