Debug Gazebo Plugin using an IDE and ROS indigo
Hello guys,
i am currently developing my own gazebo world plugin that work so far pretty well. However, debugging with gdb in terminal it is a huge pain. I start gzserver via the gazebo_ros package.
Trying to debug my plugin with QtCreator i did the following so far:
Added a custom build configuration that runs the ros build stuff (catkin_make). Furthermore, i added a run config that runs the gzserver executable with the following arguments
-s /opt/ros/indigo/lib/libgazebo_ros_api.so -s /opt/ros/indigo/lib/libgazebo_ros_paths_plugin.so -s devel/lib/libmy_plugin.so
Additionally the environment variables in QtCreator's run environment are set as follows:
Use Build Environment and
Set GAZEBO_MASTER_URI to http://localhost:11345
Set GAZEBO_MODEL_DATABASE_URI to http://gazebosim.org/models
Set GAZEBO_MODEL_PATH to /usr/share/gazebo-7/models:${GAZEBO_MODEL_PATH}
Set GAZEBO_PLUGIN_PATH to /usr/lib/x86_64-linux-gnu/gazebo-7/plugins:${GAZEBO_PLUGIN_PATH}
Set GAZEBO_RESOURCE_PATH to /usr/share/gazebo-7:/usr/share/gazebo_models:${GAZEBO_RESOURCE_PATH}
Set LD_LIBRARY_PATH to ${LD_LIBRARY_PATH}:/usr/lib/x86_64-linux-gnu/gazebo-7/plugins
Set OGRE_RESOURCE_PATH to /usr/lib/x86_64-linux-gnu/OGRE-1.8.0
Set ROS_IP to 'hostname -I'
The plugin is built with the CMAKE_BUILD_TYPE=Debug
flag set accordingly.
I let the roscore master process run using a terminal. The ROS environment variables have all been set in the build step,
where i run the ros setup.bash and the one generated by catkin_make:
ROS_DISTRO indigo
ROS_MASTER_URI http://localhost:11311
ROS_PACKAGE_PATH /opt/ros/indigo/share:/opt/ros/indigo/stacks
ROS_ROOT /opt/ros/indigo/share/ros
Basically i tried to setup the environment as the script of gazebo_ros/gzserver does it.
Using the above setup I'm able to break in the Constructor of the plugin. However, if i let the process(es) continue, some process tells me:
Debugging starts
&"warning: GDB: Failed to set controlling terminal: Inappropriate ioctl for device\n"
can't find linker symbol for virtual table for `gazebo::my_plugin' value
can't find linker symbol for virtual table for `gazebo::my_plugin' value
can't find linker symbol for virtual table for `gazebo::my_plugin' value
can't find linker symbol for virtual table for `gazebo::my_plugin' value
can't find linker symbol for virtual table for `gazebo::my_plugin' value
[FATAL] [1470150055.685288734]: You must call ros::init() before creating the first NodeHandle
Couldn't find an AF_INET address for []
Couldn't find an AF_INET address for []
[ERROR] [1470150055.766057167]: [registerPublisher] Failed to contact master at [:0]. Retrying...
Couldn't find an AF_INET address for []
Couldn't find an AF_INET address for []
Couldn't find an AF_INET address for []
Couldn't find an AF_INET address for []
...
Launching gzserver with the above arguments gives me the same output.
If a set a breakpoint in the constructor, and let the program halt and run again,
Can you help me with the setup? I am missing some steps, but google and brain work could not find an answer to the problem.
What is the right way to setup for plugin development in an IDE ?
Also: to be able to step into the Gazebo libraries/executables using ...
yes on the debug flag.
I don't know of any gazebo developers who use an IDE. so you're probably on your own here