Revision: 6952
http://playerstage.svn.sourceforge.net/playerstage/?rev=6952&view=rev
Author: natepak
Date: 2008-08-14 15:03:10 +0000 (Thu, 14 Aug 2008)
Log Message:
-----------
Added error checking for interfaces with the same name
Modified Paths:
--------------
code/gazebo/trunk/libgazebo/Iface.cc
code/gazebo/trunk/server/Model.cc
code/gazebo/trunk/server/Simulator.cc
code/gazebo/trunk/server/World.cc
code/gazebo/trunk/server/controllers/Controller.cc
code/gazebo/trunk/worlds/test.world
Modified: code/gazebo/trunk/libgazebo/Iface.cc
===================================================================
--- code/gazebo/trunk/libgazebo/Iface.cc 2008-08-12 21:56:03 UTC (rev
6951)
+++ code/gazebo/trunk/libgazebo/Iface.cc 2008-08-14 15:03:10 UTC (rev
6952)
@@ -78,7 +78,16 @@
Iface::~Iface()
{
if (this->mmapFd && this->creator)
- this->Destroy();
+ {
+ try
+ {
+ this->Destroy();
+ }
+ catch (std::string e)
+ {
+ std::cerr << "Error: " << e << "\n";
+ }
+ }
}
@@ -132,6 +141,13 @@
// Work out the filename
this->Filename(this->id);
+ int testFD = open(this->filename.c_str(), O_RDONLY);
+ if (testFD >= 0)
+ {
+ stream << "error: interface[" << this->filename << " already exists.";
+ throw(stream.str());
+ }
+
// Create and open the file
this->mmapFd = open(this->filename.c_str(), O_RDWR | O_CREAT | O_TRUNC,
S_IREAD | S_IWRITE);
Modified: code/gazebo/trunk/server/Model.cc
===================================================================
--- code/gazebo/trunk/server/Model.cc 2008-08-12 21:56:03 UTC (rev 6951)
+++ code/gazebo/trunk/server/Model.cc 2008-08-14 15:03:10 UTC (rev 6952)
@@ -688,17 +688,7 @@
while (childNode)
{
- try
- {
- this->LoadBody(childNode);
- }
- catch (GazeboError e)
- {
- std::cerr << "Error Loading body[" <<
childNode->GetString("name",std::string(), 0) << "]\n";
- std::cerr << e << std::endl;
- childNode = childNode->GetNextByNSPrefix("body");
- continue;
- }
+ this->LoadBody(childNode);
childNode = childNode->GetNextByNSPrefix("body");
}
Modified: code/gazebo/trunk/server/Simulator.cc
===================================================================
--- code/gazebo/trunk/server/Simulator.cc 2008-08-12 21:56:03 UTC (rev
6951)
+++ code/gazebo/trunk/server/Simulator.cc 2008-08-14 15:03:10 UTC (rev
6952)
@@ -191,7 +191,7 @@
}
catch (GazeboError e)
{
- gzthrow("Failed to load the GUI\n" << e);
+ gzthrow("Failed to load the World\n" << e);
}
this->loaded=true;
Modified: code/gazebo/trunk/server/World.cc
===================================================================
--- code/gazebo/trunk/server/World.cc 2008-08-12 21:56:03 UTC (rev 6951)
+++ code/gazebo/trunk/server/World.cc 2008-08-14 15:03:10 UTC (rev 6952)
@@ -85,7 +85,15 @@
GZ_DELETE (this->physicsEngine)
GZ_DELETE (this->server)
- GZ_DELETE (this->simIface)
+
+ try
+ {
+ GZ_DELETE (this->simIface)
+ }
+ catch (std::string e)
+ {
+ gzthrow(e);
+ }
}
////////////////////////////////////////////////////////////////////////////////
@@ -107,8 +115,15 @@
// Create the simulator interface
- this->simIface = new SimulationIface();
- this->simIface->Create(this->server, "default" );
+ try
+ {
+ this->simIface = new SimulationIface();
+ this->simIface->Create(this->server, "default" );
+ }
+ catch (std::string err)
+ {
+ gzthrow(err);
+ }
this->physicsEngine = new ODEPhysics(); //TODO: use exceptions here
@@ -226,7 +241,14 @@
gzmsg(-1) << "Problem destroying simIface[" << e << "]\n";
}
- this->server->Fini();
+ try
+ {
+ this->server->Fini();
+ }
+ catch (std::string e)
+ {
+ gzthrow(e);
+ }
return 0;
}
Modified: code/gazebo/trunk/server/controllers/Controller.cc
===================================================================
--- code/gazebo/trunk/server/controllers/Controller.cc 2008-08-12 21:56:03 UTC
(rev 6951)
+++ code/gazebo/trunk/server/controllers/Controller.cc 2008-08-14 15:03:10 UTC
(rev 6952)
@@ -96,7 +96,14 @@
}
// Create the iface
- iface->Create(World::Instance()->GetGzServer(), ifaceName);
+ try
+ {
+ iface->Create(World::Instance()->GetGzServer(), ifaceName);
+ }
+ catch (std::string e)
+ {
+ gzthrow(e);
+ }
this->ifaces.push_back(iface);
Modified: code/gazebo/trunk/worlds/test.world
===================================================================
--- code/gazebo/trunk/worlds/test.world 2008-08-12 21:56:03 UTC (rev 6951)
+++ code/gazebo/trunk/worlds/test.world 2008-08-14 15:03:10 UTC (rev 6952)
@@ -137,6 +137,21 @@
</include>
</model:physical>
+ <model:physical name="laser">
+ <xyz>-0.15 0 0.18</xyz>
+ <rpy>0 0 -180</rpy>
+
+ <attach>
+ <parentBody>chassis_body</parentBody>
+ <myBody>laser_body</myBody>
+ </attach>
+
+ <include embedded="true">
+ <xi:include href="models/sicklms200.model" />
+ </include>
+ </model:physical>
+
+
<!--
The include should be last within a model. All previous statements
will override those in the included file
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/playerstage-commit