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 00029 00030 00031 00032 00033 00034 00035 00036 00037 00038 00039 00040 00041 #ifndef __JAUS_MOBILITY_PRIMITIVE_DRIVER__H 00042 #define __JAUS_MOBILITY_PRIMITIVE_DRIVER__H 00043 00044 #include "jaus/core/management/management.h" 00045 #include "jaus/mobility/drivers/querywrencheffort.h" 00046 #include "jaus/mobility/drivers/reportwrencheffort.h" 00047 #include "jaus/mobility/drivers/setwrencheffort.h" 00048 00049 namespace JAUS 00050 { 00051 typedef ReportWrenchEffort WrenchEffort; 00052 00058 // This service does not imply any particular platform type such as tracked or 00067 class JAUS_MOBILITY_DLL PrimitiveDriver : public Management::Child 00068 { 00069 public: 00070 const static std::string Name; 00071 PrimitiveDriver(); 00072 virtual ~PrimitiveDriver(); 00073 // Method called whenever a Wrench command is received by service. 00074 virtual bool SetWrenchEffort(const JAUS::SetWrenchEffort* command) = 0; 00075 // Gets the current wrench effort command. 00076 virtual JAUS::SetWrenchEffort GetCurrentWrenchEffort() const; 00077 // Gets the time when the last wrench effort command was received. 00078 virtual Time GetWrenchEffortTime() const; 00079 // Generates Primitive Driver related events. 00080 virtual bool GenerateEvent(const Events::Subscription& info) const; 00081 // Adds support for Report Wrench Effort events. 00082 virtual bool IsEventSupported(const Events::Type type, 00083 const double requestedPeriodicRate, 00084 const Message* queryMessage, 00085 double& confirmedPeriodicRate, 00086 std::string& errorMessage) const; 00087 // By default, the Primitive Driver is discoverable to other components (overload to hide). 00088 virtual bool IsDiscoverable() const { return true; } 00089 // Method called whenver a message is received. 00090 virtual void Receive(const Message* message); 00091 // Creates messages associated with this service. 00092 virtual Message* CreateMessage(const UShort messageCode) const; 00093 // Prints information about the service. 00094 virtual void PrintStatus() const; 00095 private: 00096 // Creates a ReportWrenchEffort from QueryWrenchEffort. 00097 void CreateReportFromQuery(const QueryWrenchEffort* query, 00098 ReportWrenchEffort& report) const; 00099 Mutex mPrimitiveDriverMutex; 00100 Time mWrenchEffortTime; 00101 JAUS::SetWrenchEffort mCurrentWrenchEffort; 00102 }; 00103 } 00104 00105 #endif 00106 /* End of File */