GraspController.h
Go to the documentation of this file.
00001 // -*- C++ -*-
00010 #ifndef GRASP_CONTROLLER_H
00011 #define GRASP_CONTROLLER_H
00012 
00013 #include <rtm/idl/BasicDataType.hh>
00014 #include "hrpsys/idl/HRPDataTypes.hh"
00015 #include <rtm/Manager.h>
00016 #include <rtm/DataFlowComponentBase.h>
00017 #include <rtm/CorbaPort.h>
00018 #include <rtm/DataInPort.h>
00019 #include <rtm/DataOutPort.h>
00020 #include <rtm/idl/BasicDataTypeSkel.h>
00021 
00022 // Service implementation headers
00023 // <rtc-template block="service_impl_h">
00024 #include "GraspControllerService_impl.h"
00025 #include <hrpModel/Body.h>
00026 
00027 // </rtc-template>
00028 
00029 // Service Consumer stub headers
00030 // <rtc-template block="consumer_stub_h">
00031 
00032 // </rtc-template>
00033 
00034 using namespace RTC;
00035 
00039 class GraspController
00040   : public RTC::DataFlowComponentBase
00041 {
00042  public:
00047   GraspController(RTC::Manager* manager);
00051   virtual ~GraspController();
00052 
00053   // The initialize action (on CREATED->ALIVE transition)
00054   // formaer rtc_init_entry()
00055   virtual RTC::ReturnCode_t onInitialize();
00056 
00057   // The finalize action (on ALIVE->END transition)
00058   // formaer rtc_exiting_entry()
00059   //virtual RTC::ReturnCode_t onFinalize();
00060 
00061   // The startup action when ExecutionContext startup
00062   // former rtc_starting_entry()
00063   // virtual RTC::ReturnCode_t onStartup(RTC::UniqueId ec_id);
00064 
00065   // The shutdown action when ExecutionContext stop
00066   // former rtc_stopping_entry()
00067   // virtual RTC::ReturnCode_t onShutdown(RTC::UniqueId ec_id);
00068 
00069   // The activated action (Active state entry action)
00070   // former rtc_active_entry()
00071   virtual RTC::ReturnCode_t onActivated(RTC::UniqueId ec_id);
00072 
00073   // The deactivated action (Active state exit action)
00074   // former rtc_active_exit()
00075   virtual RTC::ReturnCode_t onDeactivated(RTC::UniqueId ec_id);
00076 
00077   // The execution action that is invoked periodically
00078   // former rtc_active_do()
00079   virtual RTC::ReturnCode_t onExecute(RTC::UniqueId ec_id);
00080 
00081   // The aborting action when main logic error occurred.
00082   // former rtc_aborting_entry()
00083   // virtual RTC::ReturnCode_t onAborting(RTC::UniqueId ec_id);
00084 
00085   // The error action in ERROR state
00086   // former rtc_error_do()
00087   // virtual RTC::ReturnCode_t onError(RTC::UniqueId ec_id);
00088 
00089   // The reset action that is invoked resetting
00090   // This is same but different the former rtc_init_entry()
00091   // virtual RTC::ReturnCode_t onReset(RTC::UniqueId ec_id);
00092 
00093   // The state update action that is invoked after onExecute() action
00094   // no corresponding operation exists in OpenRTm-aist-0.2.0
00095   // virtual RTC::ReturnCode_t onStateUpdate(RTC::UniqueId ec_id);
00096 
00097   // The action that is invoked when execution context's rate is changed
00098   // no corresponding operation exists in OpenRTm-aist-0.2.0
00099   // virtual RTC::ReturnCode_t onRateChanged(RTC::UniqueId ec_id);
00100 
00101   bool startGrasp(const char *name, double target_error);
00102   bool stopGrasp(const char *name);
00103 
00104  protected:
00105   // Configuration variable declaration
00106   // <rtc-template block="config_declare">
00107   
00108   // </rtc-template>
00109 
00110   TimedDoubleSeq m_qRef;
00111   TimedDoubleSeq m_qCurrent;
00112   TimedDoubleSeq m_q;
00113 
00114   // DataInPort declaration
00115   // <rtc-template block="inport_declare">
00116   InPort<TimedDoubleSeq> m_qRefIn;
00117   InPort<TimedDoubleSeq> m_qCurrentIn;
00118   InPort<TimedDoubleSeq> m_qIn;
00119   
00120   // </rtc-template>
00121 
00122   // DataOutPort declaration
00123   // <rtc-template block="outport_declare">
00124   OutPort<TimedDoubleSeq> m_qOut;
00125   
00126   // </rtc-template>
00127 
00128   // CORBA Port declaration
00129   // <rtc-template block="corbaport_declare">
00130   RTC::CorbaPort m_GraspControllerServicePort;
00131   
00132   // </rtc-template>
00133 
00134   // Service declaration
00135   // <rtc-template block="service_declare">
00136   GraspControllerService_impl m_service0;
00137   
00138   // </rtc-template>
00139 
00140   // Consumer declaration
00141   // <rtc-template block="consumer_declare">
00142   
00143   // </rtc-template>
00144 
00145  private:
00146   struct GraspJoint {
00147     int  id;
00148     double dir;
00149   };
00150   struct GraspParam {
00151     double time;
00152     double target_error;
00153     std::vector<GraspJoint> joints;
00154   };
00155   std::map<std::string, GraspParam > m_grasp_param;
00156   hrp::BodyPtr m_robot;
00157   double m_dt;
00158   unsigned int m_debugLevel;
00159   int dummy;
00160 };
00161 
00162 
00163 extern "C"
00164 {
00165   void GraspControllerInit(RTC::Manager* manager);
00166 };
00167 
00168 #endif // SOFT_ERROR_LIMITER_H


hrpsys
Author(s): AIST, Fumio Kanehiro
autogenerated on Wed Sep 6 2017 02:35:55