Home | Tutorials | Wiki | Issues
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Gazebo crashes if a plugin parameter has an empty value

For our quadrotor simulation package hector_quadrotor we are using some custom Gazebo plugins with a couple of parameters. Most of them have a default value and as I would like to use xacro macro parameters for some of them I would like to support empty strings or empty tags in the plugin's SDF definitions.

However, the plugin causes a segfault in gzserver as the Element::GetValueString() access the empty pointer returned by Element::GetValue(). Is there a special reason why GetValueString() and the other type specific getter functions do not return an empty string or the default constructed values if the parameter value is empty? Of course a simple workaround to circumvent the segfault would be to check if GetValue() returns a null pointer before calling GetValueString().

See http://tu-darmstadt-ros-pkg.googlecode.com/svn/trunk/hector_quadrotor/hector_quadrotor_gazebo_plugins/src/quadrotor_simple_controller.cpp for an example use case. I am using Gazebo 1.0.2, the version that currently comes with ROS fuerte. But from the source code on BitBucket, the described behaviour should be the same for all versions up to 1.3.

click to hide/show revision 2
updated url to the SVN

Gazebo crashes if a plugin parameter has an empty value

For our quadrotor simulation package hector_quadrotor we are using some custom Gazebo plugins with a couple of parameters. Most of them have a default value and as I would like to use xacro macro parameters for some of them I would like to support empty strings or empty tags in the plugin's SDF definitions.

However, the plugin causes a segfault in gzserver as the Element::GetValueString() access the empty pointer returned by Element::GetValue(). Is there a special reason why GetValueString() and the other type specific getter functions do not return an empty string or the default constructed values if the parameter value is empty? Of course a simple workaround to circumvent the segfault would be to check if GetValue() returns a null pointer before calling GetValueString().

See http://tu-darmstadt-ros-pkg.googlecode.com/svn/trunk/hector_quadrotor/hector_quadrotor_gazebo_plugins/src/quadrotor_simple_controller.cpp for an example use case. I am using Gazebo 1.0.2, the version that currently comes with ROS fuerte. But from the source code on BitBucket, the described behaviour should be the same for all versions up to 1.3.