Gazebo | Ignition | Community
Ask Your Question
0

VisualPlugin reading contact forces crashes gazebo (black screen)

asked 2015-06-02 04:35:56 -0500

niall gravatar image

updated 2015-06-02 04:36:41 -0500

Hi,

I'm making my own gazebo plugin to read the contact forces on an object and the change the visual information accordingly. So far, I've been combining:

The plugin I made compiles fine but gives me a black screen when gazebo starts and crashes after about 100 iterations (becomes unresponsive). Verbose mode gives me no errors except a warning after about 30 seconds: "[Wrn] [Publisher.cc:131] Queue limit reached for topic /gazebo/default/pose/local/info, deleting message. This warning is printed only once."

Are there any other ways to figure out exactly why my plugin is crashing? I think it might have something to do with the way I create the subscriber. Here's my code:

material_plugin.h

material_plugin3.cpp

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
0

answered 2015-06-02 15:49:50 -0500

niall gravatar image

Here's what worked in the end:

material_plugin3.cpp

edit flag offensive delete link more
2

answered 2015-06-02 11:37:45 -0500

nkoenig gravatar image

You have an infinite while loop in your OnUpdate() function which will block Gazebo. Any Event connection from Gazebo, must return. It's also a good idea to return as quickly as possible.

edit flag offensive delete link more

Comments

You are totally right, thanks. Though I don't fully understand how this does work in the standalone subscriber (with a main) and not in this plugin... Anyway, removing it, along with some other changes, did the trick. I'll post the code below for others as reference :).

niall gravatar imageniall ( 2015-06-02 15:49:03 -0500 )edit

A plugin is managed by Gazebo, which has it's own main loop. In a standalone program you have to write your own main loop.

nkoenig gravatar imagenkoenig ( 2015-06-02 17:32:23 -0500 )edit

Question Tools

Stats

Asked: 2015-06-02 04:35:56 -0500

Seen: 677 times

Last updated: Jun 02 '15