BeoPilot.H

00001 #include <vector>
00002 #include <deque>
00003 #include <list>
00004 #include "Serial.H"
00005 #include <control_toolbox/pid.h>
00006 #ifndef __BEOPILOT_H__
00007 #define __BEOPILOT_H__
00008 
00009 
00010 typedef struct{
00011                 float time,transVel,rotVel,encoderX,encoderY,encoderOri,rcTransVel,rcRotVel;
00012                 int rcMode;
00013 } motorData;
00014 typedef struct{
00015         double x;
00016         double y;
00017         double z;
00018 
00019 }Point3D;
00020 //! The BeoPilot module is responsible for actually driving the BeoBot2.  All motor
00021 //! requests are serviced to hardware by this module through MotorRequest messages.
00022 class BeoPilot {
00023 public:
00024 
00025   BeoPilot();
00026   ~BeoPilot();
00027 
00028         //! Evolve keeps the motor driver propeller up to date on the latest motor speed requests.
00029         //! If the evolve loop ever hangs for more than 1/4 second, then the propeller will shut down
00030         //! the motors until it recieves a new message.
00031         void start();
00032 
00033         //Send the motor speeds ([-1 .. 1]) to the motordriver/propeller
00034         void SetMotors(float motor1speed, float motor2speed);
00035 
00036         
00037         void SetMotorsPid(float motor1speed, float motor2speed);
00038 
00039         //Get the RC transmitter status
00040         unsigned char getRCStatus();
00041 
00042         //Get the status of an RC channel
00043         unsigned int getRCChannel(int channel);
00044 
00045         //Get the Enabled status from RC
00046         unsigned char getRCEnabled();
00047 
00048         //Get the Mix speed status from MotorBoard
00049         unsigned int getRCSpeed();
00050 
00051         //Get all of the RC status data in one frame
00052         void UpdateRCStatus();
00053 
00054 
00055 
00056         //Update position after get odometry data
00057         void UpdatePosition(void);
00058 
00059         void resetEncoder();
00060         Serial* itsSerial;
00061         //////////////////////////////////////////
00062         //Motor Data Structures
00063         //////////////////////////////////////////
00064 
00065         std::vector<int> itsRCChannels;
00066         int itsEmergencyMode;
00067         int itsRemoteMode;
00068         float itsMotor1Speed;
00069         float itsMotor2Speed;
00070         int itsLeftEncoder;
00071         int itsRightEncoder;
00072         ros::Time itsPreviousTime;
00073         Point3D itsPosition;
00074         Point3D itsDiffPosition;
00075         Point3D itsVelocity;
00076         int itsLastRightEncoder;
00077         int itsLastLeftEncoder;
00078         double itsLeftMotorVelocity;
00079         double itsRightMotorVelocity;
00080         control_toolbox::Pid itsPidSpeed;
00081         control_toolbox::Pid itsPidRot;
00082         ros::Duration dt ;
00083 
00084 };
00085 #endif
Generated on Sun May 8 08:05:35 2011 for iLab Neuromorphic Vision Toolkit by  doxygen 1.6.3