UniversalRobots / Universal_Robots_ROS2_GZ_Simulation

BSD 3-Clause "New" or "Revised" License
20 stars 10 forks source link

force_torque_sensor_broadcaster values are not available #30

Closed jaronski closed 1 month ago

jaronski commented 1 month ago

i tried to look into the force torque sensor simulation. i couldn't find the ur_controller/force_torque_sensor_broadcaster as stated in the config.yaml i downloaded the description and driver pkg from universal robots.

Is there a functional launch example where the force torque sensor broadcaster is utilized and actually publishes the values of the force_torque_sensor from ignition gazebo fortress to ros2 as a geometric wrench msg?

Thanks for any help with the error: [ign-1] [ERROR] [1717421068.852962020] [controller_manager]: Can't activate controller 'ftsensor_broadcaster': State interface with key 'ft_sensor/force.x' does not exist

i am using the force_torque_sensor_broadcaster/ForceTorqueSensorBroadcaster and not the ur_controller/... as i didn't find it in the repos

controller_manager:
  ros_parameters:
  update_rate: 100
  publish_rate: 100
  use_sim_time: True
  ftsensor_broadcaster:
      type: force_torque_sensor_broadcaster/ForceTorqueSensorBroadcaster

/ftsensor_broadcaster:
  ros__parameters:
    interface_names:
      force:
        x: ft_sensor/force.x
        y: ft_sensor/force.y
        z: ft_sensor/force.z 
      torque:
        x: ft_torque_sensor/torque.x
        y: ft_torque_sensor/torque.y
        z: ft_torque_sensor/torque.z

    frame_id: ft_sensor_link
    topic_name: ft_data

here is the part of the relevant urdf description:

    <joint name="ft_sensor_joint" type="fixed">
      <parent link="link_6_clean"/>
      <child link="ft_sensor_link"/>
      <origin xyz="0 0 0" rpy="0 0 0"/>
      <gazebo>
        <provideFeedback>true</provideFeedback>
      </gazebo>
    </joint>

    <ros2_control name="force_torque_sensor" type="sensor">
    <hardware>
      <plugin>force_torque_sensor_broadcaster/ForceTorqueSensorBroadcaster</plugin>
    </hardware>

    <sensor name="ft_sensor">
      <state_interface name="force.x"/>
      <state_interface name="force.y"/>
      <state_interface name="force.z"/>
      <state_interface name="torque.x"/>
      <state_interface name="torque.y"/>
      <state_interface name="torque.z"/>
      <param name="frame_id">sensor_frame</param>
    </sensor>
  </ros2_control>

Thanks for any hints or tips

VinDp commented 1 month ago

Hi @jaronski, to our current knowledge, gazebo ignition still doesn't provide that kind of information from the simulation. If you have any sources saying the opposite, then feel free to reopen.

jaronski commented 3 weeks ago

@VinDP thanks for your response. As far as i can tell there is a force torque sensor in the ignition fortress (gazebo) version. https://github.com/gazebosim/gz-sensors/issues/25. The "workaround" is to add the ftsensor inside of the "world.sdf" that i launch.

<!-- FT Plugin -->
    <plugin filename="ignition-gazebo-forcetorque-system" name="ignition::gazebo::systems::ForceTorque">
      <sensor name="tcp_fts_sensor"/>
    </plugin>

I am able to get values from the sensor inside ignition with ign topic -e -t /topic_name (in my case a very long name) when launching ros_gz_bridge parameter_bridge i am also able to see the values in a ros2 topic.

so as i looked into your repos, i have seen that in your config.yaml you defined a ur_controller/force_torque_sensor_broadcaster which i couldn't find an implementation so this is why i asked here.

I also tried to setup my environment to work with gazebo classic ros2_control and ros2 humble and the "old" ft sensor but also no success.

I also tried to debug the force_torque_sensor_broadcaster but i couldn't find the part where the urdf is checked for the defined state_interfaces always resulting in the error:

[ign-1] [ERROR] [1717421068.852962020] [controller_manager]: Can't activate controller 'ftsensor_broadcaster': State interface with key 'ft_sensor/force.x' does not exist
fmauch commented 3 weeks ago

@jaronski thanks for providing the insight. For this to work as the rest of this simulation it would have to be integrated into gz_ros2_control. As far as I can see, however, only IMU sensors are supported in gz_ros2_control.

Only then it would be possible to inject this into the ros2_control ecosystem with the ftsensor_broadcaster. See https://github.com/ros-controls/gz_ros2_control/issues/170 as the related upstream issue.

jaronski commented 3 weeks ago

thanks @fmauch for your fast response. I didn't check the gz_ros2_control implementation :( i could have saved a lot of time anyway thanks for providing the feedback