Revision: 7489
http://playerstage.svn.sourceforge.net/playerstage/?rev=7489&view=rev
Author: hsujohnhsu
Date: 2009-03-16 23:57:48 +0000 (Mon, 16 Mar 2009)
Log Message:
-----------
make ConnectWait wait if Iface is not available rather than crashing out.
Modified Paths:
--------------
code/gazebo/branches/ogre-1.4.9/libgazebo/Client.cc
code/gazebo/branches/ogre-1.4.9/libgazebo/Iface.cc
code/gazebo/branches/ogre-1.4.9/server/controllers/factory/Factory.cc
Modified: code/gazebo/branches/ogre-1.4.9/libgazebo/Client.cc
===================================================================
--- code/gazebo/branches/ogre-1.4.9/libgazebo/Client.cc 2009-03-16 23:51:31 UTC
(rev 7488)
+++ code/gazebo/branches/ogre-1.4.9/libgazebo/Client.cc 2009-03-16 23:57:48 UTC
(rev 7489)
@@ -189,8 +189,14 @@
{
this->semKey = GZ_SEM_KEY + this->serverId;
- // Get the client semaphore group
- this->semId = semget(this->semKey, 0, S_IRWXU);
+ // While loop to wait for directory
+ this->semId = -1;
+ while(this->semId < 0)
+ {
+ // Get the client semaphore group
+ this->semId = semget(this->semKey, 0, S_IRWXU);
+ usleep(1000000);
+ }
if (this->semId < 0)
{
Modified: code/gazebo/branches/ogre-1.4.9/libgazebo/Iface.cc
===================================================================
--- code/gazebo/branches/ogre-1.4.9/libgazebo/Iface.cc 2009-03-16 23:51:31 UTC
(rev 7488)
+++ code/gazebo/branches/ogre-1.4.9/libgazebo/Iface.cc 2009-03-16 23:57:48 UTC
(rev 7489)
@@ -264,6 +264,15 @@
// Open the mmap file
this->mmapFd = open(this->filename.c_str(), O_RDWR);
+
+ // this patch is needed so Gazebo sits and waits for Iface to open when
+ // spawning robot dynamically
+ while (this->mmapFd <= 0)
+ {
+ this->mmapFd = open(this->filename.c_str(), O_RDWR);
+ usleep(1000000); // wait and try again
+ }
+
if (this->mmapFd <= 0)
{
stream << "error opening device file " << this->filename.c_str() << " : "
Modified: code/gazebo/branches/ogre-1.4.9/server/controllers/factory/Factory.cc
===================================================================
--- code/gazebo/branches/ogre-1.4.9/server/controllers/factory/Factory.cc
2009-03-16 23:51:31 UTC (rev 7488)
+++ code/gazebo/branches/ogre-1.4.9/server/controllers/factory/Factory.cc
2009-03-16 23:57:48 UTC (rev 7489)
@@ -76,6 +76,8 @@
// Initialize the controller
void Factory::InitChild()
{
+ // initialize newModel to blank
+ strcpy((char*)this->factoryIface->data->newModel,"");
}
////////////////////////////////////////////////////////////////////////////////
@@ -83,8 +85,10 @@
void Factory::UpdateChild()
{
// If there is a string, then add the contents to the world
+ this->factoryIface->Lock(1);
if (strcmp((const char*)this->factoryIface->data->newModel,"")!=0)
{
+ //std::cout << " factory update: " << this->factoryIface->data->newModel
<< std::endl;
std::string xmlString;
std::string xmlMiddle = (const char*)(this->factoryIface->data->newModel);
@@ -121,6 +125,7 @@
strcpy((char*)this->factoryIface->data->deleteModel,"");
}
+ this->factoryIface->Unlock();
}
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
easily build your RIAs with Flex Builder, the Eclipse(TM)based development
software that enables intelligent coding and step-through debugging.
Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com
_______________________________________________
Playerstage-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/playerstage-commit