how to publish camera pose w.r.t marker coordinate system on a topic ?
Hello all! I want to publish camera pose w.r.t marker coordinate system on ROS topic using OpenCV but I dont know how to define the data-type of message passed to Callback function of Subscriber. In publisher node the data-type of variable which the coordinates of camera pose is cv::Point3f
and variable name is Position_OcInW. So it has three points x y and z. Like given below;
Position_OcInW.x, Position_OcInW.y, Position_OcInW.z,
Publisher part is ros::Publisher coordinate_object = nh_.advertise<std::vector<std::vector<cv::Point3f> >("coordinate_topic",1);
Now I write the call-back function of subscriber node.
void cbFunction(<std::vector<std::vector<cv::Point3f> >& message_holder){
// print coordinates
ROS_INFO("cooridantes of camera pose: %f", message_holder.data);
}
I know its wrong but I dont know how to write this part. If someone has worked on OpenCv Please help me. Thanks. These are some errors.
> /home/ibrahim/catkin_ws/src/track_control/src/camera_pose_co.cpp:15:16: error: variable or field ‘cbFunction’
> declared void void
> cbFunction(<std::vector<std::vector<cv::Point3f>
> >& message_holder){
> ^ /home/ibrahim/catkin_ws/src/track_control/src/camera_pose_co.cpp:15:17: error: expected primary-expression
> before ‘<’ token void
> cbFunction(<std::vector<std::vector<cv::Point3f>
> >& message_holder){
> ^ /home/ibrahim/catkin_ws/src/track_control/src/camera_pose_co.cpp:15:56: error: expected primary-expression
> before ‘&’ token void
> cbFunction(<std::vector<std::vector<cv::Point3f>
> >& message_holder){
> ^
> /home/ibrahim/catkin_ws/src/track_control/src/camera_pose_co.cpp:15:58: error: ‘message_holder’ was not
> declared in this scope void
> cbFunction(<std::vector<std::vector<cv::Point3f>
> >& message_holder){
> ^
> /home/ibrahim/catkin_ws/src/track_control/src/detect_control_subscriber.cpp:
> In function ‘int main(int, char**)’:
> /home/ibrahim/catkin_ws/src/track_control/src/detect_control_subscriber.cpp:177:111:
> error: no matching function for call
> to
> ‘std::vector<std::vector<cv::Point3_<float>
> > >::vector(const char [17], int)’ ros::Publisher coordinate_object =
> nh_.advertise<std::vector<std::vector<cv::Point3f>
> >("coordinate_topic",1);