Home
FAQ
Player
Stage
Gazebo
Contrib
Documentation
Publications
Contributors
Users

Project
Download
Bugs/Feedback
Mailing lists

Radish

Old news
Old stuff

rwi_positiondevice.h

Go to the documentation of this file.
00001 /*
00002  *  Player - One Hell of a Robot Server
00003  *  Copyright (C) 2002
00004  *     Brian Gerkey, Kasper Stoy, Richard Vaughan, & Andrew Howard
00005  *     Nik Melchior
00006  *
00007  *
00008  *  This program is free software; you can redistribute it and/or modify
00009  *  it under the terms of the GNU General Public License as published by
00010  *  the Free Software Foundation; either version 2 of the License, or
00011  *  (at your option) any later version.
00012  *
00013  *  This program is distributed in the hope that it will be useful,
00014  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00015  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016  *  GNU General Public License for more details.
00017  *
00018  *  You should have received a copy of the GNU General Public License
00019  *  along with this program; if not, write to the Free Software
00020  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00021  *
00022  */
00023 
00024 /*
00025  *   the RWI position device.  accepts commands for changing
00026  *   speed and rotation, and returns data on x, y, theta.
00027  *   (Compass data will come later).
00028  */
00029 
00030 #ifndef _RWI_POSITIONDEVICE_H
00031 #define _RWI_POSITIONDEVICE_H
00032 
00033 #include <rwidevice.h>
00034 #include <drivertable.h>
00035 
00036 class CRWIPositionDevice: public CRWIDevice {
00037 public:
00038         CRWIPositionDevice (char* interface, ConfigFile* cf, int section)
00039                 : CRWIDevice(interface, cf, section,
00040                              sizeof(player_position_data_t),
00041                              sizeof(player_position_cmd_t),
00042                              1,1),
00043                   old_xpos(0),
00044                   old_ypos(0),
00045                   old_theta(0),
00046                   moving(false),
00047                   last_known_speed(0),
00048                   last_known_turnrate(0)
00049                 {}
00050         
00051         virtual int Setup ();
00052         virtual int Shutdown ();
00053         
00054         virtual void Main ();
00055         
00056 private:
00057         
00058         #ifdef USE_MOBILITY
00059         MobilityActuator::ActuatorState_var base_state;
00060         MobilityActuator::ActuatorState_var odo_state;
00061         
00062         // for "resetting" the odometry
00063         double odo_correct_x, odo_correct_y, odo_correct_theta;
00064         #endif // USE_MOBILITY
00065         
00066         // for determining whether we are stalled
00067         int32_t old_xpos, old_ypos;
00068         int32_t old_theta;
00069         bool moving;
00070         
00071         // sometimes velocity cannot be read
00072         uint32_t last_known_speed;
00073         int32_t last_known_turnrate;
00074         
00075         void PositionCommand (const int32_t speed, const int32_t rot_speed);
00076         void ResetOdometry ();
00077 };
00078 
00079 #endif // _RWI_POSITIONDEVICE_H
00080 

Generated on Tue May 3 14:15:36 2005 for Player by doxygen 1.3.6