2

我知道已经有很多关于这个特定错误的问题,但我发现没有一个问题为我解决了这个问题......

我正在尝试为凉亭中的两轮机器人实现 ROS 差动驱动控制器,但是在启动控制器生成器时,我得到以下输出:

[INFO] [1585302057.569863, 0.000000]: Controller Spawner: Waiting for service controller_manager/load_controller
[WARN] [1585302087.735023, 40.162000]: Controller Spawner couldn't find the expected controller_manager ROS interface.

事实上,试图列出 controller_manager 服务没有输出:

$ rosservice list | grep controller_manager
$

我在 Ubuntu 18.04 上运行 ros melodic。

这是我的配置文件diff_drive.yaml

wheelchair_controler:
  type        : "diff_drive_controller/DiffDriveController"
  left_wheel  : 'left_wheel_motor'
  right_wheel : 'right_wheel_motor'
  publish_rate: 50.0               # default: 50
  pose_covariance_diagonal : [0.001, 0.001, 1000000.0, 1000000.0, 1000000.0, 1000.0]
  twist_covariance_diagonal: [0.001, 0.001, 1000000.0, 1000000.0, 1000000.0, 1000.0]

  # Wheel separation and diameter. These are both optional.
  # diff_drive_controller will attempt to read either one or both from the
  # URDF if not specified as a parameter
  wheel_separation : 0.52
  wheel_radius : 0.3048

  # Wheel separation and radius multipliers
  wheel_separation_multiplier: 1.0 # default: 1.0
  wheel_radius_multiplier    : 1.0 # default: 1.0

  # Velocity commands timeout [s], default 0.5
  cmd_vel_timeout: 0.25

  # Base frame_id
  base_frame_id: base_link #default: base_link

  # Velocity and acceleration limits
  # Whenever a min_* is unspecified, default to -max_*
  linear:
    x:
      has_velocity_limits    : true
      max_velocity           : 1.0  # m/s
      min_velocity           : -0.5 # m/s
      has_acceleration_limits: true
      max_acceleration       : 0.8  # m/s^2
      min_acceleration       : -0.4 # m/s^2
      has_jerk_limits        : true
      max_jerk               : 5.0  # m/s^3
  angular:
    z:
      has_velocity_limits    : true
      max_velocity           : 1.7  # rad/s
      has_acceleration_limits: true
      max_acceleration       : 1.5  # rad/s^2
      has_jerk_limits        : true
      max_jerk               : 2.5  # rad/s^3

这是启动文件。我尝试将生成器放在单独的启动文件中,以确保凉亭增加正确启动的时间。

<?xml version="1.0"?>
<launch>

  <!-- Controllers -->
  <rosparam file="$(find wheelchair_simulation)/config/diff_drive.yaml" command="load" />
  <node name="wheelchair_controller_spawner" pkg="controller_manager" type="spawner" respawn="false" output="screen" args="wheelchair_controler" />


</launch>

在我的.xacro文件中,我使用一个宏来定义我的轮子、关节和凉亭标签。我还在其中添加了一个传输:

<xacro:macro name="main_wheel" params="prefix reflect">
    <link name="main_${prefix}_wheel">
      <visual>
        <geometry>
          <cylinder length="${main_wheel_length}" radius="${main_wheel_radius}"/>
        </geometry>
        <material name="black"/>
      </visual>
      <collision>
        <geometry>
          <cylinder length="${main_wheel_length}" radius="${main_wheel_radius}"/>
        </geometry>
      </collision>
      <inertial>
        <xacro:cylinder_inertia length="${main_wheel_length}" radius="${main_wheel_radius}" weight="${main_wheel_mass}"/>
      </inertial>
    </link>

    <joint name="${prefix}_wheel_motor" type="continuous">
      <axis xyz="0 0 1"/>
      <parent link="base_link"/>
      <child link="main_${prefix}_wheel"/>
      <origin rpy="${-reflect*1.5708} 0 0" xyz="0 ${reflect*((total_width - main_wheel_length)/2 + 0.001)} 0"/>
      <gazebo>
        <implicitSpringDamper>true</implicitSpringDamper>
      </gazebo>
      <dynamic friction="0.1"/>
    </joint>

    <transmission name="${prefix}_wheel_transmission">
      <type>transmission_interface/SimpleTransmission</type>
      <joint name="${prefix}_wheel_motor">
        <hardwareInterface>hardware_interface/VelocityJointInterface</hardwareInterface>
      </joint>
      <actuator name="${prefix}_wheel_motor">
        <mechanicalReduction>1</mechanicalReduction>
        <hardwareInterface>VelocityJointInterface</hardwareInterface>
      </actuator>
    </transmission>

    <gazebo reference="main_${prefix}_wheel">
      <mu1>0.8</mu1>
        <mu2>0.8</mu2>
      <turnGravityOff>false</turnGravityOff>
      <material>Gazebo/Black</material>
    </gazebo >
  </xacro:macro>

