• Rviz 使用Arbotix控制机器人运动


    需求

    控制机器人模型在 rviz 中做圆周运动

    实现流程

    • 安装 Arbotix
    • 创建新功能包,准备机器人 urdf、xacro 文件
    • 添加 Arbotix 配置文件
    • 编写 launch 文件配置 Arbotix
    • 启动 launch 文件并控制机器人模型运动

    添加 arbotix 所需的配置文件

    在urdf01_rviz config中添加control.yaml文件

    # 该文件是控制器配置,一个机器人模型可能有多个控制器,比如: 底盘、机械臂、夹持器(机械手)....
    # 因此,根 name 是 controller
    controllers: {
       # 单控制器设置
       base_controller: {
              #类型: 差速控制器
           type: diff_controller,
           #参考坐标
           base_frame_id: base_footprint, 
           #两个轮子之间的间距
           base_width: 0.2,
           #控制频率
           ticks_meter: 2000, 
           #PID控制参数,使机器人车轮快速达到预期速度
           Kp: 12, 
           Kd: 12, 
           Ki: 0, 
           Ko: 50, 
           #加速限制
           accel_limit: 1.0 
        }
    }
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22

    添加launch文件 demo07_control.launch

    <launch>
        
        
        <param name = "robot_description" command = "$(find xacro)/xacro $(find urdf01_rviz)/urdf/xacro/car.urdf.xacro" />
    
        
        <node pkg = "rviz" type = "rviz" name = "rviz" args = "-d $(find urdf01_rviz)/config/show_mycar.rviz"/>
    
        
        <node pkg = "joint_state_publisher" type = "joint_state_publisher" name = "joint_state_publisher" />
    
        
        <node pkg = "robot_state_publisher" type = "robot_state_publisher" name = "robot_state_publisher" />
    
        
        <node pkg = "arbotix_python" type = "arbotix_driver" name = "driver" output = "screen" >
            <rosparam command = "load" file = "$(find urdf01_rviz)/config/control.yaml" />
            <param name = "sim" value = "true" />
        node>
    launch>
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20

    rostopic list

    /clicked_point
    /cmd_vel
    /diagnostics
    /initialpose
    /joint_states
    /move_base_simple/goal
    /odom
    /rosout
    /rosout_agg
    /tf
    /tf_static

    rostopic pub -r 10 /cmd_vel geometry_msgs/Twist “linear:
    x: 1.0
    y: 0.0
    z: 0.0
    angular:
    x: 0.0
    y: 0.0
    z: 1.0”

  • 相关阅读:
    ESP32系列--存储器类型和XIP特性
    ELF和静态链接:为什么程序无法同时在Linux和Windows下运行?
    2022年冷链物流行业分析
    简易智能家居系统
    红帽系列操作系统安全更新 —— 筑梦之路
    Spring MVC中@ModelAttribute注解起什么作用呢?
    Spring IOC源码:实例化前的准备工作
    Spring基础(七):使用外部属性配置文件
    STM32F4串口USART发送为00的解决方案
    小公司比较吃亏的两道微服务面试题
  • 原文地址:https://blog.csdn.net/qq_42731062/article/details/125997450