rviz plugin subscriber

asked 2017-05-31 10:28:55 -0500

Marq gravatar image


I am trying to make an RVIZ plugin subscribe to interactive marker messages but am having problems getting things setup.

I started with the Teleop panel example and removed the drive widget. here is a link to the unmodified teleop_panel.cpp

In TeleopPanel::SetTopic I removed the velocity publisher and replaced it with the following line.

ros::Subscriber sub = nh_.subscribe("/myMarker/feedback", 10, &TeleopPanel::markerCallback, this);
ROS_INFO("subscribed to /myMarker/feedback");

I then added the method TeleopPanel::markerCallback

void TeleopPanel::markerCallback( const visualization_msgs::InteractiveMarkerFeedbackConstPtr &feedback )
  ROS_INFO("I received a message");

With some ROS_INFO messages I can see that my subscribe function is advertized to my nh_ but my callback is never called. I also tried to subscribe to regular InteractiveMarker messages but get the same result. I did find that if I subscribe to the same messages that RVIZ is using for the builtin InteractiveMarkerDisplay (/myMarker/update) I crash RVIZ and get the following error message.

Qt has caught an exception thrown from an event handler. Throwing
exceptions from an event handler is not supported in Qt. You must
reimplement QApplication::notify() and catch all exceptions there.

terminate called after throwing an instance of 'ros::ConflictingSubscriptionException'
  what():  Tried to subscribe to a topic with the same name but different md5sum as a topic that was already subscribed [visualization_msgs/InteractiveMarkerFeedback/ab0f1eee058667e28c19ff3ffc3f4b78 vs. visualization_msgs/InteractiveMarkerUpdate/83e22f99d3b31fde725e0a338200e036]

So my question is.... What is the correct way to subscribe to an interactive marker message with an RVIZ plugin?

I looked at the source code for RVIZ and found that they use the interactive_markers::InteractiveMarkerClient for the interactive_marker_display. Do I need to make my own client to connect to the server I have publishing the interactive marker?

edit retag flag offensive close merge delete