1001101_QIA 2022-05-12 18:32 采纳率: 94.1%
浏览 116
已结题

rostopic中为什么不显示我发布的话题

<robot name="my_car_move" xmlns:xacro="http://wiki.ros.org/xacro">

    <!-- 传动实现:用于连接控制器与关节 -->
    <xacro:macro name="joint_trans" params="joint_name">
        <!-- Transmission is important to link the joints and the controller -->
        <transmission name="${joint_name}_trans">
            <type>transmission_interface/SimpleTransmission</type>
            <joint name="${joint_name}">
                <hardwareInterface>hardware_interface/VelocityJointInterface</hardwareInterface>
            </joint>
            <actuator name="${joint_name}_motor">
                <hardwareInterface>hardware_interface/VelocityJointInterface</hardwareInterface>
                <mechanicalReduction>1</mechanicalReduction>
            </actuator>
        </transmission>
    </xacro:macro>

    <!-- 每一个驱动轮都需要配置传动装置 -->
    <xacro:joint_trans joint_name="left2link" />
    <xacro:joint_trans joint_name="right2link" />

    <!-- 控制器 -->
    <gazebo>
        <plugin name="differential_drive_controller" filename="../opt/ros/melodic/lib/libgazebo_ros_diff_drive.so">
            <rosDebugLevel>Debug</rosDebugLevel>
            <publishWheelTF>true</publishWheelTF>
            <robotNamespace>/</robotNamespace>
            <publishTf>1</publishTf>
            <publishOdomTF>true</publishOdomTF>
            <publishWheelJointState>true</publishWheelJointState>
            <alwaysOn>true</alwaysOn>
            <updateRate>100.0</updateRate>
            <legacyMode>true</legacyMode>
            <leftJoint>left2link</leftJoint> <!-- 左轮 -->
            <rightJoint>right2link</rightJoint> <!-- 右轮 -->
            <wheelSeparation>${base_link_radius * 2}</wheelSeparation> <!-- 车轮间距 -->
            <wheelDiameter>${wheel_radius * 2}</wheelDiameter> <!-- 车轮直径 -->
            <broadcastTF>1</broadcastTF>
            <wheelTorque>30</wheelTorque>
            <wheelAcceleration>1.8</wheelAcceleration>
            <commandTopic>cmd_vel</commandTopic> <!-- 运动控制话题 -->
            <odometryFrame>odom</odometryFrame> 
            <odometryTopic>odom</odometryTopic> <!-- 里程计话题 -->
            <robotBaseFrame>base_footprint</robotBaseFrame> <!-- 根坐标系 -->
          
            <odometrySource>world</odometrySource> <!-- 'encoder' instead of 'world' is also possible -->

        </plugin>
    </gazebo>

</robot>



<xacro:property name="PI" value="3.1415926"/>

<material name="black">
    <color rgba="0.0 0.0 0.0 1.0" />
</material>

<xacro:property name="base_footprint_radius" value="0.001" /> <!-- base_footprint  -->
<xacro:property name="base_link_radius" value="0.1" /> <!-- base_link  -->
<xacro:property name="base_link_length" value="0.08" /> <!-- base_link  -->
    <xacro:property name="base_link_mass" value="2" /> <!-- base_link  -->
<xacro:property name="earth_space" value="0.015" /> <!-- lidijianju -->

<!-- dipan -->
<link name="base_footprint">
  <visual>
    <geometry>
      <sphere radius="${base_footprint_radius}" />
    </geometry>
  </visual>
</link>

<link name="base_link">
  <visual>
    <geometry>
      <cylinder radius="${base_link_radius}" length="${base_link_length}" />
    </geometry>
    <origin xyz="0 0 0" rpy="0 0 0" />
    <material name="yellow">
      <color rgba="0.5 0.3 0.0 0.5" />
    </material>
  </visual>

  <collision>
    <geometry>
      <cylinder radius="${base_link_radius}" length="${base_link_length}" />
    </geometry>
    <origin xyz="0 0 0" rpy="0 0 0" />
  </collision>

  <xacro:cylinder_inertial_matrix   m= "${base_link_mass}"  r= "${base_link_radius}"  h = "${base_link_length}"   />
