Robotics StackExchange | Archived questions

Gazebo 2.2: Get mouse coordinates from external source into Gazebo Plugin

I want to be able to read in the coordinates of a mouse click - preferably using a service, but subscribing to a topic would do - into my Gazebo 2.2 system plugin.

Trying to get some momentum behind this task, I tried following this tutorial, but if I even declare a ros::CallbackQueue variable or if I check ros::isInitialized() at any point in the execution of the plugin, Gazebo crashes, doesn't actually create the log file it says it made, and I get nowhere.

Any help is greatly appreciated.

Asked by techknowfile on 2017-04-09 19:04:39 UTC

Comments

Answers

Take a look at this question. GUI plugins are not supported on Gazebo 2.2, but you might be able to do it with a System plugin.

Just beware that Gazebo 2 has reached end of life, it's probably a better idea to upgrade to Gazebo 8.

Asked by chapulina on 2017-04-10 09:57:59 UTC

Comments

Thanks chapulina. I'm able to get mouse events inside of my system plugin by interfacing directly with the gazebo client, but when I need to do is get the information from a topic, so that I can take the coordinates from a click on an HTML canvas and then use them inside of the client.

Asked by techknowfile on 2017-04-10 15:47:40 UTC

Ohhh I see. Humm, and you want to use a ROS subscriber inside a Gazebo-ROS plugin to handle those coordinates? So the Gazebo-ROS plugin does not need to know about whatever you're doing to get those mouse coordinates, right? The tutorial you're following is for Gazebo 7, maybe try this one? http://gazebosim.org/tutorials?tut=ros_plugins&cat=connect_ros

Asked by chapulina on 2017-04-10 15:53:49 UTC