点此下载源码
参考网页:Tutorial: ROS Control
通过使用控制器驱动机器人的关节,为MoveIt!等规划器提供一个准确的ROS接口。将使用ros_control包。

ros_control 与 Gazebo的数据流图

在Gazebo中进行控制器的仿真,可以利用ros_control和简单的Gazebo插件来实现。各相关组件的关系参考下图

前期准备

参考Using URDF in Gazebo建立一个RRBot机器人模型。
主要教程目录参考如下

使用

向URDF文件添加传动机构

将驱动器与关节相连接。

<robot>...<transmission name="tran1"><type>transmission_interface/SimpleTransmission</type><joint name="joint1"><hardwareInterface>hardware_interface/EffortJointInterface</hardwareInterface></joint><actuator name="motor1"><hardwareInterface>hardware_interface/EffortJointInterface</hardwareInterface><mechanicalReduction>1</mechanicalReduction></actuator></transmission><transmission name="tran2"><type>transmission_interface/SimpleTransmission</type><joint name="joint2"><hardwareInterface>hardware_interface/EffortJointInterface</hardwareInterface></joint><actuator name="motor2"><hardwareInterface>hardware_interface/EffortJointInterface</hardwareInterface><mechanicalReduction>1</mechanicalReduction></actuator></transmission></robot>

添加gazebo_ros_control插件

<robot><!-- ros_control plugin --><gazebo><plugin name="gazebo_ros_control" filename="libgazebo_ros_control.so"><robotNamespace>/rrbot</robotNamespace><robotSimType>gazebo_ros_control/DefaultRobotHWSim</robotSimType></plugin></gazebo></robot>

创建.yaml配置文件

rrbot:# Publish all joint states -----------------------------------joint_state_controller:type: joint_state_controller/JointStateControllerpublish_rate: 50  # Position Controllers ---------------------------------------joint1_position_controller:type: effort_controllers/JointPositionControllerjoint: joint1pid: {p: 100.0, i: 0.01, d: 10.0}joint2_position_controller:type: effort_controllers/JointPositionControllerjoint: joint2pid: {p: 100.0, i: 0.01, d: 10.0}

创建启动文件

<launch><!-- Load joint controller configurations from YAML file to parameter server --><rosparam file="$(find rrbot_control)/config/rrbot_control.yaml" command="load"/><!-- load the controllers --><node name="controller_spawner" pkg="controller_manager" type="spawner" respawn="false"output="screen" ns="/rrbot" args="joint1_position_controller joint2_position_controller joint_state_controller"/><!-- convert joint states to TF transforms for rviz, etc --><node name="robot_state_publisher" pkg="robot_state_publisher" type="robot_state_publisher"respawn="false" output="screen"><remap from="/joint_states" to="/rrbot/joint_states" /></node></launch>

使用启动文件开启控制器

开始RRBot机器人仿真

roslaunch rrbot_gazebo rrbot_world.launch

加载两关节控制器

roslaunch rrbot_control rrbot_control.launch

使用service手动调用控制器

rosservice call /rrbot/controller_manager/load_controller "name: 'joint1_position_controller'"
rosservice call /rrbot/controller_manager/load_controller "name: 'joint2_position_controller'"

启动控制器

rosservice call /rrbot/controller_manager/switch_controller "{start_controllers: ['joint1_position_controller','joint2_position_controller'], stop_controllers: [], strictness: 2}"

停止控制器

rosservice call /rrbot/controller_manager/switch_controller "{start_controllers: [], stop_controllers: ['joint1_position_controller','joint2_position_controller'], strictness: 2}"

手动发送命令

rostopic pub -1 /rrbot/joint1_position_controller/command std_msgs/Float64 "data: 1.5"
rostopic pub -1 /rrbot/joint2_position_controller/command std_msgs/Float64 "data: 1.0"

使用rqt工具

rosrun rqt_gui rqt_gui

已经配置好的一个RQT

roslaunch rrbot_control rrbot_rqt.launch

与RVIZ建立连接

rosrun rviz rviz

添加“RobotModel”


