Controller_manager: [ERROR] Controler Spawner не смог найти ожидаемый интерфейс ROS контроллера_manager - PullRequest
2 голосов
/ 27 марта 2020

Я знаю, что уже есть много вопросов по этой конкретной ошибке, но ни один из найденных мною не решил проблему для меня ...

Я пытаюсь реализовать контроллер дифференциального привода 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
$

I ' Я запускаю ros melodi c в Ubuntu 18.04.

Вот мой конфигурационный файл 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>

Я искренне надеюсь, что некоторые из вас смогут найти проблему, потому что я понятия не имею, откуда она взялась ... Не стесняйтесь спрашивать любые недостающие детали.

Спасибо Вы заранее !!

...