博文

目前显示的是标签为“node”的博文

【ROS学习-10】用C++编写一个简单的Publisher和Subscriber

1. 创建 Publisher Node   roscd beginner_tutorials    创建 src/talker.cpp 文件,内容如下(可从 https://raw.github.com/ros/ros_tutorials/kinetic-devel/roscpp_tutorials/talker/talker.cpp 获取源码):   #include "ros/ros.h"   #include "std_msgs/String.h"   #include <sstream>   int main(int argc, char **argv)   {     ros::init(argc, argv, "talker");     ros::NodeHandle n;     ros::Publisher chatter_pub = n.advertise<std_msgs::String>("chatter", 1000);     ros::Rate loop_rate(10);     int count = 0;     while(ros::ok())     {       std_msgs::String msg;       std::stringstream ss;       ss << "hello world " << count;       msg.data = ss.str();         ROS...

【ROS学习-5】了解ROS Nodes(节点/结点)

图片
1. 相关概念 Nodes : A node is an executable that uses ROS to communicate with other nodes. Messages : ROS data type used when subscribing or publishing to a topic. Topics : Nodes can  publish  messages to a topic as well as  subscribe  to a topic to receive messages. Master : Name service for ROS (i.e. helps nodes find each other) rosout : ROS equivalent of stdout/stderr roscore : Master + rosout + parameter server 2.Nodes    A node really isn't much more than an executable file within a ROS package. ROS nodes use a ROS client library to communicate with other nodes. Nodes can publish or subscribe to a Topic. Nodes can also provide or use a Service. 3. 客户端库    根据编程语言不同有:   rospy = python client library   roscpp = c++ client library 4.roscore    当运行 ROS 时第一件事就是运行 roscore 命令。 5. 使用 rosnode    由于执行了 roscore 命令后 Terminal 界面就被占用了,此时需要再打开一个新 Terminal 再进行如下操作才能有相应结果(...