Hi @Peter Abt ,

When you loaded a robot model using `loadrobot`, it created a `rigidBodyTree` object which encapsulated the kinematic and dynamic properties of the robot which includes predefined joint limits, gravity and other characteristics that are not present when you manually defined the robot's kinematics using DH parameters. Also, your DH parameters are defined based on the robot's geometry and do not change with or without loading robot.

After going through loadrobot function defined in link below

https://www.mathworks.com/help/robotics/ref/loadrobot.html

I found out how gravity was defined in rigidBodyTree with properties of your robot, and it indicated the absence of gravity in your model ([0 0 0]) which implied that the calculations were performed in a zero-gravity environment, which really simplifies the kinematic analysis but may not reflect real-world conditions.

%% get robot model

close all

gen3 = loadrobot("kinovaGen3");

disp(gen3);

rigidBodyTree with properties:

NumBodies: 8

Bodies: {1x8 cell}

Base: [1x1 rigidBody]

BodyNames: {1x8 cell}

BaseName: 'base_link'

Gravity: [0 0 0]

DataFormat: 'struct'

Also, it show that dynamic effects are not being considered during calculations when the robot is loaded. So, based on attached results after this time experimenting with your code, it provided the following matrices as follows:

DH Matrix ( H_{DH} )

0.9806 -0.0749 0.1814 -0.5673 0.1771 -0.0603 -0.9823 -0.0830 0.0845 0.9954 -0.0459 0.2077 0 0 0 1.0000

Model Matrix ( H_{mod} )

0.9806 -0.0749 0.1814 -0.5674 0.1771 -0.0603 -0.9823 -0.0810 0.0845 0.9954 -0.0459 0.2075 0 0 0 1.0000

Here is my analysis of the differences mentioned below.

As you will notice that the first three columns of both matrices are identical, indicating that the rotation components are consistent across both methods. This suggests that the orientation of the end effector is accurately represented in both cases. However, the discrepancies found in the last column of the matrices shows H_DH has a value of (-0.5673) and (-0.0830) in the last column while H_mod has values of (-0.5674) and (-0.0810) which you noted and shared with us. After careful analysis, these differences, while seemingly minor, can have significant implications in applications requiring high precision, such as robotic manipulation tasks. Also, this shows that robot's physical constraints might be introducing slight offsets and the `loadrobot` function incorporates additional details about the robot’s geometry that are not captured in your manual DH parameter definitions. So, at this point, to further investigate these discrepancies, try modifying the gravity settings in your `rigidBodyTree` and observe how it affects your forward kinematics results and consider importing a different robot model using URDF or SDF formats to see if this yields different results compared to manually defined DH parameters. Also, utilizing visualization tools within MATLAB to compare positions graphically. This could provide intuitive insights into where and why offsets occur. By understanding these internal workings and exploring the various factors influencing kinematic computations, you can achieve more accurate results aligned with real-world scenarios in robotic applications.

I forgot to address your query about dynamic simulations of joint stiffness since you raised a question about it. While the toolbox does allow for dynamic modeling (e.g., simulating forces due to gravity or inertia), if your model is set to zero gravity, these effects won't be accounted for. If you want to analyze dynamics, consider enabling gravity and observing how it affects your calculations. So, I will suggest import your own robot model to see compare the results by using importrobot function in code below.

https://www.mathworks.com/help/robotics/ref/importrobot.html

I would like @Garmit Pant to share his opinion on this as well. Hope this helps. Please let me know if you have any further questions.