ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Gazebo Error, can not find rendering system

asked 2012-02-28 00:37:17 -0500

Erik_S gravatar image

updated 2012-02-29 01:25:03 -0500

Dear All,

I'm am still writing a C++ simulink file, i got communication up and running via ROSTOPICS(see this link).

However, due to the nature of my simulator/research i want to time simulink to run the same speed (x times real time). I've tried timers and other ros stuff, they just do not suffice (not accurate enough mostly). This is needed for causality.

Hence I'm trying to run/start gazebo myself from within my C++ simulink file, to be able to aces the simulator directly. And i was successful, but for some reason it is not running correctly any more(it was last week)!! Compilation is runs fine, but at runtime i get an error.

Right now I'm getting the following error in matlab:

/home/erik/ros/simulator_gazebo/gazebo/build/gazebo/server/rendering  / : Exception: unable to find rendering system

The error occurs after the following piece of code(basically the same as gazeboros.cpp).

/*Starting the Gazebo Simulator with all the neccesary paths*/
    gazebo::Simulator::Instance()->SetCreateOgreLog( optOgreLog );
    gazebo::Simulator::Instance()->SetGuiEnabled( optGuiEnabled );
    gazebo::Simulator::Instance()->SetRenderEngineEnabled( optRenderEngineEnabled );

  std::string ogre_package_name("ogre"); 
  std::string ogre_package_path = std::string("/home/s041723/ros/visualization_common/ogre/ogre/lib/OGRE");
  std::cerr << ogre_package_path << std::endl;


  // set gazebo media paths by adding all packages that exports "gazebo_media_path" for gazebo
  std::vector<std::string> gazebo_media_paths;
  for (std::vector<std::string>::iterator iter=gazebo_media_paths.begin(); iter != gazebo_media_paths.end(); iter++)
    ROS_DEBUG("med path %s",iter->c_str());

  // set gazebo plugins paths by adding all packages that exports "plugin" for gazebo
  std::vector<std::string> plugin_paths;
  for (std::vector<std::string>::iterator iter=plugin_paths.begin(); iter != plugin_paths.end(); iter++)
    ROS_DEBUG("plugin path %s",(*iter).c_str());

  // set .gazeborc path to something else, so we don't pick up default ~/.gazeborc
  std::string gazeborc = ros::package::getPath("gazebo")+"/.do_not_use_gazeborc";


            gazebo::Simulator::Instance()->LoadWorldFile(std::string(""), optServerId);

    catch (gazebo::GazeboError e)
            std::cerr << "Error Loading Gazebo" << std::endl;
            std::cerr << e << std::endl;
           // return -1;

It crashes as soon as i call loadworldfile.

The weird thing is, i do not get this error when i compile and run the same outside of matlab. Which works perfectly fine.

Here is a piece of the stacktrace from the matlab error.

   Stack Trace (from fault):
[  0] 0xb76bd255     /usr/local/MATLAB/R2011b/bin/glnx86/ _ZN2fl4diag15stacktrace_base7captureERKNS0_14thread_contextEj+000169
[  1] 0xb76c0175     /usr/local/MATLAB/R2011b/bin/glnx86/
[  2] 0xb76c0569     /usr/local/MATLAB/R2011b/bin/glnx86/ _ZN2fl4diag13terminate_logEPKcRKNS0_14thread_contextEb+000181
[  3] 0xb733b93f    /usr/local/MATLAB/R2011b/bin/glnx86/ _ZN2fl4diag13terminate_logEPKcPK8ucontextb+000096
[  4] 0xb7338996    /usr/local/MATLAB/R2011b/bin ...
edit retag flag offensive close merge delete


could it be a permissions issue? Maybe matlab starts some processes as a different user, try chmod 777 /dev/nvidia*?

hsu gravatar image hsu  ( 2012-02-28 06:50:58 -0500 )edit

The permissions for these files are crw-rw-rw-, so i dont really see an issue there.

Erik_S gravatar image Erik_S  ( 2012-02-28 23:05:46 -0500 )edit

to clarify, you have a mex-version of gazeboros.cpp?

hsu gravatar image hsu  ( 2012-02-29 17:34:25 -0500 )edit

Yeah, basically i copied most of the 'main' from gazeboros.cpp into a S-function (C++). Which i mex compile. This file (the cpp S-function) is causing the headache at runtime inside matlab.

Erik_S gravatar image Erik_S  ( 2012-03-01 22:48:28 -0500 )edit

can you try adding to ogrePaths the path to as well, as see if that helps?

hsu gravatar image hsu  ( 2012-03-02 03:03:17 -0500 )edit

Too bad, that didn't work either. Appreciate the help though!! For some reason in the line this->root->getAvailableRenderers(); returns empty when compiled in matlab. Maybe matlabs own openGL libs are interfering, allthough i would be strange since they didnt before.

Erik_S gravatar image Erik_S  ( 2012-03-02 03:27:22 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2012-03-02 05:43:05 -0500

hsu gravatar image

hm, might have to dig into OgreRoot.cpp for that one.

edit flag offensive delete link more

Question Tools


Asked: 2012-02-28 00:37:17 -0500

Seen: 400 times

Last updated: Feb 29 '12