Display time in Gazebo rendering frame for export, use MovableText? [closed]
I want to export frames from Gazebo with timestamps of the simulation time at which they are captured, like this screenshot (made in Webots)
To capture the frames, I can use the <saveframes> option of the rendering camera in the world file. But my frames are in greyscale and skewed, just as others reported.
I followed the instructions to use glc and it works fine. Now if I can display the simulation time in the rendering area, I'm done. I can't make up the simulation time from the image filename, because the simulation has to start paused and I don't know at what time the user unpaused it.
For rviz you can use markers to create view-oriented text. I discovered that for two years there are plans to make something similar for Gazebo, but I found nothing implemented.
I see there is a function MovableText in Ogre, the headerfile is in my case located in my ROS directory
/opt/ros/electric/stacks/simulator_gazebo/gazebo/gazebo/include/gazebo/OgreMovableText.hh
with more details of the functions online. I found an example of how it should be used in an old version of OgreCreator.cc:
383 OgreMovableText* msg = new OgreMovableText();
384 try
385 {
386 msg->Load(name, text,"Arial",0.08);
387 }
388 catch (Ogre::Exception e)
389 {
390 std::ostringstream stream;
391 stream << "Unable to create the text. " << e.getDescription() <<std::endl;
392 gzthrow(stream.str() );
393 }
394 msg->SetTextAlignment(OgreMovableText::H_CENTER, OgreMovableText::V_ABOVE);
395
396 Ogre::SceneNode *textNode = OgreAdaptor::Instance()->sceneMgr->getRootSceneNode()->createChildSceneNode(std::string(name)+"_node");
397
398 textNode->attachObject(msg);
399 textNode->translate(0, y, 0.02);
I am trying to acces this function from my realtime joint controller plugin so I include OgreAdaptor.hh, OgreCreator.hh and OgreMovableText.hh to my source and add their location to include_directories in CMakeLists.txt, and then try to reproduce the above, but I get a lot of errors related to Ogre. I don't think it is useful to post them here, because it is probably not even possible the way I'm doing this. Anybody an idea?
As far as I know, glc can only capture the rendering area of the gazebo window. If the above doesn't work, I will try to capture the whole gazebo window instead of only the rendering area with a program different from glc, then I have also the simulation time at the bottom of the pictures, which is less nice for a presentation.