Update of /cvsroot/playerstage/code/gazebo/server/models/Pioneer2DX
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13268/Pioneer2DX

Added Files:
      Tag: ogre
        Pioneer2DX.cc Pioneer2DX.hh SConscript 
Log Message:
updates

--- NEW FILE: Pioneer2DX.cc ---
#include <stdio.h>
#include "Body.hh"
#include "PlaneGeom.hh"
#include "SphereGeom.hh"
#include "BoxGeom.hh"
#include "HingeJoint.hh"
#include "CylinderGeom.hh"
#include "ModelFactory.hh"
#include "XMLConfig.hh"
#include "Global.hh"
#include "gazebo.h"
#include "World.hh"
#include "Pioneer2DX.hh"

GZ_REGISTER_STATIC("pioneer2dx", Pioneer2DX);

Pioneer2DX::Pioneer2DX()
{
}

Pioneer2DX::~Pioneer2DX()
{
}

// Load the child model
int Pioneer2DX::LoadChild(XMLConfigNode * /*node*/)
{
}

// Initialize the child model
int Pioneer2DX::InitChild()
{
  // Set initial interface state

  this->position_iface->data->cmd_enable_motors = 1;

  // Reset odometric pose
  this->odomPose[0] = 0.0;
  this->odomPose[1] = 0.0;
  this->odomPose[2] = 0.0;

  return 0;
}

// Update the child model
int Pioneer2DX::UpdateChild()
{
  return 0;
}

// Finilaize thie child model
int Pioneer2DX::FiniChild()
{
  return 0;
}

void Pioneer2DX::UpdateOdometry( double step )
{
  double d1, d2;
  double dr, da;

  // Distance travelled by front wheels
  d1 = step * this->wheelDiam / 2.0 * wheelJoints[0]->GetAngleRate();
  d2 = step * this->wheelDiam / 2.0 * wheelJoints[1]->GetAngleRate();

  dr = (d1 + d2) / 2.0;
  da = (d2 - d1) / this->wheelSep;
  
  // Compute odometric pose
  this->odomPose[0] += dr * cos( this->odomPose[2] );
  this->odomPose[1] += dr * sin( this->odomPose[2] );
  this->odomPose[2] += da;

  // Compute odometric instantaneous velocity
  this->odomVel[0] = dr / step;
  this->odomVel[1] = 0.0;
  this->odomVel[2] = da / step;

  return;
}


--- NEW FILE: SConscript ---
#Import variable
Import('env', 'prefix', 'version', 'modelObjs')

modelObjs.append(env.Object('Pioneer2DX.cc'))

--- NEW FILE: Pioneer2DX.hh ---
#ifndef PIONEER2DX_HH
#define PIONEER2DX_HH

#include "Model.hh"

class Body;
class Geom;
class HingeJoint;
class XMLConfigNode;

typedef struct gz_position gz_position_t;
typedef struct gz_power gz_power_t;
typedef struct gz_sonar gz_sonar_t;


class Pioneer2DX : public Model
{ 
  public: Pioneer2DX();

  public: virtual ~Pioneer2DX();

  // Load the child model
  protected: virtual int LoadChild(XMLConfigNode *node);

  // Load the Bodies for the Pioneer
  private: int LoadBodies(XMLConfigNode *node);

  // Load the sonars
  private: int LoadSonar(XMLConfigNode *node);

  // Initialize the child model
  protected: virtual int InitChild();

  // Update the child model
  protected: virtual int UpdateChild();

  // Update parameters
  private: double updatePeriod, updateTime;

  // Finilaize thie child model
  protected: virtual int FiniChild();

  // Body and geometry for the chassis
  private: Body *chassisBody;
  private: Geom *chassisGeom;

  // Body, geom, and joints for the wheels
  private: Body *wheelBodies[2];
  private: Geom *wheelGeoms[2];
  private: HingeJoint *wheelJoints[2];

  // Radius of the drive wheels
  private: double wheelRadius;

  // Wheel separation distance
  private: double wheelSep;

  // Wheel speeds (left and right wheels are paired)
  private: int enableMotors;
  private: double wheelSpeed[2];

  // Odometric pose estimate
  private: double odomPose[3];

  // Odometric velocity estimate
  private: double odomVel[3];

  // Battery level
  private: double batteryLevel;

  // Coefficients of battery discharge curve
  private: double batteryCurve[2];

  // External interface
  private: gz_position_t *position_iface;
  private: gz_power_t *power_iface;
  private: gz_sonar_t *sonar_iface;


};
#endif


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Playerstage-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/playerstage-commit

Reply via email to