Home | Tutorials | Wiki | Issues
Ask Your Question
0

Getting forces from Gazebo in ROS with pygazebo

asked 2015-05-04 04:14:24 -0500

niall gravatar image

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

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
0

answered 2015-05-08 02:22:44 -0500

niall gravatar image

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.

edit flag offensive delete link more

Comments

Can you say how you did, please? thanks!

akb gravatar imageakb ( 2015-08-11 14:09:37 -0500 )edit

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... :)

niall gravatar imageniall ( 2015-08-27 09:06:37 -0500 )edit
0

answered 2015-05-04 11:38:28 -0500

nkoenig gravatar image

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.

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

2 followers

Stats

Asked: 2015-05-04 04:14:24 -0500

Seen: 558 times

Last updated: May 08 '15