Revision: 7034
          http://playerstage.svn.sourceforge.net/playerstage/?rev=7034&view=rev
Author:   natepak
Date:     2008-09-22 02:50:29 +0000 (Mon, 22 Sep 2008)

Log Message:
-----------
Fixed missing directories

Modified Paths:
--------------
    code/gazebo/trunk/server/Simulator.cc
    code/gazebo/trunk/server/Simulator.hh
    code/gazebo/trunk/server/gui/Toolbar.cc
    code/gazebo/trunk/server/physics/Body.cc
    code/gazebo/trunk/server/physics/Body.hh
    code/gazebo/trunk/server/physics/Geom.cc
    code/gazebo/trunk/server/physics/Geom.hh

Added Paths:
-----------
    code/gazebo/trunk/server/controllers/imu/
    code/gazebo/trunk/server/controllers/imu/Generic_Imu.cc
    code/gazebo/trunk/server/controllers/imu/Generic_Imu.hh
    code/gazebo/trunk/server/controllers/imu/SConscript
    code/gazebo/trunk/server/sensors/imu/
    code/gazebo/trunk/server/sensors/imu/ImuSensor.cc
    code/gazebo/trunk/server/sensors/imu/ImuSensor.hh
    code/gazebo/trunk/server/sensors/imu/SConscript
    code/gazebo/trunk/worlds/models/imu.model

Modified: code/gazebo/trunk/server/Simulator.cc
===================================================================
--- code/gazebo/trunk/server/Simulator.cc       2008-09-21 22:55:45 UTC (rev 
7033)
+++ code/gazebo/trunk/server/Simulator.cc       2008-09-22 02:50:29 UTC (rev 
7034)
@@ -28,6 +28,8 @@
 #include <fstream>
 #include <sys/time.h>
 
+#include "Body.hh"
+#include "Geom.hh"
 #include "Model.hh"
 #include "Entity.hh"
 #include "OgreVisual.hh"
@@ -507,4 +509,26 @@
   return this->selectedEntity;
 }
 
+////////////////////////////////////////////////////////////////////////////////
+/// Get the model that currently selected
+Model *Simulator::GetSelectedModel() const
+{
+  Model *model = NULL;
+  Body *body = NULL;
+  Geom *geom = NULL;
 
+  if (!this->selectedEntity)
+    return NULL;
+
+  if ( (model = dynamic_cast<Model*>(this->selectedEntity)) != NULL )
+    return model;
+  else
+  {
+    if ( (body = dynamic_cast<Body*>(this->selectedEntity)) != NULL )
+      model = body->GetModel();
+    else if ( (geom = dynamic_cast<Geom*>(this->selectedEntity)) != NULL )
+      model = geom->GetModel();
+    else
+      gzerr(0) << "Unknown type\n";
+  }
+}

Modified: code/gazebo/trunk/server/Simulator.hh
===================================================================
--- code/gazebo/trunk/server/Simulator.hh       2008-09-21 22:55:45 UTC (rev 
7033)
+++ code/gazebo/trunk/server/Simulator.hh       2008-09-22 02:50:29 UTC (rev 
7034)
@@ -45,6 +45,7 @@
   class GazeboConfig;
   class OgreAdaptor;
   class Entity;
