Revision: 7858
          http://playerstage.svn.sourceforge.net/playerstage/?rev=7858&view=rev
Author:   robotos
Date:     2009-06-18 14:32:26 +0000 (Thu, 18 Jun 2009)

Log Message:
-----------
avoid rendering of rays if headless

Modified Paths:
--------------
    code/gazebo/trunk/libgazebo/Server.cc
    code/gazebo/trunk/server/sensors/ray/RaySensor.cc

Modified: code/gazebo/trunk/libgazebo/Server.cc
===================================================================
--- code/gazebo/trunk/libgazebo/Server.cc       2009-06-18 13:04:08 UTC (rev 
7857)
+++ code/gazebo/trunk/libgazebo/Server.cc       2009-06-18 14:32:26 UTC (rev 
7858)
@@ -127,8 +127,7 @@
           std::cout << "directory [" <<  this->filename
             <<  "] already exists (previous crash?)\n"
             << "but the owner gazebo server (pid=" << pid << ") is not 
running.\n" 
-            << "deleting the directory [" <<  this-> filename 
-            << " old  information" ;
+            << "deleting the old information of the directory [" <<  this-> 
filename << "]\n"; 
 
           // remove the existing directory.
           std::string cmd = "rm -rf '" + this->filename + "'";

Modified: code/gazebo/trunk/server/sensors/ray/RaySensor.cc
===================================================================
--- code/gazebo/trunk/server/sensors/ray/RaySensor.cc   2009-06-18 13:04:08 UTC 
(rev 7857)
+++ code/gazebo/trunk/server/sensors/ray/RaySensor.cc   2009-06-18 14:32:26 UTC 
(rev 7858)
@@ -205,16 +205,19 @@
 
       ray = new RayGeom(this->body, (**this->displayRaysP) == "lines");
 
-      if ((**this->displayRaysP) == "fan")
+      if (this->rayFan and this->rayFanOutline)
       {
-        if (i == 0)
+        if ((**this->displayRaysP) == "fan")
         {
-          this->rayFan->AddPoint(start);
-          this->rayFanOutline->AddPoint(start);
+          if (i == 0)
+          {
+            this->rayFan->AddPoint(start);
+            this->rayFanOutline->AddPoint(start);
+          }
+ 
+          this->rayFan->AddPoint(end);
+          this->rayFanOutline->AddPoint(end);
         }
-
-        this->rayFan->AddPoint(end);
-        this->rayFanOutline->AddPoint(end);
       }
 
       ray->SetPoints(start, end);
@@ -223,16 +226,19 @@
     }
   }
 
-  if ((**this->displayRaysP) == "fan")
+  if (this->rayFan and this->rayFanOutline)
   {
-    this->rayFan->AddPoint(this->rayFan->GetPoint(0));
-    this->rayFan->setMaterial("Gazebo/BlueLaser");
+    if ((**this->displayRaysP) == "fan")
+    {
+      this->rayFan->AddPoint(this->rayFan->GetPoint(0));
+      this->rayFan->setMaterial("Gazebo/BlueLaser");
 
-    this->rayFanOutline->AddPoint(this->rayFanOutline->GetPoint(0));
-    this->rayFanOutline->setMaterial("Gazebo/BlueEmissive");
+      this->rayFanOutline->AddPoint(this->rayFanOutline->GetPoint(0));
+      this->rayFanOutline->setMaterial("Gazebo/BlueEmissive");
 
-    this->visualNode->AttachObject(this->rayFan);
-    this->visualNode->AttachObject(this->rayFanOutline);
+      this->visualNode->AttachObject(this->rayFan);
+      this->visualNode->AttachObject(this->rayFanOutline);
+    }
   }
 
 }
@@ -416,17 +422,20 @@
         this, &UpdateCallback );
     ode->UnlockMutex();
 
-    if ((**this->displayRaysP) == "fan")
-    { 
-      i = 1;
-      for (iter = this->rays.begin(); iter != this->rays.end(); iter++, i++)
-      {
-        (*iter)->Update();
+    if (this->rayFan and this->rayFanOutline)
+    {
+      if ((**this->displayRaysP) == "fan")
+      { 
+        i = 1;
+        for (iter = this->rays.begin(); iter != this->rays.end(); iter++, i++)
+        {
+          (*iter)->Update();
 
-        (*iter)->GetRelativePoints(a,b);
+          (*iter)->GetRelativePoints(a,b);
 
-        this->rayFan->SetPoint(i,b);
-        this->rayFanOutline->SetPoint(i,b);
+          this->rayFan->SetPoint(i,b);
+          this->rayFanOutline->SetPoint(i,b);
+        }
       }
     }
   }


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
Playerstage-commit@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/playerstage-commit

Reply via email to