Revision: 7671
http://playerstage.svn.sourceforge.net/playerstage/?rev=7671&view=rev
Author: natepak
Date: 2009-05-15 16:01:59 +0000 (Fri, 15 May 2009)
Log Message:
-----------
Fixed thread safety issue with Factory controller. Fixed CMakeLists varaibles
associated with avcodec and avformat
Modified Paths:
--------------
code/gazebo/trunk/CMakeLists.txt
code/gazebo/trunk/cmake/SearchForStuff.cmake
code/gazebo/trunk/cmake/libgazebo_pkgconfig.cmake
code/gazebo/trunk/examples/libgazebo/factory/SConstruct
code/gazebo/trunk/server/CMakeLists.txt
code/gazebo/trunk/server/Simulator.cc
code/gazebo/trunk/server/World.cc
code/gazebo/trunk/server/World.hh
code/gazebo/trunk/server/controllers/factory/Factory.cc
code/gazebo/trunk/server/gui/CMakeLists.txt
code/gazebo/trunk/server/rendering/OgreVisual.cc
code/gazebo/trunk/worlds/simpleshapes.world
Modified: code/gazebo/trunk/CMakeLists.txt
===================================================================
--- code/gazebo/trunk/CMakeLists.txt 2009-05-15 15:56:54 UTC (rev 7670)
+++ code/gazebo/trunk/CMakeLists.txt 2009-05-15 16:01:59 UTC (rev 7671)
@@ -60,11 +60,17 @@
INCLUDE (${gazebo_cmake_dir}/SearchForStuff.cmake)
MESSAGE (STATUS "----------------------------------------")
+########################################
# Write the config.h file
CONFIGURE_FILE (${PROJECT_SOURCE_DIR}/config.h.in
${PROJECT_BINARY_DIR}/config.h)
+
+########################################
+# Make the gazebo rc file
+CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/cmake/gazeborc.cmake
${PROJECT_BINARY_DIR}/.gazeborc @ONLY)
+INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/.gazeborc DESTINATION $ENV{HOME}/)
+
INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR} ${PROJECT_BINARY_DIR})
-
IF (BUILD_GAZEBO)
ADD_SUBDIRECTORY(libgazebo)
ADD_SUBDIRECTORY(server)
Modified: code/gazebo/trunk/cmake/SearchForStuff.cmake
===================================================================
--- code/gazebo/trunk/cmake/SearchForStuff.cmake 2009-05-15 15:56:54 UTC
(rev 7670)
+++ code/gazebo/trunk/cmake/SearchForStuff.cmake 2009-05-15 16:01:59 UTC
(rev 7671)
@@ -272,6 +272,9 @@
MESSAGE (STATUS "Looking for avcodec.h - found")
ENDIF (NOT LIBAVCODEC_PATH)
+ELSE (HAVE_FFMPEG)
+ SET (LIBAVFORMAT_PATH /usr/include)
+ SET (LIBAVCODEC_PATH /usr/include)
ENDIF (HAVE_FFMPEG)
Modified: code/gazebo/trunk/cmake/libgazebo_pkgconfig.cmake
===================================================================
--- code/gazebo/trunk/cmake/libgazebo_pkgconfig.cmake 2009-05-15 15:56:54 UTC
(rev 7670)
+++ code/gazebo/trunk/cmake/libgazebo_pkgconfig.cmake 2009-05-15 16:01:59 UTC
(rev 7671)
@@ -6,5 +6,5 @@
Description: Shared memory interface to Gazebo
Version: @GAZEBO_VERSION@
Requires:
-Libs: -L${libdir} -lgazeboshm
+Libs: -L${libdir} -lgazebo
CFlags: -I${includedir}
Modified: code/gazebo/trunk/examples/libgazebo/factory/SConstruct
===================================================================
--- code/gazebo/trunk/examples/libgazebo/factory/SConstruct 2009-05-15
15:56:54 UTC (rev 7670)
+++ code/gazebo/trunk/examples/libgazebo/factory/SConstruct 2009-05-15
16:01:59 UTC (rev 7671)
@@ -17,4 +17,4 @@
for cfg in parseConfigs:
env.ParseConfig(cfg)
-env.Program('factory','factory.cc')
+env.Program('factory','factory2.cc')
Modified: code/gazebo/trunk/server/CMakeLists.txt
===================================================================
--- code/gazebo/trunk/server/CMakeLists.txt 2009-05-15 15:56:54 UTC (rev
7670)
+++ code/gazebo/trunk/server/CMakeLists.txt 2009-05-15 16:01:59 UTC (rev
7671)
@@ -122,9 +122,3 @@
INSTALL (TARGETS gazebo-exec DESTINATION ${CMAKE_INSTALL_PREFIX}/bin)
INSTALL (TARGETS gazebo_server DESTINATION ${CMAKE_INSTALL_PREFIX}/lib)
INSTALL (FILES ${gazeboserver_headers} DESTINATION
${CMAKE_INSTALL_PREFIX}/include/gazebo COMPONENT headers)
-
-########################################
-# Make the gazebo rc file
-CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/cmake/gazeborc.cmake
${CMAKE_CURRENT_BINARY_DIR}/.gazeborc @ONLY)
-INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/.gazeborc DESTINATION $ENV{HOME}/)
-
Modified: code/gazebo/trunk/server/Simulator.cc
===================================================================
--- code/gazebo/trunk/server/Simulator.cc 2009-05-15 15:56:54 UTC (rev
7670)
+++ code/gazebo/trunk/server/Simulator.cc 2009-05-15 16:01:59 UTC (rev
7671)
@@ -357,6 +357,8 @@
this->gui->Update();
}
+ World::Instance()->ProcessEntitiesToLoad();
+
currTime = this->GetWallTime();
if (currTime - lastTime < 1/freq)
Modified: code/gazebo/trunk/server/World.cc
===================================================================
--- code/gazebo/trunk/server/World.cc 2009-05-15 15:56:54 UTC (rev 7670)
+++ code/gazebo/trunk/server/World.cc 2009-05-15 16:01:59 UTC (rev 7671)
@@ -212,6 +212,7 @@
this->toAddModels.clear();
this->toDeleteModels.clear();
+ this->toLoadEntities.clear();
this->graphics->Init();
@@ -362,6 +363,43 @@
}
////////////////////////////////////////////////////////////////////////////////
+// Add a new entity to the world
+void World::InsertEntity( const std::string xmlString)
+{
+ this->toLoadEntities.push_back( xmlString );
+}
+
+////////////////////////////////////////////////////////////////////////////////
+// Load all the entities that have been queued
+void World::ProcessEntitiesToLoad()
+{
+ std::vector< std::string >::iterator iter;
+
+ for (iter = this->toLoadEntities.begin();
+ iter != this->toLoadEntities.end(); iter++)
+ {
+ // Create the world file
+ XMLConfig *xmlConfig = new XMLConfig();
+
+ // Load the XML tree from the given string
+ try
+ {
+ xmlConfig->LoadString( *iter );
+ }
+ catch (gazebo::GazeboError e)
+ {
+ gzerr(0) << "The world could not load the XML data [" << e << "]\n";
+ continue;
+ }
+
+ this->LoadEntities( xmlConfig->GetRootNode(), NULL, true);
+ delete xmlConfig;
+ }
+
+ this->toLoadEntities.clear();
+}
+
+////////////////////////////////////////////////////////////////////////////////
/// Delete an entity by name
void World::DeleteEntity(const char *name)
{
Modified: code/gazebo/trunk/server/World.hh
===================================================================
--- code/gazebo/trunk/server/World.hh 2009-05-15 15:56:54 UTC (rev 7670)
+++ code/gazebo/trunk/server/World.hh 2009-05-15 16:01:59 UTC (rev 7671)
@@ -29,6 +29,8 @@
#include <iostream>
#include <vector>
+#include <boost/tuple/tuple.hpp>
+
#include "SingletonT.hh"
#include "Vector3.hh"
#include "Pose3d.hh"
@@ -115,8 +117,18 @@
/// \param node XMLConfg node pointer
/// \param parent Parent of the model to load
/// \param removeDuplicate Remove existing model of same name
- public: void LoadEntities(XMLConfigNode *node, Model *parent, bool
removeDuplicate);
+ public: void LoadEntities(XMLConfigNode *node, Model *parent,
+ bool removeDuplicate);
+ /// \brief Insert an entity into the world. This function pushes the model
+ // (encoded as an XML string) onto a list. The Graphics Thread will then
+ // call the ProcessEntitiesToLoad function to actually make the new
+ // entities. This Producer-Consumer model is necessary for thread safety.
+ public: void InsertEntity(const std::string xmlString);
+
+ /// \brief Load all the entities that have been queued
+ public: void ProcessEntitiesToLoad();
+
/// \brief Delete an entity by name
/// \param name The name of the entity to delete
public: void DeleteEntity(const char *name);
@@ -202,6 +214,8 @@
/// List of models to delete from the world
private: std::vector< Model* > toDeleteModels;
+ private: std::vector< std::string > toLoadEntities;
+
/// Simulator control interface
private: Server *server;
Modified: code/gazebo/trunk/server/controllers/factory/Factory.cc
===================================================================
--- code/gazebo/trunk/server/controllers/factory/Factory.cc 2009-05-15
15:56:54 UTC (rev 7670)
+++ code/gazebo/trunk/server/controllers/factory/Factory.cc 2009-05-15
16:01:59 UTC (rev 7671)
@@ -101,27 +101,9 @@
xmlString = this->xmlPrefix + xmlMiddle + this->xmlSuffix;
- // Create the world file
- XMLConfig *xmlConfig = new XMLConfig();
-
- // Load the XML tree from the given string
- try
- {
- xmlConfig->LoadString( xmlString );
- }
- catch (gazebo::GazeboError e)
- {
- std::cerr << "The controlled factory could not load its XML data [" << e
<< "]\n";
- return;
- }
-
// Add the new models into the World
- World::Instance()->LoadEntities( xmlConfig->GetRootNode(), NULL, true );
+ World::Instance()->InsertEntity( xmlString);
- // Cleanup
- delete xmlConfig;
- xmlConfig = NULL;
-
strcpy((char*)this->factoryIface->data->newModel,"");
}
Modified: code/gazebo/trunk/server/gui/CMakeLists.txt
===================================================================
--- code/gazebo/trunk/server/gui/CMakeLists.txt 2009-05-15 15:56:54 UTC (rev
7670)
+++ code/gazebo/trunk/server/gui/CMakeLists.txt 2009-05-15 16:01:59 UTC (rev
7671)
@@ -1,7 +1,3 @@
-INCLUDE_DIRECTORIES(
- ${FLTK_INCLUDE_DIR}
-)
-
SET (sources Gui.cc
GLWindow.cc
MainMenu.cc
Modified: code/gazebo/trunk/server/rendering/OgreVisual.cc
===================================================================
--- code/gazebo/trunk/server/rendering/OgreVisual.cc 2009-05-15 15:56:54 UTC
(rev 7670)
+++ code/gazebo/trunk/server/rendering/OgreVisual.cc 2009-05-15 16:01:59 UTC
(rev 7671)
@@ -170,6 +170,7 @@
}
}
+ std::cout << "Creating Mesh[" << meshName << "]\n";
obj = (Ogre::MovableObject*)this->sceneNode->getCreator()->createEntity(
stream.str(), meshName);
}
Modified: code/gazebo/trunk/worlds/simpleshapes.world
===================================================================
--- code/gazebo/trunk/worlds/simpleshapes.world 2009-05-15 15:56:54 UTC (rev
7670)
+++ code/gazebo/trunk/worlds/simpleshapes.world 2009-05-15 16:01:59 UTC (rev
7671)
@@ -57,6 +57,7 @@
</body:sphere>
</model:physical>
+ <!--
<model:physical name="box1_model">
<xyz>1 1.5 0.25</xyz>
<canonicalBody>box1_body</canonicalBody>
@@ -69,13 +70,13 @@
<visual>
<size>0.5 0.5 0.5</size>
- <mesh>unit_box</mesh>
+ <mesh>pr2/base.mesh</mesh>
<material>Gazebo/Rocky</material>
</visual>
</geom:box>
</body:box>
-
</model:physical>
+ -->
<model:physical name="cylinder1_model">
<xyz>1 -1.5 0.5</xyz>
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables
unlimited royalty-free distribution of the report engine
for externally facing server and web deployment.
http://p.sf.net/sfu/businessobjects
_______________________________________________
Playerstage-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/playerstage-commit