Big difference between simulated robot and real robot (ros_control, position & velocity controllers)
Hello! I've been working with an UR5e robot arm these past few weeks and I've tried to control it using ROS. I'm using the ur_robot_driver to connect to my robot arm. Currently, I'm trying to test out a few movements using the /joint_group_vel_controller/command
topic (and yes, I've switched to the said controller using rosservice). The real robot is positioned just like the one in the gazebo from the picture below (only with a few millimeters difference, but basically the same values).
As I was connecting to the robot I received this notification:
[ERROR] [1631004560.884070577]: The calibration parameters of the connected robot don't match the ones from the given kinematics config file. Please be aware that this can lead to critical inaccuracies of tcp positions. Use the ur_calibration tool to extract the correct calibration from the robot and pass that into the description. See [https://github.com/UniversalRobots/Universal_Robots_ROS_Driver#extract-calibration-information] for details.
So I ran rostopic echo /joint_states
the first time I've connected to the robot to check the position and the values were approximate to the ones in the picture, meaning that it read the position correctly. But once I ran the command with the values I used in gazebo, I was expecting to only get a small amount of movement (as the values are still a bit off from the real position of the robot). Instead, the whole robot arm moved in an completely unexpected position, far from the expected values.
Next, I disconnected from the robot, and used the calibration_correction to create a calibration file (I've pasted the contents of the said file in this pastebin: https://pastebin.com/z4Jv4Gec) and then used that file as the kinematics file when I launched the driver again, but this time when I ran rostopic echo /joint_states
I got values that were way different than what they should have been:
---
header:
seq: 34396
stamp:
secs: 1631003512
nsecs: 161211710
frame_id: ''
name:
- elbow_joint
- shoulder_lift_joint
- shoulder_pan_joint
- wrist_1_joint
- wrist_2_joint
- wrist_3_joint
position: [-6.643843516940251e-05, -1.5709220371642054, -0.000134770070211232, -1.5709978542723597, 6.315350765362382e-05, -0.00014382997621709137]
velocity: [-0.0, 0.0, 0.0, -0.0, 0.0, 0.0]
effort: [0.13641898334026337, -0.10197316110134125, -0.007954925298690796, -0.039881058037281036, -0.02918042428791523, 0.012054499238729477]
---
header:
seq: 34397
stamp:
secs: 1631003512
nsecs: 163216999
frame_id: ''
name:
- elbow_joint
- shoulder_lift_joint
- shoulder_pan_joint
- wrist_1_joint
- wrist_2_joint
- wrist_3_joint
position: [-5.399739893618971e-05, -1.5709430179991664, -8.184114565068512e-05, -1.5709816418089808, 4.259109846316278e-05, -0.000134770070211232]
velocity: [-0.0, 0.0, 0.0, -0.0, 0.0, 0.0]
effort: [0.10822169482707977, -0.1689099222421646, -0.031928807497024536, -0.04185150936245918, -0.04760636389255524, 0.0033494792878627777]
---
Why are the values for the position so off even if I've done the calibration and why do they keep changing so much (some values go from for example -5.6 to 6.4)?
This
maysound pedantic (edit: it is), but it would be better to only describe what you observe, instead of trying to ask questions about possible causes.What I mean is: your question title is: "UR robot not calibrated correctly?", which implies you've concluded something is wrong with your robot (or at least, you're considering that as a possibility).
In reality, you've observed a difference between the pose and
JointState
of a robot in a simulator and your real robot.There is a possibility calibration influences some aspect here, but it could be something completely different. By posting it as the title of your question, you make it sound like you're only after confirmation of the former.
the screenshot shows the
joint_group_position_controller
, which would also make more sense, seeing your setpoints.Yes, in the gazebo simulation I did use
joint_group_position_controller
as it is similar to thejoint_group_vel_controller
from the real robot. At first I tested in gazebo to see if the setpoints would correspond to those from the real robot and also to test out sending a message to a topic viarostopic pub
which I wanted to use also with the real robot. Then when I tested the command on the real robot (the robot being in the same pose as the one in gazebo) I expected only a small amount of movement since the setpoints are the same, but instead the real robot started tilting completely. That is why I suspect that there's some error in my calibration. Also I didn't really know what title to give to the thread :/.just describe what you observed.
I just changed the title.