Getting forces from Gazebo in ROS with pygazebo
Hi guys,
I'm new to Gazebo and ROS and am running the hector_quadrotor package to simulate a quadrotor in the gazebo world. I'm trying to get the contact forces from gazebo by subscribing to "/gazebo/default/physics/contacts" in ROS. Echo using gztopic works fine and subscribing from both C++ and python to ROS topics also works but I haven't been able to get gazebo topics to ROS yet...
Since my C++ knowlegde is limited, I'm using pygazebo which is giving me: "SyntaxError: 'yield' outside function" when running the example subscriber code from pygazebo (https://github.com/jpieper/pygazebo). I'm using ROS Indigo with Gazebo 2.2.3, python 2.7.6 and pygazebo 3.0.0.
What am I doing wrong? Any tips? Am I using incompatibel versions or something? Cheers
Asked by niall on 2015-05-04 04:14:24 UTC
Answers
Gazebo and ROS use different message passing strategies, which makes them incompatible. Gazebo2 uses Protobuf messages, and ROS uses custom messages. In order to receive Gazebo messages in ROS you'll need to use a Gazebo Node in your ROS program.
Here is a set of tutorials.
Asked by nkoenig on 2015-05-04 11:38:28 UTC
Comments
Finally got it to work in C++ instead of python. Thanks for your reply. It suprised me that there was no "subscriber to gazebo; publish to ros node" out there. Once mine is finished I might upload it if this is something others might be interested in.
Asked by niall on 2015-05-08 02:22:44 UTC
Comments
Can you say how you did, please? thanks!
Asked by akb on 2015-08-11 14:09:37 UTC
OK so basically I used the tutorial on creating a standalone subscriber for Gazebo. Got that working with ROS included and went on from there. Use Qtcreator as editor (open cmake file) to easily see what members/classes are available. Here's my code: http://pastebin.com/GmyBb6cx
Excuse my ugly coding. It's not a very fancy project so yes global variables and all... :)
Asked by niall on 2015-08-27 09:06:37 UTC
Comments