00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #ifndef CActivMediaRobotBase_H
00029 #define CActivMediaRobotBase_H
00030
00031 #include <mrpt/hwdrivers/CGenericSensor.h>
00032 #include <mrpt/hwdrivers/link_pragmas.h>
00033 #include <mrpt/poses/CPose2D.h>
00034 #include <mrpt/slam/CObservationRange.h>
00035
00036 namespace mrpt
00037 {
00038 namespace hwdrivers
00039 {
00063 class HWDLLIMPEXP CActivMediaRobotBase : public CGenericSensor
00064 {
00065 DEFINE_GENERIC_SENSOR(CActivMediaRobotBase)
00066 public:
00067
00069 void initialize();
00070
00073 CActivMediaRobotBase();
00074
00076 virtual ~CActivMediaRobotBase();
00077
00082 void loadConfig(
00083 const mrpt::utils::CConfigFileBase &configSource,
00084 const std::string &iniSection );
00085
00091 void setSerialPortConfig(
00092 const std::string &portName,
00093 int portBaudRate );
00094
00097 void doProcess();
00098
00101 void changeOdometry(const mrpt::poses::CPose2D &newOdometry);
00102
00107 void getOdometry(poses::CPose2D &out_odom);
00108
00117 void getOdometryFull(
00118 poses::CPose2D &out_odom,
00119 double &out_lin_vel,
00120 double &out_ang_vel,
00121 int64_t &out_left_encoder_ticks,
00122 int64_t &out_right_encoder_ticks
00123 );
00124
00133 void getOdometryIncrement(
00134 poses::CPose2D &out_incr_odom,
00135 double &out_lin_vel,
00136 double &out_ang_vel,
00137 int64_t &out_incr_left_encoder_ticks,
00138 int64_t &out_incr_right_encoder_ticks
00139 );
00140
00143 void getSonarsReadings( bool &thereIsObservation, mrpt::slam::CObservationRange &obs );
00144
00146 void getBatteryCharge( double &out_batery_volts );
00147
00152 void setVelocities( const double &lin_vel, const double &ang_vel);
00153
00154 protected:
00155 std::string m_com_port;
00156 int m_robotBaud;
00157
00158 bool m_firstIncreOdometry;
00159 bool m_enableSonars;
00160
00161 void* m_robot;
00162 void* m_sonarDev;
00163 void* m_simpleConnector;
00164
00165 void disconnectAndDisableMotors();
00166 void connectAndEnableMotors();
00167
00168
00169 };
00170
00171 }
00172 }
00173 #endif