+  class Model;
 
 /// \brief The World
 /*
@@ -155,6 +156,9 @@
     /// \brief Get the selected entity
     public: Entity *GetSelectedEntity() const;
 
+    /// \brief Get the model that currently selected
+    public: Model *GetSelectedModel() const;
+
     ///pointer to the XML Data
     private: XMLConfig *xmlFile;
 
@@ -162,7 +166,8 @@
     private: Gui *gui;
 
     private: OgreAdaptor *renderEngine;
-/// Pointer to the selected Gui 
+
+    /// Pointer to the selected Gui 
     private: GazeboConfig *gazeboConfig;
 
     /// Flag to know if we have a simulation loaded

Added: code/gazebo/trunk/server/controllers/imu/Generic_Imu.cc
===================================================================
--- code/gazebo/trunk/server/controllers/imu/Generic_Imu.cc                     
        (rev 0)
+++ code/gazebo/trunk/server/controllers/imu/Generic_Imu.cc     2008-09-22 
02:50:29 UTC (rev 7034)
@@ -0,0 +1,143 @@
+/*
+ *  Gazebo - Outdoor Multi-Robot Simulator
+ *  Copyright (C) 2003
+ *     Nate Koenig & Andrew Howard
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ */
+/*
+ * Desc:  Generic IMU controller.
+ * Author: Matt Thompson
+ * Date: 07 September 2008
+ * SVN info: $Id: $
+ */
+
+#include <algorithm>
+#include <assert.h>
+
+#include "Global.hh"
+#include "XMLConfig.hh"
+#include "Model.hh"
+#include "World.hh"
+#include "gazebo.h"
+#include "GazeboError.hh"
+#include "ControllerFactory.hh"
+#include "Generic_Imu.hh"
+#include "ImuSensor.hh"
+
+using namespace gazebo;
+
+GZ_REGISTER_STATIC_CONTROLLER("generic_imu", Generic_Imu);
+
+////////////////////////////////////////////////////////////////////////////////
+// Constructor
+Generic_Imu::Generic_Imu(Entity *parent)
+    : Controller(parent)
+{
+  this->myParent = dynamic_cast<ImuSensor*>(this->parent);
+
+  if (!this->myParent)
+    gzthrow("GenericImu controller requires an IMU Sensor as its parent");
+
+  this->imuIface = NULL;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+// Destructor
+Generic_Imu::~Generic_Imu()
+{
+}
+
+////////////////////////////////////////////////////////////////////////////////
+// Load the controller
+void Generic_Imu::LoadChild(XMLConfigNode *node)
+{
+  std::vector<Iface*>::iterator iter;
+
+  for (iter = this->ifaces.begin(); iter != this->ifaces.end(); iter++)
+  {
+    if ((*iter)->GetType() == "imu")
+      this->imuIface = dynamic_cast<ImuIface*>(*iter);
+  }
+
+  if (!this->imuIface) gzthrow("GenericImu controller requires a ImuIface");
+
+}
+
+////////////////////////////////////////////////////////////////////////////////
+// Initialize the controller
+void Generic_Imu::InitChild()
+{
+}
+
+////////////////////////////////////////////////////////////////////////////////
+// Update the controller
+void Generic_Imu::UpdateChild()
+{
+  bool imuOpened = false;
+
+  if (this->imuIface->Lock(1))
+  {
+    imuOpened = this->imuIface->GetOpenCount() > 0;
+    this->imuIface->Unlock();
+  }
+
+  if (imuOpened)
+  {
+    this->myParent->SetActive(true);
+    this->PutImuData();
+  }
+
+  if (!imuOpened)
+  {
+    this->myParent->SetActive(false);
+  }
+}
+
+////////////////////////////////////////////////////////////////////////////////
+// Finalize the controller
+void Generic_Imu::FiniChild()
+{
+}
+
+////////////////////////////////////////////////////////////////////////////////
+// Put IMU data to the interface
+void Generic_Imu::PutImuData()
+{
+
+  Pose3d velocity;
+  velocity = this->myParent->GetVelocity();
+
+  if (this->imuIface->Lock(1))
+  {
+    // Data timestamp
+    //this->imuIface->data->head.time = Simulator::Instance()->GetSimTime();
+    
+    this->imuIface->data->velocity.pos.x = velocity.pos.x;
+    this->imuIface->data->velocity.pos.y = velocity.pos.y;
+    this->imuIface->data->velocity.pos.z = velocity.pos.z;
+    this->imuIface->data->velocity.roll = velocity.rot.x;
+    this->imuIface->data->velocity.pitch = velocity.rot.y;
+    this->imuIface->data->velocity.yaw = velocity.rot.z;
+
+    this->imuIface->Unlock();
+
+    // New data is available
+    this->imuIface->Post();
+  }
+}
+
+}

