atu100
atu100

Reputation: 61

Publishing gazebo topic to rostopic

I am using Gazebo and ROS for a robot model. I just added a force/torque sensor to the joints of my robot. The data from this sensor is published to the gz topic "/gazebo/myworld/snakebot/joint_0${num}/sensor_02${num}/wrench". My joint and sensor descriptions look like this:

<joint name="joint_0${num}" type="continuous">
    <provideFeedback>true</provideFeedback>
    <parent link="body_0${num}"/>
    <child link="body_0${nextNum}"/>
    <origin xyz="${chassisLength/2 + jointOffset} 0 ${chassisHeight/2}" rpy="0 0 0" />
    <axis xyz="0 0 1" rpy="0 0 0" />
    <limit effort="100" velocity="1"/>
    <joint_properties damping="100.0" friction="0.0"/>
</joint>

<!-- Sensor -->
<gazebo reference="joint_0${num}">
  <sensor name="sensor_0${num}" type="force_torque">
    <always_on>true</always_on>
    <update_rate>30</update_rate>
    <force_torque>
      <frame>joint_0${num}</frame>
      <measure_direction>child_to_parent</measure_direction>
    </force_torque>
  </sensor>
</gazebo>

I am able to view the content of this topic from the terminal, but I wish to subscribe to the topic from ROS. Is there any way I can republish the data from Gazebo to ROS?

(I also tried to use the ft_sensor plugin and managed to subscribe to its topic from ROS, but the values were constantly zero...)

Any help is very much appreciated:) Thank you!

Upvotes: 1

Views: 1566

Answers (1)

obviyus
obviyus

Reputation: 144

From this discussion on gazebo-sim

For ros topics to be populated by gazebo there must be some gazebo plugin running, actually publishing some ROS messages. Otherwise, gazebo will be on its own.

You could try modifying: https://github.com/wonwon0/gazebo_contact_republisher

Upvotes: 1

Related Questions