Revision: 6589
          http://playerstage.svn.sourceforge.net/playerstage/?rev=6589&view=rev
Author:   natepak
Date:     2008-06-16 13:04:26 -0700 (Mon, 16 Jun 2008)

Log Message:
-----------
Updated the gripper driver and interface

Modified Paths:
--------------
    code/gazebo/trunk/player/GripperInterface.cc
    code/gazebo/trunk/server/controllers/gripper/pioneer2/Pioneer2_Gripper.cc
    code/gazebo/trunk/server/physics/Geom.cc
    code/gazebo/trunk/server/physics/SliderJoint.cc
    code/gazebo/trunk/server/rendering/OgreCreator.cc
    code/gazebo/trunk/server/rendering/OgreCreator.hh
    code/gazebo/trunk/server/rendering/OgreVisual.cc
    code/gazebo/trunk/server/rendering/OgreVisual.hh
    code/gazebo/trunk/worlds/test.world

Modified: code/gazebo/trunk/player/GripperInterface.cc
===================================================================
--- code/gazebo/trunk/player/GripperInterface.cc        2008-06-16 19:59:31 UTC 
(rev 6588)
+++ code/gazebo/trunk/player/GripperInterface.cc        2008-06-16 20:04:26 UTC 
(rev 6589)
@@ -77,9 +77,6 @@
 
   if (this->iface->Lock(1))
   {
-
-    //   This code works with Player CVS
-#ifdef PLAYER_GRIPPER_CMD_OPEN
     if (Message::MatchMessage(hdr, PLAYER_MSGTYPE_CMD,
           PLAYER_GRIPPER_CMD_OPEN, this->device_addr))
     {
@@ -143,7 +140,6 @@
 
       return 0;
     }
-#endif
 
     this->iface->Unlock();
   }

Modified: 
code/gazebo/trunk/server/controllers/gripper/pioneer2/Pioneer2_Gripper.cc
===================================================================
--- code/gazebo/trunk/server/controllers/gripper/pioneer2/Pioneer2_Gripper.cc   
2008-06-16 19:59:31 UTC (rev 6588)
+++ code/gazebo/trunk/server/controllers/gripper/pioneer2/Pioneer2_Gripper.cc   
2008-06-16 20:04:26 UTC (rev 6589)
@@ -91,6 +91,34 @@
 // Update the controller
 void Pioneer2_Gripper::UpdateChild(UpdateParams &params)
 {
+  /*double leftPaddleHiStop = this->joints[LEFT]->GetParam(dParamHiStop);
+  double leftPaddleLoStop = this->joints[LEFT]->GetParam(dParamLoStop);
+  double rightPaddleHiStop = this->joints[RIGHT]->GetParam(dParamHiStop);
+  double rightPaddleLoStop = this->joints[RIGHT]->GetParam(dParamLoStop);
+
+  double leftPaddlePos = this->joints[LEFT]->GetPosition();
+  double rightPaddlePos = this->joints[RIGHT]->GetPosition();
+  */
+
+  this->myIface->Lock(1);
+
+  switch( this->myIface->data->cmd)
+  {
+    case GAZEBO_GRIPPER_CMD_OPEN:
+        this->joints[RIGHT]->SetParam(dParamVel,0.1);
+        this->joints[LEFT]->SetParam(dParamVel, -0.1);
+      break;
+
+    case GAZEBO_GRIPPER_CMD_CLOSE:
+      this->joints[RIGHT]->SetParam(dParamVel,-0.1);
+      this->joints[LEFT]->SetParam(dParamVel,0.1);
+      break;
+  }
+
+  this->joints[LEFT]->SetParam(dParamFMax,.01);
+  this->joints[RIGHT]->SetParam(dParamFMax,.01);
+
+  this->myIface->Unlock();
 }
 
 
////////////////////////////////////////////////////////////////////////////////

Modified: code/gazebo/trunk/server/physics/Geom.cc
===================================================================
--- code/gazebo/trunk/server/physics/Geom.cc    2008-06-16 19:59:31 UTC (rev 
6588)
+++ code/gazebo/trunk/server/physics/Geom.cc    2008-06-16 20:04:26 UTC (rev 
6589)
@@ -27,7 +27,6 @@
 #include <sstream>
 
 #include "OgreVisual.hh"
-#include "OgreCreator.hh"
 #include "Global.hh"
 #include "GazeboMessage.hh"
 #include "ContactParams.hh"
