当前位置:网站首页>【ROS进阶篇】第九讲 基于Rviz和Arbotix控制的机器人模型运动
【ROS进阶篇】第九讲 基于Rviz和Arbotix控制的机器人模型运动
2022-07-28 00:57:00 【生如昭诩】
【ROS进阶篇】第九讲 基于Rviz和Arbotix控制的机器人模型运动

文章目录
前言
在上一节博客中我们系统的学习了对于URDF文件的编程优化方法,即Xacro,一种XML的优化语言,通过对于基本概念、语法详解、代码实例的讲述了解了如何提升URDF文件的复用性、安全性和高效性,本节文章主要介绍在Rviz环境下如何使用Arbotix控制机器人模型运动。
一、Arbotix功能包介绍
- 问题引入:
在先前的研究中,我们通过URDF文件实现了静态创建机器人模型,并可以通过可视化软件Rviz观察并实现基本操作,那么想要进一步的仿真操作,就一定需要完成对于机器人模型的运动控制,这里就引入一个对应的功能包来完成目标要求。
1. 基本简介:

Arbotix:Arbotix 是一款控制电机、舵机的控制板,并提供相应的 ros 功能包,这个功能包的功能不仅可以驱动真实的 Arbotix 控制板,它还提供一个差速控制器,通过接受速度控制指令更新机器人的 joint 状态,从而帮助我们实现机器人在 rviz 中的运动。
注:此差速控制器位于python程序包中,完整程序包还包括多种控制器,对应电机、机械臂和夹持器等;
2. 安装教程:
- 命令行直接调用:
sudo apt-get install ros-noetic-arbotix
- git安装源码:
git clone https://github.com/vanadiumlabs/arbotix_ros.git\qquad 在下载后调用
catkin_make编译完成即可;

二、控制运动流程
1. 准备工作
- 创建功能包,并编写URDF文件/通过Xacro进行优化

- 添加Arbotix配置:配置文件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
}
}
2. 编写并启动launch文件
- 编写launch文件:
\qquad 基本要求:
\qquad 1. 调用了arbotix_python 功能包下的 arbotix_driver 节点
\qquad 2. 通过 file 加载配置文件获取机器人信息以便驱动运动实现
\qquad 3. 配置 sim 为 true,完成仿真环境要求
<launch>
<!--1.在参数服务器中载入urdf-->
<!--<param name="robot_description" textfile="$(find urdf01_rviz)/urdf/xacro/demo05_car_base.urdf" />-->
<param name="robot_description" command="$(find xacro)/xacro $(find urdf01_rviz)/urdf/xacro/car.urdf.xacro" />
<!--2.启动rviz-->
<node pkg="rviz" name="rviz" type="rviz" args="-d $(find urdf01_rviz)/config/show_mycar.rviz"/>
<!--3.关节状态发布节点-->
<node pkg="joint_state_publisher" type="joint_state_publisher" name="joint_state_publisher"/>
<!--4.机器人状态发布节点-->
<node pkg="robot_state_publisher" type="robot_state_publisher" name="robot_state_publisher"/>
<!--集成 arbotix 运动控制节点,并且加载参数-->
<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>
- 启动launch文件:使用
roslaunch命令即可 - 配置Rviz:修改Fixed Frame以及TF、Odometry下的Topic设置为odom等

- 控制运动:此时话题
/cmd_vel出现,故我们可以通过发布话题消息或者输入命令完成运动控制,效果如下:
rostopic pub -r 10 /cmd_vel geometry_msgs/Twist '{linear: {x: 0.2, y: 0, z: 0}, angular: {x: 0, y: 0, z: 0.5}}'

注意:想要进一步操作可以修改Rviz的设置:
- 显示小车运动方向:将Odometry下status下的topic修改为/odom;
- 更改运动方向表示的箭头:将Odometry下shape的shaft radius进行修改;
- 显示机器人坐标系:开启TF箭头;
总结
- 声明:本节博客部分参考了CSDN用户赵虚左的ROS教程,本文主要内容是使用Arbotix功能包在Rviz环境下完成对于机器人静态模型的运动控制,从基本简介、安装教程到最后的实际控制示例,从实践中深入浅出,体会如何实际控制机器人运动。下节将会介绍在Gazebo中的机器人模型仿真,敬请期待。
边栏推荐
- They are all talking about Devops. Do you really understand it?
- 你所不知道的WMS
- Codeforces Round #810 (Div. 2)A~C题解
- 微信小程序实现动态横向步骤条的两种方式
- 视频常用分辨率
- 执行 Add-Migration 迁移时报 Build failed.
- Likeshop takeout ordering system [100% open source, no encryption]
- 小程序毕设作品之微信校园维修报修小程序毕业设计成品(4)开题报告
- MPLS tunnel experiment
- Five basic data structures of redis
猜你喜欢

微信小程序实现动态横向步骤条的两种方式

CeresDAO:Ventures DAO的“新代言”

Fluorite network, difficult to be a "lone brave"

LeetCode 热题 HOT 100 -> 3. 无重复字符的最长子串

Flex layout - fixed positioning + flow layout - main axis alignment - side axis alignment - expansion ratio

Under the new retail format, retail e-commerce RPA helps reshape growth

Synchronized details

Behind every piece of information you collect, you can't live without TA

Promise从入门到精通(第3章 自定义(手写)Promise)

每条你收藏的资讯背后,都离不开TA
随机推荐
Clear the cause of floating and six methods (solve the problem that floating affects the parent element and the global)
MySQL pymysql operation
Product interpretation - Design and distributed expansion of metersphere UI test module
Which database is the fastest to query data only?
小程序毕设作品之微信校园浴室预约小程序毕业设计成品(1)开发概要
样本不均衡-入门0
新零售业态下,零售电商RPA助力重塑增长
轻量版项目管理系统
对话Atlassian认证专家叶燕秀:Atlassian产品进入后Server时代,中国用户应当何去何从?
二叉树的遍历和性质
C # using ABP warehouse to access the database error record set
四种常见的 POST 提交数据方式
The principle and implementation of loss function cross entropy
记录一次生产死锁
Codeworks round 810 (Div. 2) a~c problem solution
Promise from introduction to mastery (Chapter 4 async and await)
[深入研究4G/5G/6G专题-42]: URLLC-14-《3GPP URLLC相关协议、规范、技术原理深度解读》-8-低延时技术-2-基于slot的调度与Slot内灵活的上下行符号配比
微信小程序图片根据屏幕比例缩放
The level "trap" of test / development programmers is not a measure of one-dimensional ability
【愚公系列】2022年07月 Tabby集成终端的使用