OpenRTMUtil.h
Go to the documentation of this file.
1 #ifndef __OPENRTM_UTIL_H__
2 #define __OPENRTM_UTIL_H__
3 
4 #include <rtm/RTObject.h>
5 
6 int connectPorts(RTC::PortService_ptr outPort, RTC::PortService_ptr inPort);
7 void activateRtc(RTC::RtcBase* pRtc);
8 void deactivateRtc(RTC::RtcBase* pRtc);
9 const char *getServiceIOR(RTC::RTObject_var rtc,
10  const char *sname);
11 void setConfiguration(RTC::RTObject_var rtc,
12  const std::string& name, const std::string& value);
13 RTC::RTObject_var findRTC(const std::string &rtcName);
14 
16 {
17 public:
18  ClockReceiver(OpenRTM::ExtTrigExecutionContextService_ptr i_ec,
19  double i_period) :
20  m_ec(i_ec), m_period(i_period), m_time(i_period){}
21  void tick(double dt){
22  m_time += dt;
23  if (m_time + dt/2 > m_period){
24  m_ec->tick();
25  m_time -= m_period;
26  }
27  }
28 private:
29  OpenRTM::ExtTrigExecutionContextService_ptr m_ec;
30  double m_period;
31  double m_time;
32 };
33 
34 
35 #endif
RTC::RTObject_var findRTC(const std::string &rtcName)
void setConfiguration(RTC::RTObject_var rtc, const std::string &name, const std::string &value)
OpenRTM::ExtTrigExecutionContextService_ptr m_ec
Definition: OpenRTMUtil.h:29
void deactivateRtc(RTC::RtcBase *pRtc)
Definition: OpenRTMUtil.cpp:54
void activateRtc(RTC::RtcBase *pRtc)
Definition: OpenRTMUtil.cpp:43
double m_period
Definition: OpenRTMUtil.h:30
double m_time
duration since the last period
Definition: OpenRTMUtil.h:31
ClockReceiver(OpenRTM::ExtTrigExecutionContextService_ptr i_ec, double i_period)
Definition: OpenRTMUtil.h:18
void tick(double dt)
Definition: OpenRTMUtil.h:21
int connectPorts(RTC::PortService_ptr outPort, RTC::PortService_ptr inPort)
Definition: OpenRTMUtil.cpp:4
const char * getServiceIOR(RTC::RTObject_var rtc, const char *sname)
Definition: OpenRTMUtil.cpp:65


hrpsys
Author(s): AIST, Fumio Kanehiro
autogenerated on Sat Dec 17 2022 03:52:20