学习ROS Control相关推荐

  1. 在Jetson Nano上学习ROS的记录(版本Ubuntu18.04,课程来源赵虚左老师的《ROS理论与实践》)第十二章 机器人导航(仿真)

    系列文章目录 第一章 ROS空间创建.helloworld的实现.开启多个节点 第二章 话题通信 第三章 服务通信 第四章 参数服务器 第五章 常用指令 第六章 通信机制实操 第七章 ROS通信机制进 ...

  2. 在学习ros时,使用roslaunch命令时出现下列报错 load_parameters: unable to set parameters (last param was [/move_base/

    在学习ros时,使用roslaunch命令时出现下列报错 load_parameters: unable to set parameters (last param was [/move_base/c ...

  3. 先学python还是ros_如何学习Ros?

    简而言之,学习ROS的关键是--多实践! ROS是一个机器人研发中的重要工具,"学以致用"才是我们学习的最终目的:给学习赋能的就是实践!而实践就是不断进行知行合一的各种尝试! 现在 ...

  4. ROS Gazebo Ros Control 及 Controller运用

    写在前面 Gazebo ROS Control Default Robot HW SIM Gazebo ROS Control Plugin ROS Controller运用 1 position_c ...

  5. 如何利用蓝桥云课提升学习ROS机器人的效率

    合适再深入学习,不合适一个网页简单使用也能了解其中大部分功能,免除繁琐配置的时间成本. 如果学习和试用一下ROS机器人(ROS1为例)最方便的办法就是打开如下网页: 课程编号854,已经学习人数超过1 ...

  6. 【学习ROS】linux安装并配置ROS环境

    http://wiki.ros.org/cn/ROS/Tutorials/InstallingandConfiguringROSEnvironment 安装并配置ROS环境 Description: ...

  7. 十七步学习ROS Toptics -ubuntu 18.04 melodic- ROS/教程/理解主题的概念:ROS/Tutorials/Understanding ROS Toptics

    1,打开一个终端运行内核: $ roscore 2,再打开一个终端运行仿真节点: $ rosrun turtlesim turtlesim_node 3,再打开一个终端运行键盘: $ rosrun t ...

  8. ROS自主导航学习———ROS通信机制

    前言 前面ROS很多都忘记了 ,现在来重新回顾一下内容 ROS 中的基本通信机制主要有如下三种实现策略: 话题通信(发布订阅模式) 服务通信(请求响应模式) 参数服务器(参数共享模式) Action通 ...

  9. 机器人学习--ROS学习入门

    目前机器人的研发,小打小闹弄个玩具可以用stm32等嵌入式微处理器+ 电机驱动器+ 电机驱动小车玩一下.但是上升到移动机器人自主定位导航和感知环境等高级需求层面,普通嵌入式微处理器处理不了那么多数据, ...

最新文章

  1. LeetCode35.搜索插入位置
  2. gj12-2 协程和异步io
  3. angularjs2--tab页调用父页面的方法
  4. 《ASP.NET Core 微服务实战》-- 读书笔记(第3章)
  5. 【C语言进阶深度学习记录】九 C语言中const的详细分析
  6. [Leetcode][第63题][JAVA][不同路径2][动态规划][压缩路径]
  7. Android uevent
  8. 不安装oracle 连接数据库,不安装oracle 连接服务器oracle数据库方法
  9. 解决VSCODE因为在此系统上禁止运行脚本报错
  10. 贝索斯将于7月5日卸任亚马逊CEO一职
  11. 【渝粤教育】国家开放大学2018年秋季 0676-22T物流成本管理 参考试题
  12. java的流套接_Java是什么原因导致网络套接字的流结束?
  13. 设置Idea护眼背景色 简单明了
  14. Unity3D Android集成Java源代码
  15. MT【276】正切的半角公式
  16. Mac 下JDK 1.8 下载地址
  17. MFC中Wnd.PostMessage()的作用
  18. Scala可变长度参数和:_*使用
  19. 【Pandas 基础知识 数据修改总结】
  20. 解决Intellij IDEA Debug 多模块下断点目标源问题

热门文章

  1. 爬虫练习- 爬取转转网二手市场商品信息
  2. 高中毕业学校mysql类型_高中毕业后考生类别和毕业类别是什么意思?
  3. IBM X3650 M3 管理口IP如何更改
  4. 即构服务端录制SDK上线,音视频数据实现本地存储录制回放
  5. iOS 程序插件及功能动态更新思路
  6. 【工具使用】工具使用之逻辑分析仪
  7. 你了解“暗数据”吗?
  8. 传播智客学习笔记--L37 BroadcasReceiver和短信拦截
  9. 阿里云代码持续集成rdc思路
  10. 基于matlab人,基于MATLAB的人口预测研究