@@ -124,7 +123,7 @@
   while (childNode)
   {
     OgreVisual *visual = new OgreVisual(this->visualNode);
-    OgreCreator::CreateVisual(childNode,visual);
+    visual->Load(childNode);
     this->visuals.push_back(visual);
     childNode = childNode->GetNext("visual");
   }
@@ -461,10 +460,22 @@
 /// Set the visibility of the joints of this geometry
 void Geom::ShowJoints(bool show)
 {
+  std::vector<OgreVisual*>::iterator iter;
+
   if (show)
-    this->visualNode->SetTransparency(0.6);
+  {
+    for (iter = this->visuals.begin(); iter != this->visuals.end(); iter++)
+    {
+      (*iter)->SetTransparency(0.6);
+    }
+  }
   else
-    this->visualNode->SetTransparency(0);
+  {
+    for (iter = this->visuals.begin(); iter != this->visuals.end(); iter++)
+    {
+      (*iter)->SetTransparency(0.0);
+    }
+  }
 }
 
 
////////////////////////////////////////////////////////////////////////////////

Modified: code/gazebo/trunk/server/physics/SliderJoint.cc
===================================================================
--- code/gazebo/trunk/server/physics/SliderJoint.cc     2008-06-16 19:59:31 UTC 
(rev 6588)
+++ code/gazebo/trunk/server/physics/SliderJoint.cc     2008-06-16 20:04:26 UTC 
(rev 6589)
@@ -51,7 +51,7 @@
   this->SetAxis(node->GetVector3("axis",Vector3(0,0,1)));
 
   double lowStop = node->GetDouble("lowStop",-DBL_MAX,0);
-  double hiStop = node->GetDouble("hiStop",DBL_MAX,0);
+  double hiStop = node->GetDouble("highStop",DBL_MAX,0);
 
   // Perform this three step ordering to ensure the parameters are set
   // properly. This is taken from the ODE wiki.

Modified: code/gazebo/trunk/server/rendering/OgreCreator.cc
===================================================================
--- code/gazebo/trunk/server/rendering/OgreCreator.cc   2008-06-16 19:59:31 UTC 
(rev 6588)
+++ code/gazebo/trunk/server/rendering/OgreCreator.cc   2008-06-16 20:04:26 UTC 
(rev 6589)
@@ -98,71 +98,7 @@
   //return visual;
 }
 
-void OgreCreator::CreateVisual(XMLConfigNode *node, OgreVisual *parent)
-{
-  std::ostringstream stream;
-  Pose3d pose;
-  Vector3 size;
-  Ogre::Vector3 meshSize;
-  Ogre::MovableObject *obj = NULL;
 
-  std::string meshName = node->GetString("mesh","",1);
-
-  // Read the desired position and rotation of the mesh
-  pose.pos = node->GetVector3("xyz", Vector3(0,0,0));
-  pose.rot = node->GetRotation("rpy", Quatern());
-
-  try
-  {
-    // Create the entity
-    stream << parent->GetName() << "_ENTITY";
-    obj = 
(Ogre::MovableObject*)parent->GetSceneNode()->getCreator()->createEntity(stream.str(),
 meshName);
-  }
-  catch (Ogre::Exception e)
-  {
-    std::cerr << "Ogre Error:" << e.getFullDescription() << "\n";
-    gzthrow("Unable to create a mesh from " + meshName);
-  }
-
-  // Set the pose of the scene node
-  parent->SetPose(pose);
-
-  // Attach the entity to the node
-  if (obj)
-  {
-    parent->AttachObject(obj);
-    obj->setVisibilityFlags(GZ_ALL_CAMERA);
-    meshSize = obj->getBoundingBox().getSize();
-  }
-  
-  // Get the desired size of the mesh
-  if (node->GetChild("size") != NULL)
-    size = node->GetVector3("size",Vector3(1,1,1));
-  else
-    size = Vector3(meshSize.x, meshSize.y, meshSize.z);
-
-  // Get and set teh desired scale of the mesh
-  if (node->GetChild("scale") != NULL)
-  {
-    Vector3 scale = node->GetVector3("scale",Vector3(1,1,1));
-    parent->SetScale(scale);
-  }
-  else
-  {
-    parent->SetScale(Vector3(size.x/meshSize.x, size.y/meshSize.y, 
size.z/meshSize.z));
-  }
-
-
-  // Set the material of the mesh
-  parent->SetMaterial(node->GetString("material",std::string(),1));
-
-  // Allow the mesh to cast shadows
-  parent->SetCastShadows(node->GetBool("castShadows",true,0));
-
-  parent->SetXML(node);
-}
-
-  
 