</link>

<gazebo reference = "base_link">
  <material>Gazebo/Yellow</material>
</gazebo>

<joint name="base_link2base_footprint" type="fixed">
  <parent link="base_footprint" />
  <child link="base_link" />
  <origin xyz="0 0 ${earth_space + base_link_length / 2 }" />
</joint>

<!-- qudonglun -->

<xacro:property name="wheel_radius" value="0.0325" /><!-- -->
<xacro:property name="wheel_length" value="0.015" /><!-- -->
<xacro:property name="wheel_mass" value="0.05" /><!-- -->
<xacro:macro name="add_wheels" params="wheel_name  flag">
  <link name="${wheel_name}_wheel">
    <visual>
      <geometry>
        <cylinder radius="${wheel_radius}" length="${wheel_length}" />
      </geometry>
      <origin xyz="0.0 0.0 0.0" rpy="${PI / 2} 0.0 0.0" />
      <material name="black" />
    </visual>
    <collosion>
        <geometry>
        <cylinder radius="${wheel_radius}" length="${wheel_length}" />
      </geometry>
      <origin xyz="0.0 0.0 0.0" rpy="${PI / 2} 0.0 0.0" />      
    </collosion>
     <xacro:cylinder_inertial_matrix   m= "${wheel_mass}"  r= "${wheel_radius}"  h = "${wheel_length}"   />
  </link>
  <gazebo reference = "${wheel_name}_wheel">
    <material>Gazebo/Red</material>
  </gazebo>

  <joint name="${wheel_name}2link" type="continuous">
    <parent link="base_link" />
    <child link="${wheel_name}_wheel" />
    <origin xyz="0 ${flag * base_link_radius} ${-(earth_space + base_link_length / 2 - wheel_radius) }" />
    <axis xyz="0 1 0" />
  </joint>
</xacro:macro>
<xacro:add_wheels wheel_name="left" flag="1" />
<xacro:add_wheels wheel_name="right" flag="-1" />
<!-- zhichenglun -->
<xacro:property name="support_wheel_radius" value="0.0075" />
<xacro:property name="support_wheel_mass" value="0.0100" />
<xacro:macro name="add_support_wheel" params="name flag" >
  <link name="${name}_wheel">
    <visual>
        <geometry>
            <sphere radius="${support_wheel_radius}" />
        </geometry>
        <origin xyz="0 0 0" rpy="0 0 0" />
        <material name="black" />
    </visual>

    <collision>
    <geometry>
            <sphere radius="${support_wheel_radius}" />
        </geometry>
        <origin xyz="0 0 0" rpy="0 0 0" />
    </collision>
    
    <xacro:sphere_inertial_matrix   m = "${support_wheel_mass}"    r = "${support_wheel_radius}"  />
  </link>

  <gazebo reference="${name}_wheel">
    <material>Gazebo/Black</material>
  </gazebo>

  <joint name="${name}_wheel2base_link" type="continuous">
      <parent link="base_link" />
      <child link="${name}_wheel" />
      <origin xyz="${flag * (base_link_radius - support_wheel_radius)} 0 ${-(base_link_length / 2 + earth_space / 2)}" />
      <axis xyz="1 1 1" />
  </joint>
</xacro:macro>

<xacro:add_support_wheel name="front" flag="1" />
<xacro:add_support_wheel name="back" flag="-1" />


  • 写回答

2条回答 默认 最新

  • 溪风沐雪 2022-05-12 18:40
    关注

    只看到一个配置文件,你怎么运行的?

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

问题事件

  • 系统已结题 5月22日
  • 已采纳回答 5月14日
  • 修改了问题 5月13日
  • 创建了问题 5月12日

悬赏问题

  • ¥15 下图接收小电路,谁知道原理
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度
  • ¥30 关于#r语言#的问题:如何对R语言中mfgarch包中构建的garch-midas模型进行样本内长期波动率预测和样本外长期波动率预测
  • ¥15 ETLCloud 处理json多层级问题
  • ¥15 matlab中使用gurobi时报错
  • ¥15 这个主板怎么能扩出一两个sata口
  • ¥15 不是,这到底错哪儿了😭
  • ¥15 2020长安杯与连接网探