garcia_mixed.h
00001 /*
00002  *  Player - One Hell of a Robot Server
00003  *  Copyright (C) 2000  Brian Gerkey et al.
00004  *
00005  *
00006  *  This program is free software; you can redistribute it and/or modify
00007  *  it under the terms of the GNU General Public License as published by
00008  *  the Free Software Foundation; either version 2 of the License, or
00009  *  (at your option) any later version.
00010  *
00011  *  This program is distributed in the hope that it will be useful,
00012  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  *  GNU General Public License for more details.
00015  *
00016  *  You should have received a copy of the GNU General Public License
00017  *  along with this program; if not, write to the Free Software
00018  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00019  *
00020  */
00021 
00022 #include <stdint.h>
00023 
00024 #include <libplayercore/playercore.h>
00025 
00026 #include "acpGarcia.h"
00027 
00029 // The class for the driver
00030 class GarciaDriver : public ThreadedDriver
00031 {
00032   public:
00033 
00034     // Constructor; need that
00035     GarciaDriver(ConfigFile* cf, int section);
00036 
00037     virtual ~GarciaDriver();
00038 
00039     // Must implement the following methods.
00040     int MainSetup();
00041     void MainQuit();
00042     // Main function for device thread.
00043     virtual void Main();
00044 
00045     // This method will be invoked on each incoming message
00046     virtual int ProcessMessage(QueuePointer & resp_queue,
00047                                player_msghdr * hdr,
00048                                void * data);
00049     //void ProcessConfig();
00050     void ProcessPos2dPosCmd(player_msghdr_t* hdr, player_position2d_cmd_pos_t &data);
00051     void ProcessPos2dVelCmd(player_msghdr_t* hdr, player_position2d_cmd_vel_t &data);
00052     void ProcessSpeechCommand(player_msghdr_t* hdr, player_speech_cmd_t &data);
00053     void ProcessDioCommand(player_msghdr_t* hdr, player_dio_cmd_t &data);
00054 
00055     void ProcessPos2dGeomReq(player_msghdr_t* hdr);
00056     void ProcessIrPoseReq(player_msghdr_t* hdr);
00057 
00058     void RefreshData();
00059 
00060  private:
00061 
00062     // position2d interface
00063     player_devaddr_t           mPos2dAddr;
00064     player_position2d_data_t   mPos2dData;
00065     player_position2d_cmd_pos_t    mPos2dPosCmd;
00066     player_position2d_cmd_vel_t    mPos2dVelCmd;
00067 
00068     // ir interface
00069     player_devaddr_t       mIrAddr;
00070     player_ir_data_t       mIrData;
00071 
00072     // speech interface
00073     player_devaddr_t       mSpeechAddr;
00074     player_speech_cmd_t    mSpeechCmd;
00075 
00076     // dio interface
00077     player_devaddr_t       mDioAddr;
00078     player_dio_data_t      mDioData;
00079     player_dio_cmd_t       mDioCmd;
00080 
00081     // power interface
00082     player_devaddr_t       mPowerAddr;
00083     player_power_data_t      mPowerData;
00084 
00085     int32_t mSleep;
00086 
00087     double mLength;
00088     double mWidth;
00089     double mWheelBase;
00090     double mWheelRadius;
00091 
00092     acpValue mSpeed;
00093     acpValue mPitch;
00094     acpValue mVolume;
00095 
00096     acpGarcia* mGarcia;
00097 };