
In ROS, using ar_pose package in ar_tools, many wanted to access the info of AR_Markers position and its orientation by subscribing to the topic published by launching the file in ar_pose, which is /ar_pose_marker. Below is an example to access the data present in the topic.
void chatterCallback(const ar_pose::ARMarkers::ConstPtr& msg)
{
ar_pose::ARMarker ar_marker;
if (!msg->markers.empty())
{
ar_marker = msg->markers[0];
ROS_INFO("X : [%f] ", ar_marker.pose.pose.position.x);
ROS_INFO("Y : [%f] ", ar_marker.pose.pose.position.y);
ROS_INFO("Z : [%f] ", ar_marker.pose.pose.position.z);
}
}