Added: code/gazebo/trunk/server/controllers/imu/Generic_Imu.hh
===================================================================
--- code/gazebo/trunk/server/controllers/imu/Generic_Imu.hh                     
        (rev 0)
+++ code/gazebo/trunk/server/controllers/imu/Generic_Imu.hh     2008-09-22 
02:50:29 UTC (rev 7034)
@@ -0,0 +1,81 @@
+/*
+ *  Gazebo - Outdoor Multi-Robot Simulator
+ *  Copyright (C) 2003  
+ *     Nate Koenig & Andrew Howard
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ */
+/*
+ * Desc: generic IMU controller.
+ * Author: Matt Thompson
+ * Date: 07 Sep 2008
+ * SVN: $Id: $
+ */
+
+#ifndef GENERIC_IMU_HH
+#define GENERIC_IMU_HH
+
+#include "Controller.hh"
+
+namespace gazebo
+{
+  class ImuIface;
+  class ImuSensor;
+
+class Generic_Imu : public Controller
+{
+  /// \brief Constructor
+  /// \param parent The parent entity, must be a Model or a Sensor
+  public: Generic_Imu(Entity *parent);
+
+  /// \brief Destructor
+  public: virtual ~Generic_Imu();
+
+  /// \brief Load the controller
+  /// \param node XML config node
+  /// \return 0 on success
+  protected: virtual void LoadChild(XMLConfigNode *node);
+
+  /// \brief Init the controller
+  /// \return 0 on success
+  protected: virtual void InitChild();
+
+  /// \brief Update the controller
+  /// \return 0 on success
+  protected: virtual void UpdateChild();
+
+  /// \brief Finalize the controller
+  /// \return 0 on success
+  protected: virtual void FiniChild();
+
+  /// \brief Put IMU data to the iface
+  private: void PutImuData();
+
+  /// The IMU interface
+  private: ImuIface *imuIface;
+
+  /// The parent sensor
+  private: ImuSensor *myParent;
+
+};
+
+/** /} */
+/// @}
+
+}
+
+#endif
+

Added: code/gazebo/trunk/server/controllers/imu/SConscript
===================================================================
--- code/gazebo/trunk/server/controllers/imu/SConscript                         
(rev 0)
+++ code/gazebo/trunk/server/controllers/imu/SConscript 2008-09-22 02:50:29 UTC 
(rev 7034)
@@ -0,0 +1,6 @@
+#Import variable
+Import('env sharedObjs')
+
+sources = Split('Generic_Imu.cc')
+
+sharedObjs.append(env.SharedObject(sources))

Modified: code/gazebo/trunk/server/gui/Toolbar.cc
===================================================================
--- code/gazebo/trunk/server/gui/Toolbar.cc     2008-09-21 22:55:45 UTC (rev 
7033)
+++ code/gazebo/trunk/server/gui/Toolbar.cc     2008-09-22 02:50:29 UTC (rev 
7034)
@@ -98,49 +98,43 @@
   if (this->entityBrowser->size() == 0)
     this->UpdateEntityBrowser();
 
-  Entity *entity = Simulator::Instance()->GetSelectedEntity();
+  Model *model = Simulator::Instance()->GetSelectedModel();
 
   this->paramCount = 0;
 
