INTRODUCTION Overview Download and Install Quick Start Documentation Publications NONFRAMEWORK CODE Driver Interfaces Drivers Libraries Utilities FRAMEWORK CODE Interfaces Components Libraries Utilities Full Software Listings DEVELOPER Tutorials Examples Dev Guide Dashboard PEOPLE Contributors Users Project Download Mailing lists
|
insgps/hwthread.h00001 /* 00002 * Orca-Robotics Project: Components for robotics 00003 * http://orca-robotics.sf.net/ 00004 * Copyright (c) 2004-2009 Alex Brooks, Alexei Makarenko, Tobias Kaupp, Michael Moser 00005 * 00006 * This copy of Orca is licensed to you under the terms described in 00007 * the LICENSE file included in this distribution. 00008 * 00009 */ 00010 #ifndef HARDWARE_THREAD_H 00011 #define HARDWARE_THREAD_H 00012 00013 #include <memory> 00014 #include <hydroiceutil/eventqueue.h> 00015 #include <orcaice/context.h> 00016 #include <hydrodll/dynamicload.h> 00017 // orca data types 00018 #include <orca/ins.h> 00019 #include <orca/gps.h> 00020 #include <orca/imu.h> 00021 // hardware interface 00022 #include <hydrointerfaces/insgps.h> 00023 00024 namespace insgps { 00025 00026 // 00027 // @brief the hardware loop of this component. 00028 // 00029 class HwThread : public orcaice::SubsystemThread 00030 { 00031 00032 public: 00033 HwThread( const orcaice::Context &context); 00034 00035 // used to shove data from the hardware side to the network side 00036 // event queue, so we can put through different data types 00037 hydroiceutil::EventQueuePtr dataPipe_; 00038 00039 private: 00040 // from SubsystemThread 00041 virtual void initialise(); 00042 virtual void work(); 00043 00044 // Tries repeatedly to instantiate the driver 00045 void initHardwareDriver(); 00046 00047 hydrointerfaces::InsGps::Config config_; 00048 00049 // The library that contains the driver factory (must be declared first so it's destructed last!!!) 00050 std::auto_ptr<hydrodll::DynamicallyLoadedLibrary> driverLib_; 00051 // Generic driver for the hardware 00052 std::auto_ptr<hydrointerfaces::InsGps> driver_; 00053 00054 orcaice::Context context_; 00055 }; 00056 00057 enum EventType { 00058 OrcaIns, 00059 OrcaGps, 00060 OrcaImu 00061 }; 00062 00063 class OrcaInsEvent : public hydroiceutil::Event 00064 { 00065 public: 00066 OrcaInsEvent(const hydrointerfaces::InsGps::InsData &hydroIns); 00067 orca::InsData data; 00068 }; 00069 typedef IceUtil::Handle<OrcaInsEvent> OrcaInsEventPtr; 00070 00071 class OrcaGpsEvent : public hydroiceutil::Event 00072 { 00073 public: 00074 OrcaGpsEvent(const hydrointerfaces::InsGps::GpsData &hydroGps); 00075 orca::GpsData data; 00076 }; 00077 typedef IceUtil::Handle<OrcaGpsEvent> OrcaGpsEventPtr; 00078 00079 class OrcaImuEvent : public hydroiceutil::Event 00080 { 00081 public: 00082 OrcaImuEvent(const hydrointerfaces::InsGps::ImuData &hydroImu); 00083 orca::ImuData data; 00084 }; 00085 typedef IceUtil::Handle<OrcaImuEvent> OrcaImuEventPtr; 00086 00087 } // namespace 00088 00089 #endif |
Webmaster: Tobias Kaupp (tobasco at users.sourceforge.net)