////////////////////////////////////////////////////////////////////////////////
 /// Create a light source and attach it to the visual node
 /// Note that the properties here are not modified afterwards and thus, 

Modified: code/gazebo/trunk/server/rendering/OgreCreator.hh
===================================================================
--- code/gazebo/trunk/server/rendering/OgreCreator.hh   2008-06-16 19:59:31 UTC 
(rev 6588)
+++ code/gazebo/trunk/server/rendering/OgreCreator.hh   2008-06-16 20:04:26 UTC 
(rev 6589)
@@ -63,9 +63,6 @@
     ///properties if needed, to avoid this create a child visual node for the 
plane
     public: static void CreatePlane(XMLConfigNode *node, OgreVisual *parent);
     
-    ///\brief Create a visual entity
-    public: static void CreateVisual(XMLConfigNode *node, OgreVisual *parent);
-        
     /// \brief Create a light source 
     public: static void CreateLight(XMLConfigNode *node, OgreVisual *parent);
 

Modified: code/gazebo/trunk/server/rendering/OgreVisual.cc
===================================================================
--- code/gazebo/trunk/server/rendering/OgreVisual.cc    2008-06-16 19:59:31 UTC 
(rev 6588)
+++ code/gazebo/trunk/server/rendering/OgreVisual.cc    2008-06-16 20:04:26 UTC 
(rev 6589)
@@ -76,10 +76,8 @@
 }
 
 
-
 
////////////////////////////////////////////////////////////////////////////////
 // Load the visual
-/*
 void OgreVisual::Load(XMLConfigNode *node)
 {
   std::ostringstream stream;
@@ -130,7 +128,6 @@
   if (node->GetChild("scale") != NULL)
   {
     Vector3 scale = node->GetVector3("scale",Vector3(1,1,1));
-
     this->sceneNode->setScale(scale.x, scale.y, scale.z);
   }
   else
@@ -144,8 +141,9 @@
 
   // Allow the mesh to cast shadows
   this->SetCastShadows(node->GetBool("castShadows",true,0));
+
+  this->SetXML(node);
 }
-*/
 
 void OgreVisual::Save()
 {
@@ -285,6 +283,7 @@
   if (this->myMaterial.isNull())
   {
     gzmsg(0) << "The visual " << this->sceneNode->getName() << " can't set 
transparency for this geom without a material\n";
+
     return;
   }
 
@@ -300,7 +299,7 @@
 
     while (passIt.hasMoreElements ())
     {
-      sc = this->origMaterial->getTechnique (i)->getPass (j)->getDiffuse ();
+      sc = this->origMaterial->getTechnique(i)->getPass(j)->getDiffuse();
 
       if (this->transparency >0.0)
         passIt.peekNext ()->setDepthWriteEnabled (false);
@@ -315,14 +314,14 @@
           dc.r -= sc.r * this->transparency;
           dc.g -= sc.g  * this->transparency;
           dc.b -= sc.b * this->transparency;
-          passIt.peekNext ()->setAmbient (Ogre::ColourValue::Black);
+          passIt.peekNext()->setAmbient(Ogre::ColourValue::Black);
           break;
 
         case Ogre::SBT_TRANSPARENT_ALPHA:
         default:
           dc = sc;
           dc.a = sc.a * (1.0f - this->transparency);
-          passIt.peekNext()->setAmbient(this->origMaterial->getTechnique 
(i)->getPass (j)->getAmbient ());
+          
passIt.peekNext()->setAmbient(this->origMaterial->getTechnique(i)->getPass(j)->getAmbient());
           break;
       }
       passIt.peekNext ()->setDiffuse (dc);
@@ -351,7 +350,7 @@
 
 //FIXME:  Modifying selfIllumination is invasive to the material definition of 
the user
 // Choose other effect.
-
+/*
   Ogre::Technique *t;
   Ogre::Material::TechniqueIterator techniqueIt = 
this->myMaterial->getTechniqueIterator();
   while ( techniqueIt.hasMoreElements() )
@@ -372,6 +371,7 @@
       passIt.moveNext ();
     }
   }
+  */
 
 }
 

