orca-robotics INTRODUCTION Overview Download and Install Documentation REPOSITORY Interfaces Drivers Libraries Utilities Software Map DEVELOPER Dashboard PEOPLE Contributors Users Project Download Mailing lists
|
canpeakrmpio.h00001 /* 00002 * Orca-Robotics Project: Components for robotics 00003 * http://orca-robotics.sf.net/ 00004 * Copyright (c) 2004-2008 Alex Brooks, Alexei Makarenko, Tobias Kaupp 00005 * Copyright (c) 2004-2008 Duncan Mercer 00006 * 00007 * This copy of Orca is licensed to you under the terms described in 00008 * the LICENSE file included in this distribution. 00009 * 00010 */ 00011 00012 #ifndef ORCA_CAN_PEAK_RMP_IO_H 00013 #define ORCA_CAN_PEAK_RMP_IO_H 00014 00015 #include <libpcan.h> 00016 #include "../canpacket.h" 00017 #include "../rmpio.h" 00018 #include <hydroutil/uncopyable.h> 00019 #include <gbxsickacfr/gbxiceutilacfr/timer.h> 00020 00021 namespace segwayrmpacfr { 00022 00023 //************************************************************ 00024 // A class to handle the Segway control using the peak 00025 // CAN card.... 00026 // **NOTE That all function in the list may throw exceptions of 00027 // the type hydrointerfaces::SegwayRmp::Exception 00028 00029 // 00030 // Author Duncan Mercer 00031 // 00032 00033 class CanPeakRmpIo : public RmpIo, public hydroutil::Uncopyable 00034 { 00035 00036 public: 00037 // There should only be one instance of this class 00038 CanPeakRmpIo( const std::string & portName ); 00039 ~CanPeakRmpIo(); 00040 00041 // from RmpIo 00042 virtual void enable(int debugLevel); 00043 virtual void disable(void); 00044 virtual RmpIo::RmpIoStatus readPacket( CanPacket &pkt ); 00045 virtual void writePacket( const CanPacket &pkt ); 00046 00047 private: 00048 HANDLE portHandle_; 00049 bool isEnabled_; 00050 int debugLevel_; 00051 00052 // Private methods to swap between the data representation for the PCMCIA card and 00053 // that used by the rest of the segwayrmp driver code.... 00054 void convertCanPacketToPeak(TPCANMsg *peakCanOut, const CanPacket *pktIn); 00055 void convertPeakToCanPacket(CanPacket *pktOut, const TPCANMsg *peakCanIn); 00056 00057 // String representation of the peak can card error 00058 std::string peakStatusToString(DWORD status); 00059 gbxsickacfr::gbxiceutilacfr::Timer writeTimer_; 00060 00061 }; // end of class declaration 00062 00063 00064 } // end of namespace 00065 00066 #endif |
Webmaster: Tobias Kaupp (tobasco at users.sourceforge.net)