ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

mismatching topics ar_track_alvar_msgs

asked 2018-12-06 12:11:09 -0500

artemiialessandrini gravatar image

updated 2018-12-07 02:20:03 -0500


While trying to reach position/orientation of detected marker, getting this kind of error:

[ERROR] [1544117434.771301999]: Client [/vision_node] wants topic /ar_pose_marker to have datatype/md5sum [ar_track_alvar_msgs/AlvarMarker/ef2b6ad42bcb18e16b22fefb5c0fb85f], but our version has [ar_track_alvar_msgs/AlvarMarkers/943fe17bfb0b4ea7890368d0b25ad0ad]. Dropping connection.

I do understand an issue, which is I'm using another structure of msg in vision_node, than ar_track_alvar advertiser.

In this case, how could I get a header on 'pose' of marker detected.

Note: I believe, ar_track_alvar_msgs/AlvarMarkers is done to detect a bunch of markers, but not only one. I only need to detect a single, so it doesn't matter for me, which kind of message to use.

Attaching part of /vision_node code down below:

Localizer(ros::NodeHandle& nh)
    ar_sub_ = nh.subscribe<ar_track_alvar_msgs::AlvarMarker>("ar_pose_marker", 1,
    &Localizer::visionCallback, this);

    server_ = nh.advertiseService("localize_part", &Localizer::localizePart, this);

void visionCallback(const ar_track_alvar_msgs::AlvarMarkerConstPtr& msg)
    last_msg_ = msg;

bool localizePart(myworkcell_core::LocalizePart::Request& req,
                  myworkcell_core::LocalizePart::Response& res)
  // Read last message
  ar_track_alvar_msgs::AlvarMarkerConstPtr p = last_msg_;
  if (!p) return false;

  tf::Transform cam_to_target;
  tf::poseMsgToTF(p->pose.pose, cam_to_target);

  tf::StampedTransform req_to_cam;
  listener_.lookupTransform(req.base_frame, p->header.frame_id, ros::Time(0), req_to_cam);

  tf::Transform req_to_target;
  req_to_target = req_to_cam * cam_to_target;

  tf::poseTFToMsg(req_to_target, res.pose);
  return true;

ros::Subscriber ar_sub_;
ar_track_alvar_msgs::AlvarMarkerConstPtr last_msg_;
ros::ServiceServer server_;
tf::TransformListener listener_;

Feel free to clarify, I am bad at explaining:D


LocalizePart service:

string base_frame
geometry_msgs/Pose pose


Found solution after checking ar_track_alvar messages available and only got this line changed:

  tf::poseMsgToTF(p->markers[0].pose.pose, cam_to_target);

Code compiled, my stupid mistake. It's not about ROS versions or package conflicts, but because there are two types of msg offered by package and I checked a wrong one.

Anyways might be helpful to other beginners to go through rosmsg structure.

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

answered 2019-01-30 09:45:43 -0500

artemiialessandrini gravatar image

updated 2019-12-01 21:59:27 -0500

Found solution after checking ar_track_alvar messages available and only got this line changed:

  tf::poseMsgToTF(p->markers[0].pose.pose, cam_to_target);
edit flag offensive delete link more

answered 2018-12-06 12:23:57 -0500

You can also use ar_track_alvar to broadcast TFs from the camera frame to the markers. Using these you can replace everything in your localizePart() function with a single lookupTransform call. This call would simply lookup the transform from the frame given in the service request to the frame of the maker.

The specific error you're getting is caused by code from different versions of ROS or the package. But I'd recommend you use the TF only approach it will be much simpler to build, and can be introspected using RVIZ.

Hope this helps.

edit flag offensive delete link more


Thanks for your response, PeteBlackerThe3rd! I believe, a procedure of checking for a stream of marker's messages and taking the last one is necessary by any chance. I attached LocalizePart.srv as well. I was trying to use message ar_track_alvar_msgs/AlvarMarkers, but cannot reach to 'pose'.

artemiialessandrini gravatar image artemiialessandrini  ( 2018-12-06 21:56:59 -0500 )edit

Question Tools



Asked: 2018-12-06 12:11:09 -0500

Seen: 455 times

Last updated: Dec 01 '19