So i am subscribing the position of a marker, but i would like to access its position at the instant i am using the function so that i can put the x y z coordinate into a vector. how should i do that ?
#include "ros/ros.h"
#include <math.h>
#include <opencv/cv.h>
#include <opencv/cvaux.h>
#include <opencv/highgui.h>
#include "geometry_msgs/PoseStamped.h"
#include "geometry_msgs/Pose.h"
#include "geometry_msgs/PoseWithCovariance.h"
#include <visp/vpDisplayGDI.h>
#include <visp/vpDisplayX.h>
#include <visp/vpDot2.h>
#include <visp/vpImageIo.h>
#include <visp/vpPixelMeterConversion.h>
#include <visp/vpPose.h>
using namespace cv;
using namespace std;
void imageCallback(const geometry_msgs::PoseStamped::ConstPtr& ps4){
cout<<"pose is"<<ps4->pose.position<<endl;
//ps_cov->publish(ps);
}
int main(int argc,char** argv){
geometry_msgs::PoseStamped my_vidoe;
ros::init(argc, argv, "visp_auto_tracker_1");
ros::NodeHandle n;
ros::Subscriber sub = n.subscribe<geometry_msgs::PoseStamped>("/visp_auto_tracker/object_position", 1000, imageCallback);
ros::spin();
return 0;
}