机器人操作系统ROS_现状与应用实例 李宝全

  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

ROS的几个例程
• • • • • • Hello world 图像 先锋机器人P3AT/P3DX KinectSkeleton Voice Network通讯
30
Institute of Robotics and Automatic Information System
先锋机器人P3AT/P3DX
图像的发布: Kinect的RGB摄像头
• 首先对Kinect设备进行配置, 并进行初始化
– 由于Kinect与ROS相互支持, 因此配置过程非常简便
• 初始化Kinect的过程就是发布一些列Topic的过程, 这些Topic包括:
– /camera/rgb/image_color: • 该话题即对应于我们需要的RGB图像数据 • 至此图像发布的任务完毕 • 若想把图像显示出来, 需要进行下一节“图像的接收与 显示” – /camera/rgb/image_raw: RGB图像的原始数据 – /camera/grey : 这是灰度图像 – /camera/depth: 这是场景深度图像
12
Institute of Robotics and Automatic Information System
Hello World程序
• 节点: 2个
– 节点talker (talker.cpp) : 包含一个发布者 – 节点listener (listener.cpp) : 包含一个接收者
• 节点间的通讯:
图像的接收,处理与显示
26
Institute of Robotics and Automatic Information System
图像的接收,处理与显示
27
Institute of Robotics and Automatic Information System
图像的接收,处理与显示
• 上页的image_converter节点对应于图像发布源为 Kinect, 若想要获得外置/内置摄像头的图像时, 将订 阅者的Topic改为 “/image_raw”即可.
– //usb_cam.h – //usb_cam.cpp: 由于是在Ubuntu (12.04)系统下进行的, 因此里面用到了Linux的V4L2视频驱动与服务 – //usb_cam_node.cpp 摄像头的图像在此节点中发布
22
Institute of Robotics and Automatic Information System
– 从相应Topic中获得sensor_msgs::Image图像信息(接收 者),并将其转化为cv::Mat的形式, 并显示图像。 – 当然, 该部分首先需要图像源来发布一个图像Topic,例 如上节的①Kinect, ②内置USB摄像头, ③外接USB摄 像头
25
Institute of Robotics and Automatic Information System
3
Institute of Robotics and Automatic Information System
应用火爆的ROS
• Robotics & Automation Magazine, IEEE • 该杂志上设立了专题讨论区:ROS Topics • 下方图片是在最新一期中ROS Topics的论文
南开大学首届机器人学博士生论坛
ROS - Robot Operating System: 现状与应用实例
李宝全
南开大学 :2014-7-3
机器人与信息自动化研究所
Institute of Robotics & Automatic Information System
1
每周工作报告
南开大学机器人与信息自动化研究所
4
Institute of Robotics and Automatic Information System
应用火爆的ROS
• 新加坡南洋理工大学(NTU)机器人相关实验室大家都 在用,已经形成了全民一起上的局面 • 所见的应用设备:
– – – – Pioneer3AT/DX Kinect AR.Drone TurtleBot
21
图像的发布: 笔记本内置摄像头
• 对于笔记本内置USB摄像头的图像获取, 要比 Kinect复杂. 这是由于ROS对Kinect的支持包括了图 像Topic的发布, 而对于计算机的内置/外置USB摄像 头, 需要我们自己做些操作 • 下载usb_cam包: https://github.com/bosch-rospkg/usb_cam.git . 包含如下3个文件
• P3AT/P3DX的配置 • 角速度和线速度控制量的发布
– 控制量发布的节点: 对应Publisher
• 控制量的接收
– 控制量接收的节点: 对应Subscriber – 即控制机器人的运动
31
Institute of Robotics and Automatic Information System
图像的发布: 笔记本内置摄像头
23
Institute of Robotics and Automatic Information System
图像的发布: 外置USB摄像头
• 也需要利用包usb_cam • 由于外接USB摄像头的设备名为video1,因此将设 备名的语句修改为
• 除此之外, 其它操作与上一节的内置摄像头图像发 布一致
ROS- Robot Operating System
What
&
Why How
&
现状
Results
几个应用例程
Sum综合实例 : 体感远程控制 mary
2
Institute of Robotics and Automatic Information System
应用火爆Байду номын сангаасROS
• ROS Repositories (>50) Map:
– Topic(话题的名称):“chatter” – Message(传递的数据类型):std_msgs::String • String为 ROS自定义的数据类型 • String中包含唯一变量为 std::string data
13
Institute of Robotics and Automatic Information System
– 改为
28
• 因此将该节点修改后重新编译并运行, 便可以继续 获取另一个图像源的图像. 这也体现了ROS的代码 维护非常灵活.
Institute of Robotics and Automatic Information System
图像的接收,处理与显示
29
Institute of Robotics and Automatic Information System
节点
• 将整个工程(Project)模块化,每个节点即为一个 模块。 • 每个节点都可以单独维护,比如现在有N个节点已 经在运行了,用户可以再编写第N+1个节点,然后 编译,然后运行,即有N+1个节点共同运行。 • 每个节点有唯一的名字 • 节点之间可借助网络跨主机共同运行.
9
Institute of Robotics and Automatic Information System
16
Institute of Robotics and Automatic Information System
Hello World程序
17
Institute of Robotics and Automatic Information System
ROS的几个例程
• • • • • • Hello world 图像 先锋机器人P3AT/P3DX KinectSkeleton Voice Network通讯
6
Institute of Robotics and Automatic Information System
几点说明
• 虽然ROS的名字为“机器人操作系统”,但不是真正的 操作系统,只是说它可以提供类似于操作系统的一些服 务,比如底层通讯, 分布式控制。 • 对于机器人的相关功能,不使用ROS也能实现. 但ROS 使得机器人软件搭建的工作更方便,效率更高。
24
Institute of Robotics and Automatic Information System
图像的接收,处理与显示
• ROS的图像数据使用sensor_msgs/Image的消息格 式 • CvBridge: 属于ROS的库, 在vision_opencv(堆 stack) /cv_bridge(包package) /image_geometry中. 用以转换sensor_msgs/Image至cv::Mat • 该部分功能:
Institute of Robotics and Automatic Information System
20
图像的发布: Kinect的RGB摄像头
图: Rviz中显示出的Kinect发布的点云信息 Institute of Robotics and Automatic Information System
– 可以与OpenCV相结合 (OpenCV与ROS均属于Willow Garage公司, 所以….) – 用户可以在该步骤中进行任意的图像处理操作(“so you can do everything in this step”)
19
• 图像的显示: 与OpenCV相结合
Institute of Robotics and Automatic Information System
节点之间的通讯
• 发布者Publisher • 订阅者Subscriber • 话题: 发布者与订阅者之间的通讯方式
– 话题的名称: Topic:发布者与订阅者之间数据传输“管道” 的名字,为一字符串 – 消息: Message: 传输数据的类型,例如int, char,自定义 类型。
10
Institute of Robotics and Automatic Information System
Hello World程序
14
Institute of Robotics and Automatic Information System
Hello World程序
15
Institute of Robotics and Automatic Information System
Hello World程序
ROS- Robot Operating System
What
&
Why How
&
现状
Results
几个应用例程
Sum综合实例 : 体感远程控制 mary
11
Institute of Robotics and Automatic Information System
ROS的几个例程
• • • • • • Hello world 图像 先锋机器人P3AT/P3DX KinectSkeleton Voice Network通讯
7
Institute of Robotics and Automatic Information System
ROS的程序的核心
• 节点
– 即可执行文件 – 由.cpp文件编译生成而来(指C++)
• 节点之间的通讯
– 节点间信息的发布与接收 – Publish – Subscribe
8
Institute of Robotics and Automatic Information System
18
Institute of Robotics and Automatic Information System
ROS的几个例程: 图像
• 图像的发布: 对应ROS中的Publisher. 以如下三个 图像源举例:
– Kinect的RGB摄像头 – 笔记本内置摄像头 – 外接USB摄像头
• 图像的接收: 对应ROS中的Subscriber • 图像的处理:
5
Institute of Robotics and Automatic Information System
ROS体系
• Main:由Willow Garage公式维护核心部分程序 • Universe:全球范围的代码,由其它个人/组织维护相关 知识库(Repository),即功能包(例如先锋机器人的 ROSARIA,Kinect的openni_tracker, 语言识别 pocketsphinx)
相关文档
最新文档