-  if (entity)
+  if (model)
   {
     std::string value = "@[EMAIL PROTECTED]@[EMAIL PROTECTED] ";
     this->AddToParamBrowser(value);
-    this->AddEntityToParamBrowser(entity, "");
+    this->AddEntityToParamBrowser(model, "");
 
-    Model *model = dynamic_cast<Model*>(entity);
-    
-    if (model)
+    const std::map<std::string, Body *> *bodies = model->GetBodies();
+    const std::map<std::string, Geom *> *geoms;
+    std::map<std::string, Body*>::const_iterator iter;
+    std::map<std::string, Geom*>::const_iterator giter;
+
+    for (iter = bodies->begin(); iter != bodies->end(); iter++)
     {
-      const std::map<std::string, Body *> *bodies = model->GetBodies();
-      const std::map<std::string, Geom *> *geoms;
-      std::map<std::string, Body*>::const_iterator iter;
-      std::map<std::string, Geom*>::const_iterator giter;
-      std::string value;
+      value = "@[EMAIL PROTECTED]@s-Body:[EMAIL PROTECTED]@[EMAIL PROTECTED]" 
+ iter->second->GetName();
+      this->AddToParamBrowser(value);
+      this->AddEntityToParamBrowser( iter->second, "  " );
 
-      for (iter = bodies->begin(); iter != bodies->end(); iter++)
+      geoms = iter->second->GetGeoms();
+
+      for (giter = geoms->begin(); giter != geoms->end(); giter++)
       {
-        value = "@[EMAIL PROTECTED]@s-Body:[EMAIL PROTECTED]@[EMAIL 
PROTECTED]" + iter->second->GetName();
+        value = "@[EMAIL PROTECTED]@s  -Geom:[EMAIL PROTECTED]@[EMAIL 
PROTECTED]" + giter->second->GetName();
         this->AddToParamBrowser(value);
-        this->AddEntityToParamBrowser( iter->second, "  " );
+        this->AddEntityToParamBrowser( giter->second, "    " );
 
-        geoms = iter->second->GetGeoms();
-
-        for (giter = geoms->begin(); giter != geoms->end(); giter++)
+        for (unsigned int i=0; i < giter->second->GetVisualCount(); i++)
         {
-          value = "@[EMAIL PROTECTED]@s  -Geom:[EMAIL PROTECTED]@[EMAIL 
PROTECTED]" + giter->second->GetName();
+          OgreVisual *vis = giter->second->GetVisual(i);
+          std::ostringstream stream;
+          stream << vis->GetId();
+          value = "@[EMAIL PROTECTED]@s    -Visual:[EMAIL PROTECTED]@[EMAIL 
PROTECTED]" + stream.str();
           this->AddToParamBrowser(value);
-          this->AddEntityToParamBrowser( giter->second, "    " );
-
-          for (unsigned int i=0; i < giter->second->GetVisualCount(); i++)
-          {
-            OgreVisual *vis = giter->second->GetVisual(i);
-            std::ostringstream stream;
-            stream << vis->GetId();
-            value = "@[EMAIL PROTECTED]@s    -Visual:[EMAIL PROTECTED]@[EMAIL 
PROTECTED]" + stream.str();
-            this->AddToParamBrowser(value);
-            this->AddEntityToParamBrowser( vis, "      " );
-          }
+          this->AddEntityToParamBrowser( vis, "      " );
         }
       }
     }
@@ -168,10 +162,32 @@
   int endLbl = 0;
   int beginValue = 0;
 
-  if (lineText.find("-Body") != std::string::npos || 
-      lineText.find("-Geom") != std::string::npos)
+  if (lineText.find("-Body") != std::string::npos)
   {
+    /*beginLbl = lineText.rfind("@") + 2;
+
+    std::string bodyName = lineText.substr(beginLbl, lineText.size()-beginLbl);
+    std::cout << "Body Name[" << bodyName << "]\n";
+
+    Model *model = Simulator::Instance()->GetSelectedModel();
+    Body *body = model->GetBody(bodyName);
+    Simulator::Instance()->SetSelectedEntity(body);
+    */
+  }
+  else if (lineText.find("-Geom") != std::string::npos)
+  {
+    /*beginLbl = lineText.rfind("@") + 2;
+
+    std::string geomName = lineText.substr(beginLbl, lineText.size()-beginLbl);
+    std::cout << "Geom Name[" << geomName << "]\n";
+
+    Model *model = Simulator::Instance()->GetSelectedModel();
+    Geom *geom = model->GetGeom(geomName);
+    Simulator::Instance()->SetSelectedEntity(geom);
+
     toolbar->paramInput->deactivate();
+    Simulator::Instance()->SetSelectedEntity( );
+    */
     return;
   }
   else

