• ROS1云课→25机器人控制配置


    ROS1云课→24机器人感知配置


    移动机器人控制和运动学动力学模型密切相关。

    差动驱动轮系统控制器。控制采用速度命令的形式,将其拆分然后发送到差动驱动轴距的两个车轮上。里程计是从硬件的反馈中计算出来的,并发布。如果仿真就简单了很多。

    参考如下(机器翻译):

    带转向机构的车轮系统控制器。控制采用速度命令的形式,该命令被拆分然后发送到转向驱动轮座的单个后轮和单个前转向。里程计是从硬件的反馈中计算出来的,并发布。

    创建基础控制器

    对于导航功能包集来说,一个基础控制器是非常重要的,因为这是唯一能够有效地控制机器人的方法。它能够直接和机器人的电子设备通信。

    ROS并不提供任何标准的基础控制器,因此必须自己编写针对移动平台的基础控制器。

    机器人通过geometry_msgs/Twist类型的消息进行控制。这个类型正是之前看到的Odometry消息所使用的。

    所以基础控制器必须订阅名称为cmd_vel的主题,必须生成正确的线速度和角速度命令来驱动平台。

    现在先复习一下消息的结构。在命令行窗口内输入以下命令查看消息的具体结构:

    $ rosmsg show geometry_msgs/Twist

    这个命令的输出结果如下所示:

     

    二维环境控制:

    geometry_msgs/Vector3 linear
      float64 x
      float64 y
      float64 z
    geometry_msgs/Vector3 angular
      float64 x
      float64 y
      float64 z
     

    三维环境控制:

    geometry_msgs/Vector3 linear
      float64 x
      float64 y
      float64 z

    geometry_msgs/Vector3 angular
      float64 x
      float64 y
      float64 z

     

    其中,线速度向量linear包含了xyz轴的线速度。角速度向量angular包含了各个轴向的角速度。

    两轮差速结构(diff):

    diff-drive-controller

    对于两轮机器人,只需要使用线速度x和角速度z。这是因为机器人基于差动轮驱动平台,驱动它的两个电动机只能够让机器人前进、后退或者转向。

    车式转向结构(ackermann):

    1. rosmsg show ackermann_msgs/AckermannDrive [21:27:00]
    2. float32 steering_angle
    3. float32 steering_angle_velocity
    4. float32 speed
    5. float32 acceleration
    6. float32 jerk
    1. mobile_base_controller:
    2. type : "ackermann_steering_controller/AckermannSteeringController"
    3. rear_wheel: 'rear_wheel_joint'
    4. front_steer: 'front_steer_joint'
    5. publish_rate: 50.0 # default: 50
    6. pose_covariance_diagonal : [0.001, 0.001, 1000000.0, 1000000.0, 1000000.0, 1000.0]
    7. twist_covariance_diagonal: [0.001, 0.001, 1000000.0, 1000000.0, 1000000.0, 1000.0]
    8. # Wheel separation between the rear and the front, and diameter of the rear.
    9. # These are both optional.
    10. # ackermann_steering_controller will attempt to read either one or both from the
    11. # URDF if not specified as a parameter.
    12. wheel_separation_h : 1.0
    13. wheel_radius : 0.3
    14. # Wheel separation and radius multipliers for odometry calibration.
    15. wheel_separation_h_multiplier: 1.0 # default: 1.0
    16. wheel_radius_multiplier : 1.0 # default: 1.0
    17. # Steer position angle multipliers for fine tuning.
    18. steer_pos_multiplier : 1.0
    19. # Velocity commands timeout [s], default 0.5
    20. cmd_vel_timeout: 0.25
    21. # Base frame_id
    22. base_frame_id: base_footprint #default: base_link
    23. # Odom frame_id
    24. odom_frame_id: odom
    25. # Velocity and acceleration limits
    26. # Whenever a min_* is unspecified, default to -max_*
    27. linear:
    28. x:
    29. has_velocity_limits : true
    30. max_velocity : 1.0 # m/s
    31. min_velocity : -0.5 # m/s
    32. has_acceleration_limits: true
    33. max_acceleration : 0.8 # m/s^2
    34. min_acceleration : -0.4 # m/s^2
    35. has_jerk_limits : true
    36. max_jerk : 5.0 # m/s^3
    37. angular:
    38. z:
    39. has_velocity_limits : true
    40. max_velocity : 1.7 # rad/s
    41. has_acceleration_limits: true
    42. max_acceleration : 1.5 # rad/s^2
    43. has_jerk_limits : true
    44. max_jerk : 2.5 # rad/s^3

    如何在地图中移动机器人呢?

    两轮差动cmd_vel。

    使用rqt

     

     

    如果需要自动避障参考:

    1. /******************************************************************************
    2. STDR Simulator - Simple Two DImensional Robot Simulator
    3. Copyright (C) 2013 STDR Simulator
    4. This program is free software; you can redistribute it and/or modify
    5. it under the terms of the GNU General Public License as published by
    6. the Free Software Foundation; either version 3 of the License, or
    7. (at your option) any later version.
    8. This program is distributed in the hope that it will be useful,
    9. but WITHOUT ANY WARRANTY; without even the implied warranty of
    10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    11. GNU General Public License for more details.
    12. You should have received a copy of the GNU General Public License
    13. along with this program; if not, write to the Free Software Foundation,
    14. Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
    15. Authors :
    16. * Manos Tsardoulias, etsardou@gmail.com
    17. * Aris Thallas, aris.thallas@gmail.com
    18. * Chris Zalidis, zalidis@gmail.com
    19. ******************************************************************************/
    20. # include "stdr_samples/obstacle_avoidance/obstacle_avoidance.h"
    21. /**
    22. @namespace stdr_samples
    23. @brief The main namespace for STDR Samples
    24. **/
    25. namespace stdr_samples
    26. {
    27. /**
    28. @brief Default contructor
    29. @param argc [int] Number of input arguments
    30. @param argv [char **] Input arguments
    31. @return void
    32. **/
    33. ObstacleAvoidance::ObstacleAvoidance(int argc,char **argv)
    34. {
    35. if(argc != 3)
    36. {
    37. ROS_ERROR(
    38. "Usage : stdr_obstacle avoidance ");
    39. exit(0);
    40. }
    41. laser_topic_ = std::string("/") +
    42. std::string(argv[1]) + std::string("/") + std::string(argv[2]);
    43. speeds_topic_ = std::string("/") +
    44. std::string(argv[1]) + std::string("/cmd_vel");
    45. subscriber_ = n_.subscribe(
    46. laser_topic_.c_str(),
    47. 1,
    48. &ObstacleAvoidance::callback,
    49. this);
    50. cmd_vel_pub_ = n_.advertise(speeds_topic_.c_str(), 1);
    51. }
    52. /**
    53. @brief Default destructor
    54. @return void
    55. **/
    56. ObstacleAvoidance::~ObstacleAvoidance(void)
    57. {
    58. }
    59. /**
    60. @brief Callback for the ros laser message
    61. @param msg [const sensor_msgs::LaserScan&] The new laser scan message
    62. @return void
    63. **/
    64. void ObstacleAvoidance::callback(const sensor_msgs::LaserScan& msg)
    65. {
    66. scan_ = msg;
    67. float linear = 0, rotational = 0;
    68. for(unsigned int i = 0 ; i < scan_.ranges.size() ; i++)
    69. {
    70. float real_dist = scan_.ranges[i];
    71. linear -= cos(scan_.angle_min + i * scan_.angle_increment)
    72. / (1.0 + real_dist * real_dist);
    73. rotational -= sin(scan_.angle_min + i * scan_.angle_increment)
    74. / (1.0 + real_dist * real_dist);
    75. }
    76. geometry_msgs::Twist cmd;
    77. linear /= scan_.ranges.size();
    78. rotational /= scan_.ranges.size();
    79. //~ ROS_ERROR("%f %f",linear,rotational);
    80. if(linear > 0.3)
    81. {
    82. linear = 0.3;
    83. }
    84. else if(linear < -0.3)
    85. {
    86. linear = -0.3;
    87. }
    88. cmd.linear.x = 0.3 + linear;
    89. cmd.angular.z = rotational;
    90. cmd_vel_pub_.publish(cmd);
    91. }
    92. }

     

     


     

  • 相关阅读:
    DOM- 节点操作
    拆分文字后再分组去重
    onnx转换TensorRT的步骤
    壳聚糖-凝集素|Chitosan-Lectins|凝集素-PEG-壳聚糖|壳聚糖-聚乙二醇-凝集素
    虹科示波器 | 汽车免拆检修 | 2010款江铃陆风X8车发动机怠速抖动、加速无力
    想知道怎么给图片加贴纸?手把手教你给图片加贴纸
    经管博士科研基础【25】概率论中的相关基础概念
    制作U盘启动盘
    Java进阶必会JVM-深入浅出Java虚拟机
    【SLAM论文阅读笔记】Multi-modal Semantic SLAM for Complex Dynamic Environments
  • 原文地址:https://blog.csdn.net/ZhangRelay/article/details/126809483