14 #include "hrpsys/idl/RobotHardwareService.hh" 18 static const char*
spec[] =
20 "implementation_id",
"AccelerationChecker",
21 "type_name",
"AccelerationChecker",
22 "description",
"Joint acceleration checker",
23 "version", HRPSYS_PACKAGE_VERSION,
25 "category",
"example",
26 "activity_type",
"DataFlowComponent",
29 "lang_type",
"compile",
31 "conf.default.thd",
"1000",
32 "conf.default.print",
"0",
42 m_servoStateIn(
"servoState", m_servoState),
86 std::cerr <<
m_profile.instance_name <<
": dt is not defined in the conf" 88 return RTC::RTC_ERROR;
119 std::cout <<
m_profile.instance_name<<
": onActivated(" << ec_id <<
")" << std::endl;
125 std::cout <<
m_profile.instance_name<<
": onDeactivated(" << ec_id <<
")" << std::endl;
136 if (!
m_dq.data.length()){
141 for (
unsigned int i=0;
i<
m_dqOld.data.length();
i++){
145 m_dq.data.length(
m_q.data.length());
147 for (
unsigned int i=0;
i<
m_q.data.length();
i++){
152 servo =
m_servoState.data[
i][0] & OpenHRP::RobotHardwareService::SERVO_STATE_MASK;
155 if (servo && fabs(ddq) >
m_thd){
156 time_t now = time(NULL);
157 struct tm *tm_now = localtime(&now);
158 char *datetime = asctime(tm_now);
159 datetime[strlen(datetime)-1] =
'\0';
162 <<
"] Warning: too big joint acceleration for " 163 <<
i <<
"th joint(" << ddq <<
"[rad/m^2])" << std::endl;
170 printf(
"jid: max acc[rad/m^2]\n");
171 for (
unsigned int i=0;
i<
m_ddqMax.data.length();
i++){
227 RTC::Create<AccelerationChecker>,
228 RTC::Delete<AccelerationChecker>);
ComponentProfile m_profile
png_infop png_charpp int png_charpp profile
bool stringTo(To &val, const char *str)
virtual RTC::ReturnCode_t onDeactivated(RTC::UniqueId ec_id)
OutPort< TimedDoubleSeq > m_qOut
InPort< OpenHRP::TimedLongSeqSeq > m_servoStateIn
coil::Properties & getProperties()
virtual ~AccelerationChecker()
Destructor.
bool addOutPort(const char *name, OutPortBase &outport)
static const char * spec[]
OpenHRP::TimedLongSeqSeq m_servoState
ExecutionContextHandle_t UniqueId
bool bindParameter(const char *param_name, VarType &var, const char *def_val, bool(*trans)(VarType &, const char *)=coil::stringTo)
virtual RTC::ReturnCode_t onInitialize()
virtual RTC::ReturnCode_t onActivated(RTC::UniqueId ec_id)
static std::vector< int > servo
virtual bool write(DataType &value)
virtual RTC::ReturnCode_t onExecute(RTC::UniqueId ec_id)
AccelerationChecker(RTC::Manager *manager)
Constructor.
bool addInPort(const char *name, InPortBase &inport)
InPort< TimedDoubleSeq > m_qIn
bool registerFactory(coil::Properties &profile, RtcNewFunc new_func, RtcDeleteFunc delete_func)
void AccelerationCheckerInit(RTC::Manager *manager)
joint acceleration checker