ros control
ros hardware_interface
参考链接:https://github.com/RethinkRobotics/ros_control/wiki/hardware_interface
利用官方写好的硬件接口:
假设要控制两个joint,假定控制的是joint的位置(位置环),这时我们需要提供两个借口:一个是输出接口(JointPositionInterface),用来控制joint的位置(position);另一个是控制的输入接口(JointStateInterface)即joint的状态(state)输入(状态反馈)。
代码实现:
1 #include <hardware_interface/joint_command_interface.h> 2 #include <hardware_interface/joint_state_interface.h> 3 #include <hardware_interface/robot_hw.h> 4 5 class MyRobot : public hardware_interface::RobotHW 6 { 7 public: 8 MyRobot() 9 { 10 // connect and register the joint state interface 11 hardware_interface::JointStateHandle state_handle_a("A", &pos[0], &vel[0], &eff[0]); 12 jnt_state_interface.registerHandle(state_handle_a); 13 14 hardware_interface::JointStateHandle state_handle_b("B", &pos[1], &vel[1], &eff[1]); 15 jnt_state_interface.registerHandle(state_handle_b); 16 17 registerInterface(&jnt_state_interface); 18 19 // connect and register the joint position interface 20 hardware_interface::JointHandle pos_handle_a(jnt_state_interface.getHandle("A"), &cmd[0]); 21 jnt_pos_interface.registerHandle(pos_handle_a); 22 23 hardware_interface::JointHandle pos_handle_b(jnt_state_interface.getHandle("B"), &cmd[1]); 24 jnt_pos_interface.registerHandle(pos_handle_b); 25 26 registerInterface(&jnt_pos_interface); 27 } 28 29 private: 30 hardware_interface::JointStateInterface jnt_state_interface; 31 hardware_interface::PositionJointInterface jnt_pos_interface; 32 double cmd[2]; 33 double pos[2]; 34 double vel[2]; 35 double eff[2]; 36 };
View Code
运行的原理:
控制器(controller)或者控制器管理器(controller manger)可以通过上面的代码可以读取控制对象joint的状态,也可以发送控制指令给控制对象。控制器(controller)在运行时候可以通过读取pos,vel,eff三个变量获得joint的状态,控制指令cmd变量里面。设计者需要重写read()、write()两个函数。read更新pos、vel、eff三个变量,write需要将cmd传给底层控制。
主函数的实现DEMO:
1 main() 2 { 3 MyRobot robot; 4 controller_manager::ControllerManager cm(&robot); 5 6 while (true) 7 { 8 robot.read(); 9 cm.update(robot.get_time(), robot.get_period()); 10 robot.write(); 11 sleep(); 12 } 13 }
View Code
Controllers
joint_state_controller 既 publish joint state
转载于:https://www.cnblogs.com/tomwill/p/6588949.html
ros control相关推荐
- ROS Gazebo Ros Control 及 Controller运用
写在前面 Gazebo ROS Control Default Robot HW SIM Gazebo ROS Control Plugin ROS Controller运用 1 position_c ...
- 学习ROS Control
点此下载源码 参考网页:Tutorial: ROS Control 通过使用控制器驱动机器人的关节,为MoveIt!等规划器提供一个准确的ROS接口.将使用ros_control包. ros_cont ...
- ros melodic控制真实机械臂之moveit_setup_assistant配置
一.通过moveit_setup_assistant进行配置 二.运行配置后的功能包 通过上一篇已经知道如何将三维模型导入到ros系统中,该篇主要记录通过moveit_setup_assistant为 ...
- ROS机器人操作系统现场培训课程|2017年9月
ROS现场培训课程| 2017年9月 对应网址提供了在线学习课程 课程模式为理论讲解+实践操作+结课考核三个主要部分 目前大部分国内培训课程,都是重视实践操作,然后理论讲解,考核是否放水? 高校课程, ...
- ROS(1和2)机器人操作系统相关书籍、资料和学习路径
ROS机器人相关书籍与资料(更新日期2017年11月) ROS发展10年了,已经逐渐成为通用的机器人操作系统标准.ROS 2相关资料链接:http://blog.csdn.net/zhangrelay ...
- ROS学习笔记(八)—— moveit!概述
参考: [运动规划]MoveIt! 运动规划 | MoveIt篇 MoveIt Tutorials github moveit 1. moveit!简介 Easy-to-use open source ...
- Gazebo機器人仿真學習探索筆記(七)连接ROS
中文稍后补充,先上官方原版教程.ROS Kinetic 搭配 Gazebo 7 附件----官方教程 Tutorial: ROS integration overview As of Gazebo 1 ...
- 基于ROS的UR5机器人开发学习(三)| 安装力矩传感器插件和Onrobot RG2夹爪
操作系统:Ubuntu18.04 ROS版本:Melodic 目录 1.使用Gazebo中的力矩传感器插件F/T sensor 1.1 添加插件 1.2 完整文件 1.3查看力矩传感器信息 2. 安装 ...
- 【ROS】ros_control、ur_modern_driver的工作原理
基础知识 生成文件tree ROSLAUNCH 的.launch/XML 语法 C语言中 int main(int argc,char *argv[])的两个参数详解 param name=" ...
- ROS机器人URDF建模
在阅读本文之前,推荐阅读前篇ROS机器人TF基础和全部资料文档: TF基础:https://blog.csdn.net/ZhangRelay/article/details/108374509 全文档 ...
最新文章
- 太难了!开源项目如何商业化?
- 数据库集群和高可用解决方案
- np.append()
- 大话css预编译处理(二)安装使用篇
- 如何做好需求变更管理?——需求变更流程规范
- linux:云端 ubuntu下挂载数据盘
- 直播http-flv原理
- windows winrar 指令_WINRAR 命令行语法
- String 常用方法总结
- silvaco-mobility models(1)
- onlyoffice 自动保存_onlyoffice服务在线编辑文档保存解析
- html图片自带闪光效果,CSS实现的一闪而过的图片闪光效果
- KL Divergence KL散度
- Java开发和测试开发面试杂记
- Andriod-Dagger2
- BZOJ 1257 [CQOI2007]余数之和sum 题解
- px em pt单位区别
- 物联网(IOT)之常见物联网通信技术概览-无线篇③
- 微信公众平台图文消息客户端无法收到
- nes网页服务器怎么改ip,virtuanes联机(怎么用VirtuaNES联网)