Hi, you can call the `shutdown' method on the Subscriber instance in your message callback. Lorenz > Hello all, > I am subscribing a node for amcl_pose. > > void* fn_get_robot_init_pos(void *obj){ > > ros::init(argc, argv, "robot_AMCL_Position"); > ros::NodeHandle l_node; > > ros::Subscriber l_amcl_pose = l_node.subscribe("amcl_pose", 1, > fn_amclinitpose); > ros::spin(); > > return(NULL); > } > > void fn_amclinitpose(const > geometry_msgs::PoseWithCovarianceStampedConstPtr& msg) > { > ROS_INFO("Received X:[%f] :: Y:[%f] :: Z:[%f] ", > msg->pose.pose.position.x, msg->pose.pose.position.y, > msg->pose.pose.position.z); > > } > > I want handle to be called only for one time. Since i want only initial > position of the Robot in my code when the Robot starts. > In above code spin(); callbacks again and again. (I tried spinonce also). > > Any solution to rid of this issue? Can we call function only one time? > > - Prasad > > > _______________________________________________ > ros-users mailing list > ros-users@code.ros.org > https://code.ros.org/mailman/listinfo/ros-users -- Lorenz Mösenlechner | moesenle@in.tum.de Technische Universität München | Boltzmannstr. 3 85748 Garching bei München | Germany http://ias.cs.tum.edu/ | Tel: +49 (89) 289-17750