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