我确保安装gazebo_ros_controle

$ sudo apt-get install ros-melodic-gazebo-ros-controle

并将其链接到我的描述文件中:

<gazebo>
        <plugin name="gazebo_ros_control" filename="libgazebo_ros_contol.so">
        </plugin>
</gazebo>

最后,我检查了依赖项,一切看起来都不错:

$ rosdep check controller_manager
All system dependencies have been satisified

编辑:我添加了 base_link 和 base_footprint 链接的描述,以防我在某处看到控制器的框架必须具有惯性

<!-- Dummy link because first link should not have any inertia. Located on the ground between both wheels for easier control -->

  <link name="base_footprint"/>

<!-- Footprint and main inertia of the chair -->

  <link name="base_link">
    <visual>
      <geometry>
        <box size="${total_length} ${total_width} ${seat_height - ground_clearence}"/>
      </geometry>
      <origin xyz="${-main_wheel_radius + total_length/2} 0 ${a}"/>
      <material name="white"/>
    </visual>
    <collision>
      <geometry>
        <box size="${total_length} ${total_width} ${seat_height - ground_clearence}"/>
      </geometry>
      <origin xyz="${-main_wheel_radius + total_length/2} 0 ${a+0.1}"/>
    </collision>
    <inertial>
      <xacro:box_inertia height="${seat_height - ground_clearence}" length="${total_length}" width="${total_width}" weight="${total_mass-2*main_wheel_mass}"/>
    </inertial>
  </link>

  <joint name="base_link_joint" type="fixed">
    <parent link="base_footprint"/>
    <child link="base_link"/>
    <origin xyz="${-total_length/2 + main_wheel_radius} 0 ${main_wheel_radius}"/>
  </joint>

我真诚地希望你们中的一些人能找到这个问题,因为我不知道它来自哪里......随时询问任何遗漏的细节。

先感谢您 !!

4

2 回答 2

0

请检查凉亭日志。如果urdf/xacro文件有问题,gazebo不会初始化机器人仿真界面,也不会启动gazebo_ros_control插件。

这里有一个例子。一旦我更正了 urdf 文件,控制器就会加载并且不再出现此错误。

[ INFO] [1598502340.159974962]: waitForService: Service [/gazebo/set_physics_properties] is now available.
[ INFO] [1598502340.212629654]: Physics dynamic reconfigure ready.

[ INFO] [1598502340.568106895]: Loading gazebo_ros_control plugin

[ INFO] [1598502340.568395067]: Starting gazebo_ros_control plugin in namespace: /plotter

[ INFO] [1598502340.569824694]: gazebo_ros_control plugin is waiting for model URDF in parameter [/robot_description] on the ROS param server.

[ERROR] [1598502340.698456387]: This robot has a joint named "link_00__link_01" which is not in the gazebo model.

[FATAL] [1598502340.698639178]: Could not initialize robot simulation interface

正如您在最后两行中看到的那样,凉亭还没有完成。

于 2020-08-27T06:03:25.313 回答
0

对于遇到此问题的任何人,对我们而言,问题是model.sdf凉亭.world文件中包含的文件之一丢失并导致此错误。

于 2021-11-05T12:41:36.390 回答