我知道已经有很多关于这个特定错误的问题,但我发现没有一个问题为我解决了这个问题......
我正在尝试为凉亭中的两轮机器人实现 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>
我真诚地希望你们中的一些人能找到这个问题,因为我不知道它来自哪里......随时询问任何遗漏的细节。
先感谢您 !!