smoother : 是一个速度平滑控制器,用来防止robot navigation的速度/转速过快,加速度/快减速过大
smoother针对navigation或者其他一些例子,robot有一个命令选择node cmd_vel_mux,防止robot被多个ros app下发的运动命令控制从而出现运动问题。见下图:
在move_base节点启动前启动smoother。跟踪它的启动脚本
move_base.launch.xml
<!--
ROS navigation stack with velocity smoother and safety (reactive) controller
-->
<launch>
<include file="$(find turtlebot_navigation)/launch/includes/velocity_smoother.launch.xml"/>
<include file="$(find turtlebot_navigation)/launch/includes/safety_controller.launch.xml"/>
再查看velocity_smoother.launch.xml
<!--
Velocity smoother
-->
<launch>
<node pkg="nodelet" type="nodelet" name="navigation_velocity_smoother" args="load yocs_velocity_smoother/VelocitySmootherNodelet mobile_base_nodelet_manager">
<rosparam file="$(find turtlebot_bringup)/param/defaults/smoother.yaml" command="load"/>
<remap from="navigation_velocity_smoother/smooth_cmd_vel" to="cmd_vel_mux/input/navi"/>
<!-- Robot velocity feedbacks; use the default base configuration -->
<remap from="navigation_velocity_smoother/odometry" to="odom"/>
<remap from="navigation_velocity_smoother/robot_cmd_vel" to="mobile_base/commands/velocity"/>
</node>
</launch>虽然在move_base脚本中启动,但smoother是一个nodelete,被moibile_base_nodelete_manager加载。其中smoothrt.yaml参数配置文件更是在turtlebot_bringup package下面。最后将节点中的发布的topic “navigation_velocity_smoother/smooth_cmd_vel” 重新映射成 “cmd_vel_mux/input/navi”,这样cmd_vel_mux就可以订阅到smoother发布的主题。
ros api
1.订阅的主题
~raw_cmd_vel (geometry_msgs/Twist):输入的速度命令
~odometry (nav_msgs/Odometry):接收里程计信息,确保下发的运动命令没有大的跳跃。根据feedback参数配置
~robot_cmd_vel (geometry_msgs/Twist):接受robot 命令信息,确保下发的运动命令没有大的跳跃。根据feedback参数配置2.发布的主题
~smooth_cmd_vel (geometry_msgs/Twist):发出来的命令,通常会将其remap到cmd_vel_mux订阅的运动命令topic上
3.参数
~accel_lim_v (double):强制必须设置,线性加速度最大值
~accel_lim_w (double):强制必须设置,角加速度最大值
~speed_lim_v (double):强制必须设置,线速度最大值
~speed_lim_w (double):强制必须设置,角速度最大值
~decel_factor (double, default: 1.0):加减速比,对于惯性大的机器人
~frequency (double, default: 20.0):输出速度频率。不论输入命令的频率。必要时插值
~robot_feedback (int, default: 0):速度反馈(0 - none, 1 - odometry, 2 - end robot commands). 参数配置文件smoothrt.yaml
# Default parameters used by the yocs_velocity_smoother module.
# This isn't used by minimal.launch per se, rather by everything
# which runs on top.
# Mandatory parameters
speed_lim_v: 0.8
speed_lim_w: 5.4
accel_lim_v: 1.0 # maximum is actually 2.0, but we push it down to be smooth
accel_lim_w: 2.0
# Optional parameters
frequency: 20.0
decel_factor: 1.5
# Robot velocity feedback type:
# 0 - none (default)
# 1 - odometry
# 2 - end robot commands
robot_feedback: 2
提示信息
1.除了frequency其它参数都是动态可配置的
2.如果有一个恒定的旋转半径,线/角速度会更加平滑
3.输入的最后一个topic信息不为0时(命令下发node 崩溃/不活跃),为了保证robot不出现意外,会在最后加一个0速度。
velocity smoother是ROS中的一个控制器,用于平滑机器人导航时的速度和转速,避免快速变化导致的问题。它通过cmd_vel_mux选择节点来确保机器人不受多个运动命令干扰。启动时,应在move_base之前启动smoother。该控制器的参数可通过smoothrt.yaml配置,并且具有动态配置参数的能力。当输入的命令主题不为0时,为防止机器人意外行为,会添加0速度指令。

被折叠的 条评论
为什么被折叠?