Modified: code/gazebo/trunk/server/physics/Body.cc
===================================================================
--- code/gazebo/trunk/server/physics/Body.cc    2008-09-21 22:55:45 UTC (rev 
7033)
+++ code/gazebo/trunk/server/physics/Body.cc    2008-09-22 02:50:29 UTC (rev 
7034)
@@ -697,6 +697,13 @@
 }
 
 
////////////////////////////////////////////////////////////////////////////////
+/// Get the model that this body belongs to
+Model *Body::GetModel() const
+{
+  return dynamic_cast<Model*>(this->GetParent());
+}
+ 
+////////////////////////////////////////////////////////////////////////////////
 /// Get a geom by name
 Geom *Body::GetGeom(const std::string &name) const
 {

Modified: code/gazebo/trunk/server/physics/Body.hh
===================================================================
--- code/gazebo/trunk/server/physics/Body.hh    2008-09-21 22:55:45 UTC (rev 
7033)
+++ code/gazebo/trunk/server/physics/Body.hh    2008-09-22 02:50:29 UTC (rev 
7034)
@@ -39,6 +39,7 @@
 
 namespace gazebo
 {
+  class Model;
   class Geom;
   class Sensor;
 
@@ -145,6 +146,9 @@
 
     /// \brief Get a geom by name
     public: Geom *GetGeom(const std::string &name) const;
+
+    /// \brief Get the model that this body belongs to
+    public: Model *GetModel() const;
   
     /// Load a new geom helper function
     /// \param node XMLConfigNode used to load the geom

Modified: code/gazebo/trunk/server/physics/Geom.cc
===================================================================
--- code/gazebo/trunk/server/physics/Geom.cc    2008-09-21 22:55:45 UTC (rev 
7033)
+++ code/gazebo/trunk/server/physics/Geom.cc    2008-09-22 02:50:29 UTC (rev 
7034)
@@ -546,3 +546,17 @@
 
   return NULL;
 }
+
+////////////////////////////////////////////////////////////////////////////////
+/// Get the body this geom belongs to
+Body *Geom::GetBody() const
+{
+  return this->body;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+/// Get the model this geom belongs to
+Model *Geom::GetModel() const
+{
+  return this->body->GetModel();
+}

Modified: code/gazebo/trunk/server/physics/Geom.hh
===================================================================
--- code/gazebo/trunk/server/physics/Geom.hh    2008-09-21 22:55:45 UTC (rev 
7033)
+++ code/gazebo/trunk/server/physics/Geom.hh    2008-09-22 02:50:29 UTC (rev 
7034)
@@ -37,6 +37,7 @@
 namespace gazebo
 {
 
+  class Model;
   class Body;
   class ContactParams;
   class XMLConfigNode;
@@ -152,8 +153,15 @@
     /// \brief Get a visual by id
     public: OgreVisual *GetVisualById( int id ) const;
 
+    /// \brief Get the body this geom belongs to
+    public: Body *GetBody() const;
+
+    /// \brief Get the model this geom belongs to
+    public: Model *GetModel() const;
+
     ///  Contact parameters
     public: ContactParams *contact; 
+
   
     /// The body this geom belongs to
     protected: Body *body;

Added: code/gazebo/trunk/server/sensors/imu/ImuSensor.cc
===================================================================
--- code/gazebo/trunk/server/sensors/imu/ImuSensor.cc                           
(rev 0)
+++ code/gazebo/trunk/server/sensors/imu/ImuSensor.cc   2008-09-22 02:50:29 UTC 
(rev 7034)
@@ -0,0 +1,145 @@
+/*
+ *  Gazebo - Outdoor Multi-Robot Simulator
+ *  Copyright (C) 2003
+ *     Nate Koenig & Andrew Howard
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ */
+/* Desc: IMU sensor
+ * Author: Matt Thompson
+ * Date: 6 September 2008
+ * SVN: $Id: $
+*/
+
+#include <assert.h>
+#include <float.h>
+#include <sstream>
+
+#include "SensorFactory.hh"
+#include "XMLConfig.hh"
+#include "Global.hh"
+#include "World.hh"
+#include "PhysicsEngine.hh"
+#include "GazeboError.hh"
+#include "ODEPhysics.hh"
+#include "XMLConfig.hh"
+#include "Controller.hh"
+#include "ImuSensor.hh"
+
+#include "Vector3.hh"
+
+using namespace gazebo;
+
+GZ_REGISTER_STATIC_SENSOR("imu", ImuSensor);
+
+//////////////////////////////////////////////////////////////////////////////
+// Constructor
+ImuSensor::ImuSensor(Body *body)
+    : Sensor(body)
+{
+  this->active = false;
+
+  this->typeName = "imu";
+}
+
+
+//////////////////////////////////////////////////////////////////////////////
+// Destructor
+ImuSensor::~ImuSensor()
+{
+}
+
+//////////////////////////////////////////////////////////////////////////////
+/// Load the ray using parameter from an XMLConfig node
+void ImuSensor::LoadChild(XMLConfigNode *node)
+{
+  if (this->body == NULL)
+  {
+    gzthrow("Null body in the IMU sensor");
+  }
+
+}
+
+//////////////////////////////////////////////////////////////////////////////
+/// Save the sensor info in XML format
+void ImuSensor::SaveChild(std::string &prefix, std::ostream &stream)
+{
+}
+
+//////////////////////////////////////////////////////////////////////////////
+// Init the IMU
+void ImuSensor::InitChild()
+{
+  Pose3d bodyPose;
+  bodyPose = this->body->GetPose();
+  this->prevPose = bodyPose;
+}
+
+void ImuSensor::FiniChild()
+{
+}
+
+Pose3d ImuSensor::GetVelocity()
+{
+  return this->imuVel;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+// Update the sensor information
+void ImuSensor::UpdateChild()
+{
+//  if (this->active)
+  {
+    Vector3 velocity;
+    Pose3d poseDelta;
+    double heading;
+    double v1;
+
+    double vlong, vlat;
+
+    //Quatern rot;
+    Vector3 rot;
+    Vector3 pose;
+
+    // Get the pose of the sensor body (global cs)
+    poseDelta = this->body->GetPose() - this->prevPose;
+    this->prevPose = this->body->GetPose();
+
+    velocity = this->body->GetLinearVel();
+    rot = this->body->GetRotation().GetAsEuler();
+    pose = this->body->GetPosition();
+
+    heading = atan2(velocity.y, velocity.x);
+
+    v1 = sqrt(pow(velocity.x,2) + pow(velocity.y,2));
+
+    vlong = v1 * cos(heading - rot.z);
+    vlat = v1 * sin(heading - rot.z);
+   
+    this->imuVel.pos.x = vlong; 
+    this->imuVel.pos.y = vlat; 
+
+    this->imuVel.pos.z = 0;
+   
+    velocity = this->body->GetAngularVel();
+    this->imuVel.rot.x = velocity.x;
+    this->imuVel.rot.y = velocity.y;
+    this->imuVel.rot.z = velocity.z;
+
+  }
+}
+
+}

Added: code/gazebo/trunk/server/sensors/imu/ImuSensor.hh
===================================================================
--- code/gazebo/trunk/server/sensors/imu/ImuSensor.hh                           
(rev 0)
+++ code/gazebo/trunk/server/sensors/imu/ImuSensor.hh   2008-09-22 02:50:29 UTC 
(rev 7034)
@@ -0,0 +1,70 @@
+/*
+ *  Gazebo - Outdoor Multi-Robot Simulator
+ *  Copyright (C) 2003  
+ *     Nate Koenig & Andrew Howard
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ */
+
+#ifndef IMUSENSOR_HH
+#define IMUSENSOR_HH
+
+#include <vector>
+
+#include "Sensor.hh"
+#include "Body.hh"
+
+namespace gazebo
+{
+
+class XMLConfigNode;
+class ImuSensor: public Sensor
+{
+  /// \brief Constructor
+  /// \param body The IMU sensor must be attached to a body.
+  public: ImuSensor(Body *body);
+
+  /// \brief Destructor
+  public: virtual ~ImuSensor();
+
+  /// \param node The XMLConfig node
+  protected: virtual void LoadChild(XMLConfigNode *node);
+
+  /// \brief Save the sensor info in XML format
+  protected: virtual void SaveChild(std::string &prefix, std::ostream &stream);
+
+  /// Initialize the ray
+  protected: virtual void InitChild();
+
+  ///  Update sensed values
+  protected: virtual void UpdateChild();
+  
+  /// Finalize the ray
+  protected: virtual void FiniChild();
+
+  public: Pose3d GetVelocity();
+
+  private: Pose3d prevPose;
+  private: Pose3d imuVel;
+/*
+  private: ParamT<int> *rayCountP;
+  private: ParamT<int> *rangeCountP;
+*/
+  
+
+};
+
+#endif

Added: code/gazebo/trunk/server/sensors/imu/SConscript
===================================================================
--- code/gazebo/trunk/server/sensors/imu/SConscript                             
(rev 0)
+++ code/gazebo/trunk/server/sensors/imu/SConscript     2008-09-22 02:50:29 UTC 
(rev 7034)
@@ -0,0 +1,6 @@
+#Import variable
+Import('env sharedObjs')
+
+sources = Split('ImuSensor.cc')
+
+sharedObjs.append(env.SharedObject(sources))

Added: code/gazebo/trunk/worlds/models/imu.model
===================================================================
--- code/gazebo/trunk/worlds/models/imu.model                           (rev 0)
+++ code/gazebo/trunk/worlds/models/imu.model   2008-09-22 02:50:29 UTC (rev 
7034)
@@ -0,0 +1,41 @@
+<?xml version="1.0"?>
+
+<model:physical name="default_generic_imu__model"
+  xmlns:model="http://playerstage.sourceforge.net/gazebo/xmlschema/#model"; 
+  
xmlns:controller="http://playerstage.sourceforge.net/gazebo/xmlschema/#controller";
 
+  
xmlns:interface="http://playerstage.sourceforge.net/gazebo/xmlschema/#interface";
 
+  xmlns:sensor="http://playerstage.sourceforge.net/gazebo/xmlschema/#sensor"; 
+  xmlns:body="http://playerstage.sourceforge.net/gazebo/xmlschema/#body"; 
+  xmlns:geom="http://playerstage.sourceforge.net/gazebo/xmlschema/#geom"; 
+  xmlns:joint="http://playerstage.sourceforge.net/gazebo/xmlschema/#joint"; 
+  >
+
+  <xyz>0 0.0 0.0</xyz>
+  <rpy>0 0 0</rpy>
+  <canonicalBody>imu_body</canonicalBody>
+
+  <body:box name="imu_body">
+    <xyz>0.0 0.0 0.0</xyz>
+    <rpy>0.0 0.0 0.0</rpy>
+
+    <geom:box name="imu_geom1">
+      <xyz>0.0 0.0 0.0</xyz>
+      <rpy>0 0 90</rpy>
+      <size>0.1 0.1 0.1</size>
+      <mass>0.01</mass>
+
+      <visual>
+        <scale>0.07 0.07 0.1</scale>
+        <mesh>unit_box</mesh>
+        <material>Gazebo/Green</material>
+      </visual>
+    </geom:box>
+
+    <sensor:imu name="imu_1">
+      <controller:generic_imu name="imu_controller_1">
+        <interface:imu name="imu_iface_0"/>
+      </controller:generic_imu>
+    </sensor:imu>
+  </body:box>
+
+</model:physical>


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

Reply via email to