c++ - 将凉亭主题发布到rostopic

标签 c++ ros gazebo-simu

我正在将Gazebo和ROS用于机器人模型。我刚刚在机器人的关节上添加了力/扭矩传感器。来自该传感器的数据将发布到gz主题"/gazebo/myworld/snakebot/joint_0${num}/sensor_02${num}/wrench"。我的关节和传感器描述如下:

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

我可以从终端查看该主题的内容,但是我希望从ROS订阅该主题。有什么方法可以将数据从凉亭重新发布到ROS?

(我也尝试使用ft_sensor插件并设法从ROS订阅了它的主题,但是值始终为零...)

非常感谢您的任何帮助:)谢谢!

最佳答案

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.



您可以尝试修改:https://github.com/wonwon0/gazebo_contact_republisher

关于c++ - 将凉亭主题发布到rostopic,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60752786/

相关文章:

c++ - 为项目构建大型库时的最佳实践

c++ - ROS下使用CMakeList编译OpenCV

c++ - 我是否需要 1 个读者和 1 个作者的互斥锁,我不介意丢失一些写入?

c++ - 使用 rosdep install rviz 并得到错误 : Missing resource rviz

Python 将排序列表转换为字典,Google Colab 和 Pycharm 中的差异

ubuntu - 找不到 ROS 包

C++继承维度计算器程序错误: "function call missing argument list"

c++ - 0's coming out as -85993460 instead of 0' 的数组

c++ - 用构造函数初始化一个n维 vector 不好吗?