Joint torques for a simulated UR3e robot
Hi everyone, I am simulating a UR3e in ROS gazebo and i am trying to get the motor torques of all the joints. When I read out the effort values in the joint_states topic they always remain 0.0, even when the robot is moving. How can I get the joint torques? Kind regards Dimitri
Asked by dimitri on 2020-05-25 06:31:01 UTC
Comments
The robot controller is set to effort_controllers?
Asked by Teo Cardoso on 2020-05-25 12:51:46 UTC
Honestly I don't know. I think its position controlled. How do I check/set that?
Asked by dimitri on 2020-05-25 14:25:24 UTC
Probably it is in line 5, in the file ur3_robot.urdf.xacro. If I'm not say anything wrong, the default controller, is the position. And I believe with this option, there is no feedback on the effort. How ever, with effort controllers you can use the effort/position, which is a controller using effort with input in position, using a feedback loop and PID. And this one, I'm sure that gives you the effort feedback on joint_states topic.
Asked by Teo Cardoso on 2020-05-25 16:58:19 UTC
Thank you. But I did not find any specification of a controller in any of the urdf files. But i did find under /universal_robot/ur_e_gazebo/controller the file arm_controller_ur3e.yaml with the following content (the [...] signifies there was more but it didn't fit in here):
Do I need to change the controller here?
Asked by dimitri on 2020-05-26 03:33:53 UTC
You need change there too. However, it needs to change in the xacro file yet.
Asked by Teo Cardoso on 2020-05-26 08:09:54 UTC
Ok. Because the file you mentioned above (ur3_robot.urdf.xacro) looks like this>
Where exactly would I need to put in the effort controller?
Asked by dimitri on 2020-05-26 09:15:44 UTC
From:
To:
and on your yaml file:
I never tried this before. However, it makes sense.
Asked by Teo Cardoso on 2020-05-26 12:53:24 UTC
Ok i did as you said. I get the following error:
and
any ideas?
Asked by dimitri on 2020-05-26 13:14:43 UTC
ok I also changed the file ur.transmission.xacro and replaced hardwareInterface of all the transmissions fromhardware_interface/PositionJointInterface to hardware_interface/EffortJointInterface
Now i get this error:
Asked by dimitri on 2020-05-26 13:44:57 UTC
and this:
and
Asked by dimitri on 2020-05-26 13:45:51 UTC
Ok after adding PID gains to the file arm_controller_ur3e.yaml it seems to work.
Thanks a lot Teo Cardoso!
Asked by dimitri on 2020-05-26 17:52:03 UTC
See ros-industrial/universal_robot#227 for a PR which implements exactly this.
Asked by gvdhoorn on 2020-05-27 02:50:29 UTC
Thank you gvdhoorn.
The pull request you mentioned only changes the hardware interface, but I guess it is also necessary to set the controllers to be effort_controllers for it to work?
In the pull request conversation you say that there is no joint torque control interface for UR. what I need is just the values of the joint torques, I do not intend to use an effort controller on the real robot. Is this possible?
Asked by dimitri on 2020-05-27 07:34:35 UTC
See UniversalRobots/Universal_Robots_ROS_Driver#160 and the linked UniversalRobots/Universal_Robots_ROS_Driver#146.
Asked by gvdhoorn on 2020-05-27 07:50:36 UTC
Thank you very much! I think that's exactly what I need. I have a question though: How does Universal_Robots_ROS_Driver work together with ros-industrial/universal_robot? I'm sorry I'm a little confused there. Are they complementary or are they different things for the same purpose?
Asked by dimitri on 2020-05-27 09:16:04 UTC
as long as you've noticed that the actual effort is not being published. It's the joint current. Those are related, but not identical.
No drivers other than
ur_robot_driver
(which is hosted atUniversalRobots/Universal_Robots_ROS_Driver
) are supported any more.ur_driver
has never worked for e-Series robots. ur_modern_driver is deprecated, same for wiki/ur_driver.ros-industrial/universal_robot
provides description packages, Gazebo compatibility and MoveIt configurations, but that's it. The driver comes fromUniversalRobots/Universal_Robots_ROS_Driver
.Asked by gvdhoorn on 2020-05-27 09:20:11 UTC
Yes I got that
Sorry i am still not sure if i get it right. So for simulating the robot in gazebo (possibly in connection with moveit) i only need the ros-industrial/universal_robot, if i am working with the real robot on the other hand i need UniversalRobots/Universal_Robots_ROS_Driver ? Or do I need both of them both times? Because in ros-industrial/universal_robot I have a folder called "ur_driver".
Asked by dimitri on 2020-05-27 09:45:15 UTC
What is unclear exactly? I wrote that
ur_driver
is both deprecated (ie: should never be used any more) and has never worked with e-Series robots. So even though you may have that folder, there is nothing there you should use with your real robot.None of the UR drivers are used with simulations.
Asked by gvdhoorn on 2020-05-27 09:53:14 UTC
Ok I think I get it. So as long as I am just working with simulations I can forget about the drivers. And when I start working with the real robot I need the ur_robot_driver and forget about the ros-industrial/universal_robot. Is that correct?
So the efforts from ur_robot_driver are the motor currents, but the efforts from ros-industrial/universal_robot are the "real" torques from the gazebo simulation?
Asked by dimitri on 2020-05-27 10:03:23 UTC
yes.
Not quite: you'd still use
ur_description
and possibly the MoveIt packges (I don't know what you intend to do exactly), but notur_driver
norur_gazebo
.It's actually slightly different, as you'd use a fork of these packages, but that's not important right now. Just make sure to follow the instructions in the readme of
UniversalRobots/Universal_Robots_ROS_Driver
correctly.Yes.
Well, technically, "the efforts in the
JointState
messages coming out of Gazebo when using it withur_gazebo
are the simulated torques from the robot in the simulation".It's important to be precise here.
Asked by gvdhoorn on 2020-05-27 11:23:03 UTC
gvdhoorn you are an angel! Thanks a lot for the quick and patient answers. I think that's all I need for now.
I am not really used to forums like these. Should I put a summarizing answer at the end so people will see it without going through all these comments?
Asked by dimitri on 2020-05-27 11:34:53 UTC
I would say @Teo Cardoso should have posted his comment as an answer, as it really was the answer: you have to change the
hardware_interface
used in the simulated robot model to one which supports effort, otherwise no efforts will be reported.If he can do that, you should accept this answer.
Asked by gvdhoorn on 2020-05-27 11:36:49 UTC