Home | Tutorials | Wiki | Issues
Ask Your Question

How Do I Use Both Sensor and Model Plugins to Control a Model?

asked 2016-03-09 01:13:36 -0500

raequin gravatar image

updated 2016-03-09 01:16:16 -0500

In my quest to garner Gazebo simulation skills I have made a model plugin for proportional joint control of a simple robot model. The plugin applies a joint torque that is proportional to the difference between the joint's current and desired positions. I suppose if the model had more joints I could just add JointPtrs to the plugin and control them all. My question is, how can I incorporate sensor data in this joint controller? For example, maybe my desired joint position is determined by values from a camera or a sonar sensor.

My current thought is that I have to find some way for the sensor plugin (it would be nice to be able to use libSonarPlugin.so) to provide my model plugin with data. I'm just guessing that this would entail creating a "node" (?) in my model plugin that "subscribes" (?) to the msgs::SonarStamped msg_ in SonarPlugin.hh. If so then should I follow this tutorial? I'll greatly appreciate it if you can help me get my bearings on this issue.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2016-03-09 10:55:08 -0500

Yes, creating a transport node and subscribing to messages from a sensor should work.

For a different approach, I suggest you take a look at this tutorial. The code for the model plugin used is here. In this approach, instead of using transport, the sensor pointer is taken directly.

edit flag offensive delete link more


That's great, thanks for those suggestions. I sure don't have enough c++ knowledge to effectively parse that plugin; maybe I can successfully modify it, though, for sonar sensors. It never would have occurred to me to look in the "Model Editor" tutorial for getting sensor data to a plugin!

raequin gravatar imageraequin ( 2016-03-09 21:03:55 -0500 )edit
Login/Signup to Answer

Question Tools



Asked: 2016-03-09 01:13:36 -0500

Seen: 265 times

Last updated: Mar 09 '16