ROS验证publisher和subscriber
在前面的两篇博客中我们用C++在ROS中创建了一个发布者和接收者,并使用catkin_make构建了新的节点,下面就需要验证一下,我们写的是否正确。
首先运行roscore
roscore
在使用catkin之前,确保把workspace的setup.bash文件source一下,这个文件必须是你执行catkin_make之后生成的文件。
# In your catkin workspace
$ cd ~/catkin_ws
$ source ./devel/setup.bash
打开一个新的终端在里面运行talker:
rosrun beginner_tutorials talker
看到的运行结果如下:
[INFO] [WallTime: 1314931831.774057] hello world 1314931831.77
[INFO] [WallTime: 1314931832.775497] hello world 1314931832.77
[INFO] [WallTime: 1314931833.778937] hello world 1314931833.78
[INFO] [WallTime: 1314931834.782059] hello world 1314931834.78
[INFO] [WallTime: 1314931835.784853] hello world 1314931835.78
[INFO] [WallTime: 1314931836.788106] hello world 1314931836.79
打开一个新的终端在里面运行listener:
rosrun beginner_tutorials listener
看到的结果如下:
[INFO] [WallTime: 1314931969.258941] /listener_17657_1314931968795I heard hello world 1314931969.26
[INFO] [WallTime: 1314931970.262246] /listener_17657_1314931968795I heard hello world 1314931970.26
[INFO] [WallTime: 1314931971.266348] /listener_17657_1314931968795I heard hello world 1314931971.26
[INFO] [WallTime: 1314931972.270429] /listener_17657_1314931968795I heard hello world 1314931972.27
[INFO] [WallTime: 1314931973.274382] /listener_17657_1314931968795I heard hello world 1314931973.27
[INFO] [WallTime: 1314931974.277694] /listener_17657_1314931968795I heard hello world 1314931974.28
[INFO] [WallTime: 1314931975.283708] /listener_17657_1314931968795I heard hello world 1314931975.28
说明了我们的程序是正确的。
ROS验证publisher和subscriber的更多相关文章
- ROS学习手记 - 8 编写ROS的Publisher and Subscriber
上一节我们完成了 message & srv 文件的创建和加入编译,这次我们要玩简单的Publisher 和 Subscriber 要玩 Publisher 和 Subscriber, 需要具 ...
- Writing a Simple Publisher and Subscriber
用c++实现一个publisher/subscriber publisher #include "ros/ros.h" #include "std_msgs/String ...
- Publisher和Subscriber节点
一.Publisher节点 /*"ros/ros.h"里面包含了ROS系统内最常用的一些头文件,包含此文件,便可以使用ROS的核心功能.*/#include "ros/r ...
- C#的publisher与subscriber,事件发布者与订阅者
说明:示例借鉴自这里,但原版很不友好,于是修改了下,一目了然. 直接上代码: using System; using System.Collections.Generic; using System. ...
- Publisher/Subscriber(发布/订阅者)消息模式开发流程
该模式的作用是发布者和订阅者 可以相互发送消息 发布者和订阅者都充当 生产者和消费者 发布者 package publisher.to.subscriber; import java.awt.font ...
- ROS教程
Learning ROS 学习ROS Depending on your learning style and preferences, you can take two approaches to ...
- How to build a GUI in ROS with Qt / C++
p { margin-bottom: 0.1in; direction: ltr; line-height: 120%; text-align: left; widows: 2; orphans: 2 ...
- ros的源码阅读
测试代码,使用xmlrpc与roscore通信 ros的框架是使用rpc与server端通信,server维护topic的publisher,subscriber,param server,servi ...
- (二)ROS系统架构及概念 ROS Architecture and Concepts 以Kinetic为主更新 附课件PPT
第2章 ROS系统架构及概念 ROS Architecture and Concepts PPT说明: 正文用白色,命令或代码用黄色,右下角为对应中文译著页码. 这一章需要掌握ROS文件系统,运行图级 ...
随机推荐
- Linux内核源代码解析——用户发送数据包的起源之sendto
本文原创为freas_1990,转载请标明出处:http://blog.csdn.net/freas_1990/article/details/10162853 Jack:我想知道用户如何把数据发送到 ...
- POJ3253 Fence Repair(贪心)
分割木板的顺序是自由的,所以每次选择两块最短的板,组合在一起,增加队列,原来两个板出队,直到队列中为空或者仅仅剩下一个板时结束.这里使用优先队列较为方便. #include<iostream&g ...
- 服务端API的OAuth认证实现
http://stackoverflow.com/questions/12499602/body-joints-angle-using-kinect?rq=1 新浪微博跟update相关的api已经挂 ...
- Attempt to call getDuration without a valid mediaplayer
最近在做一个播放器的小例子,中途遇到 了这个错: Attempt to call getDuration without a valid mediaplayer 解决参考方案如下: 一是如果media ...
- 利用js_API 运行对html文档元素的属性的CRUD操作
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title> ...
- JavaScript中的计时器原理
理解John Resig 在 How JavaScript Timers Work. 原理分析 timer(setInterval,setTimeout)有一个很重要的概念,时间延迟的长短是不稳定的. ...
- 《Microsoft SQL Server企业级平台管理实践》笔记
- 页是 SQL Server 中数据存储的基本单位,大小为 8KB. - 区是空间管理的基本单位,8个物理上连续的页的集合(64KB). - 页的类型包括: 1. Data 2. Index 3. ...
- Swift 3.0第1步,面向所有开发者开源
在移动开发中,Android开发一直比较受欢迎的原因之一就是其是一个开源的,有很多开源项目.代码可以用,这也是很多iOS开发者羡慕不已的地方.但值得庆贺的是,随着swift编程语言的发展,北京时间12 ...
- leetcode Binary Tree Paths python
# Definition for a binary tree node. # class TreeNode(object): # def __init__(self, x): # self.val = ...
- java/php/c#版rsa签名以及验签实现
本文为转载,请转载请注明地址: 原文地址为 http://xw-z1985.iteye.com/blog/1837376 在开放平台领域,需要给isv提供sdk,签名是Sdk中需要提供的 ...