Joint torques for a simulated UR3e robot

asked 2020-05-25 06:31:01 -0500

dimitri gravatar image

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

edit retag flag offensive close merge delete

Comments

The robot controller is set to effort_controllers?

Teo Cardoso gravatar image Teo Cardoso  ( 2020-05-25 12:51:46 -0500 )edit

Honestly I don't know. I think its position controlled. How do I check/set that?

dimitri gravatar image dimitri  ( 2020-05-25 14:25:24 -0500 )edit

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.

Teo Cardoso gravatar image Teo Cardoso  ( 2020-05-25 16:58:19 -0500 )edit

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):

arm_controller:
  type: position_controllers/JointTrajectoryController
  joints:
     - shoulder_pan_joint
     - shoulder_lift_joint
     - elbow_joint
     - wrist_1_joint
     - wrist_2_joint
     - wrist_3_joint
  constraints:
[...]
  stop_trajectory_duration: 0.5
  state_publish_rate:  25
  action_monitor_rate: 10
joint_group_position_controller:
  type: position_controllers/JointGroupPositionController
  joints:
     - shoulder_pan_joint
     - shoulder_lift_joint
     - elbow_joint
     - wrist_1_joint
     - wrist_2_joint
     - wrist_3_joint

Do I need to change the controller here?

dimitri gravatar image dimitri  ( 2020-05-26 03:33:53 -0500 )edit

You need change there too. However, it needs to change in the xacro file yet.

Teo Cardoso gravatar image Teo Cardoso  ( 2020-05-26 08:09:54 -0500 )edit

Ok. Because the file you mentioned above (ur3_robot.urdf.xacro) looks like this>

<?xml version="1.0"?>
<robot xmlns:xacro="http://wiki.ros.org/xacro"
       name="ur3" >

  <xacro:arg name="transmission_hw_interface" default="hardware_interface/PositionJointInterface"/>

  <!-- common stuff -->
  <xacro:include filename="$(find ur_description)/urdf/common.gazebo.xacro" />

  <!-- ur3 -->
  <xacro:include filename="$(find ur_description)/urdf/ur3.urdf.xacro" />

  <!-- arm -->
  <xacro:ur3_robot prefix="" joint_limited="false"
    transmission_hw_interface="$(arg transmission_hw_interface)"
  />

  <link name="world" />

  <joint name="world_joint" type="fixed">
    <parent link="world" />
    <child link = "base_link" />
    <origin xyz="0.0 0.0 0.0" rpy="0.0 0.0 0.0" />
  </joint>

</robot>

Where exactly would I need to put in the effort controller?

dimitri gravatar image dimitri  ( 2020-05-26 09:15:44 -0500 )edit

From: <xacro:arg name="transmission_hw_interface" default="hardware_interface/PositionJointInterface"/>

To: <xacro:arg name="transmission_hw_interface" default="hardware_interface/EffortJointInterface"/>

and on your yaml file:

  type: **position_controllers**/JointTrajectoryController
  type: **effort_controllers**/JointTrajectoryController

  type: **position_controllers**/JointGroupPositionController
  type: **effort_controllers**/JointGroupPositionController

I never tried this before. However, it makes sense.

Teo Cardoso gravatar image Teo Cardoso  ( 2020-05-26 12:53:24 -0500 )edit

Ok i did as you said. I get the following error:

[ERROR] [1590516223.569938532, 0.247000000]: Exception thrown: Could not find resource 'shoulder_pan_joint' in 'hardware_interface::EffortJointInterface'.
[ERROR] [1590516223.570058650, 0.247000000]: Failed to initialize the controller
[ERROR] [1590516223.570113416, 0.247000000]: Initializing controller 'joint_group_position_controller' failed

and

[ERROR] [1590516223.807461567, 0.392000000]: Could not find joint 'shoulder_pan_joint' in 'hardware_interface::EffortJointInterface'.
[ERROR] [1590516223.807695648, 0.392000000]: Failed to initialize the controller
[ERROR] [1590516223.807882994, 0.393000000]: Initializing controller 'arm_controller' failed
Error when loading 'arm_controller'
[ERROR] [1590516223.813253582, 0.397000000]: Could not start controller with name 'arm_controller' because no controller with this name exists

any ideas?

dimitri gravatar image dimitri  ( 2020-05-26 13:14:43 -0500 )edit