0
$\begingroup$

Gazebo Answers logo

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.


Originally posted by raequin on Gazebo Answers with karma: 165 on 2016-03-09

Post score: 0

$\endgroup$

1 Answer 1

0
$\begingroup$

Gazebo Answers logo

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.


Originally posted by chapulina with karma: 7504 on 2016-03-09

This answer was ACCEPTED on the original site

Post score: 1


Original comments

Comment by raequin on 2016-03-09:
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!

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.