Revision: 7120
          http://playerstage.svn.sourceforge.net/playerstage/?rev=7120&view=rev
Author:   natepak
Date:     2008-10-29 21:43:23 +0000 (Wed, 29 Oct 2008)

Log Message:
-----------
Added ability to turn saving of frames on and off

Modified Paths:
--------------
    code/gazebo/trunk/server/controllers/camera/generic/Generic_Camera.cc
    code/gazebo/trunk/server/sensors/camera/MonoCameraSensor.cc

Modified: code/gazebo/trunk/server/controllers/camera/generic/Generic_Camera.cc
===================================================================
--- code/gazebo/trunk/server/controllers/camera/generic/Generic_Camera.cc       
2008-10-29 19:20:33 UTC (rev 7119)
+++ code/gazebo/trunk/server/controllers/camera/generic/Generic_Camera.cc       
2008-10-29 21:43:23 UTC (rev 7120)
@@ -135,6 +135,8 @@
 
   memcpy(dst, src, data->image_size);
 
+  this->myParent->EnableSaveFrame( data->saveFrames );
+
   this->cameraIface->Unlock();
 
   // New data is available

Modified: code/gazebo/trunk/server/sensors/camera/MonoCameraSensor.cc
===================================================================
--- code/gazebo/trunk/server/sensors/camera/MonoCameraSensor.cc 2008-10-29 
19:20:33 UTC (rev 7119)
+++ code/gazebo/trunk/server/sensors/camera/MonoCameraSensor.cc 2008-10-29 
21:43:23 UTC (rev 7120)
@@ -27,6 +27,7 @@
 #include <sstream>
 #include <OgreImageCodec.h>
 #include <Ogre.h>
+#include <dirent.h>
 
 #include "Controller.hh"
 #include "Global.hh"
@@ -177,7 +178,9 @@
 
 
   if (this->saveFramesP->GetValue())
+  {
     this->SaveFrame();
+  }
 }
 
 
////////////////////////////////////////////////////////////////////////////////
@@ -210,6 +213,15 @@
 
   this->GetImageData();
 
+  // Create a directory if not present
+  DIR *dir = opendir( this->savePathnameP->GetValue().c_str() );
+  if (!dir)
+  {
+    std::string command;
+    command = "mkdir " + this->savePathnameP->GetValue() + " 2>>/dev/null";
+    system(command.c_str());
+  }
+
   // Get access to the buffer and make an image and write it to file
   mBuffer = this->renderTexture->getBuffer(0, 0);
 


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Playerstage-commit mailing list
Playerstage-commit@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/playerstage-commit

Reply via email to