Skip to content

Commit bb09900

Browse files
committed
解释
1 parent 19b21e0 commit bb09900

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

catkin_wp/src/learning_topic/src/pose_subscriber.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Copyright 2020 GuYueHome (www.guyuehome.com).
1010
#include "turtlesim/Pose.h"
1111

1212
// 接收到订阅的消息后,会进入消息回调函数
13-
void poseCallback(const turtlesim::Pose::ConstPtr& msg)
13+
void poseCallback(const turtlesim::Pose::ConstPtr& msg) // msg 长指针
1414
{
1515
// 将接收到的消息打印出来
1616
ROS_INFO("Turtle pose: x:%0.6f, y:%0.6f", msg->x, msg->y);
@@ -27,7 +27,7 @@ int main(int argc, char **argv)
2727
// 创建一个Subscriber,订阅名为/turtle1/pose的topic,注册回调函数poseCallback
2828
ros::Subscriber pose_sub = n.subscribe("/turtle1/pose", 10, poseCallback);
2929

30-
// 循环等待回调函数
30+
// 循环等待回调函数(死循环,不断查看队列有没有消息进来
3131
ros::spin();
3232

3333
return 0;

0 commit comments

Comments
 (0)