Modified: code/gazebo/trunk/server/rendering/OgreVisual.hh
===================================================================
--- code/gazebo/trunk/server/rendering/OgreVisual.hh    2008-06-16 19:59:31 UTC 
(rev 6588)
+++ code/gazebo/trunk/server/rendering/OgreVisual.hh    2008-06-16 20:04:26 UTC 
(rev 6589)
@@ -48,6 +48,9 @@
     /// \brief Destructor
     public: virtual ~OgreVisual();
 
+    /// \brief Load the visual
+    public: void Load(XMLConfigNode *node);
+
     /// \brief Attach a renerable object to the visual
     public: void AttachObject( Ogre::MovableObject *obj);
 

Modified: code/gazebo/trunk/worlds/test.world
===================================================================
--- code/gazebo/trunk/worlds/test.world 2008-06-16 19:59:31 UTC (rev 6588)
+++ code/gazebo/trunk/worlds/test.world 2008-06-16 20:04:26 UTC (rev 6589)
@@ -38,7 +38,7 @@
   </rendering:ogre>
 
   <model:physical name="sphere1_model">
-    <xyz>0 0 9.0</xyz>
+    <xyz>0 0 0.1</xyz>
     <static>false</static>
     <body:sphere name="sphere1_body">
       <geom:sphere name="sphere1_geom">
@@ -54,17 +54,6 @@
     </body:sphere>
   </model:physical>
 
-  <model:physical name="terrain_model">
-    <body:heightmap name ="terrain_body">
-      <geom:heightmap name="terrain_geom">
-        <image>test.jpg</image>
-        <worldTexture>test.jpg</worldTexture>
-        <detailTexture>test.jpg</detailTexture>
-        <size>17 17 1.0</size>
-      </geom:heightmap>
-    </body:heightmap>
-  </model:physical>
-
   <model:physical name="plane1_model">
     <xyz>0 0 0</xyz>
     <static>true</static>
@@ -81,8 +70,8 @@
   </model:physical>
 
   <model:physical name="cam2_model">
-    <xyz>-1.62 10.92 0.77</xyz>
-    <rpy>0 16 -79</rpy>
+    <xyz>-3.0 0 2.59</xyz>
+    <rpy>0 28 -2</rpy>
     <static>true</static>
 
     <body:empty name="cam2_body">
@@ -98,120 +87,4 @@
     </body:empty>
   </model:physical>
 
-  <model:physical name="pioneer2dx_model1">
-    <xyz>-12 0 0.145</xyz>
-    <rpy>0.0 0.0 0.0</rpy>
-
-    <controller:differential_position2d name="controller1">
-      <leftJoint>left_wheel_hinge</leftJoint>
-      <rightJoint>right_wheel_hinge</rightJoint>
-      <wheelSeparation>0.34</wheelSeparation>
-      <wheelDiameter>0.15</wheelDiameter>
-      <torque>5</torque>
-      <interface:position name="position_iface_0"/>
-    </controller:differential_position2d>
-
-    <model:physical name="laser">
-      <xyz>0.15 0 0.18</xyz>
-
-      <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 
-    -->
-    <include embedded="true">
-      <xi:include href="models/pioneer2dx.model" />
-    </include>
-  </model:physical>
-
-  <model:physical name="pioneer2dx_model2">
-    <xyz>12 0 0.145</xyz>
-    <rpy>0.0 0.0 180.0</rpy>
-
-    <model:physical name="laser2">
-      <xyz>0.15 0 0.18</xyz>
-
-      <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 
-    -->
-    <include embedded="true">
-      <xi:include href="models/pioneer2dx.model" />
-    </include>
-  </model:physical>
-
-
-  <model:physical name="pioneer2dx_model3">
-    <xyz>0 5 0.145</xyz>
-    <rpy>0.0 0.0 -90.0</rpy>
-
-    <model:physical name="laser3">
-      <xyz>0.15 0 0.18</xyz>
-
-      <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 
-    -->
-    <include embedded="true">
-      <xi:include href="models/pioneer2dx.model" />
-    </include>
-  </model:physical>
-
-  <model:physical name="pioneer2dx_model4">
-    <xyz>0 -5 0.145</xyz>
-    <rpy>0.0 0.0 90.0</rpy>
-
-    <model:physical name="laser4">
-      <xyz>0.15 0 0.18</xyz>
-
-      <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 
-    -->
-    <include embedded="true">
-      <xi:include href="models/pioneer2dx.model" />
-    </include>
-  </model:physical>
-
-
-
 </gazebo:world>


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

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Playerstage-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/playerstage-commit

Reply via email to