14 "implementation_id",
"AccelerationFilter",
15 "type_name",
"AccelerationFilter",
16 "description",
"Acceleration Filter component",
19 "category",
"example",
20 "activity_type",
"SPORADIC",
21 "kind",
"DataFlowComponent",
24 "lang_type",
"compile",
33 m_accInIn(
"accIn", m_accIn),
34 m_rateInIn(
"rateIn", m_rateIn),
35 m_rpyInIn(
"rpyIn", m_rpyIn),
36 m_posInIn(
"posIn", m_posIn),
37 m_velOutOut(
"velOut", m_velOut),
39 m_AccelerationFilterServicePort(
"AccelerationFilterService"),
41 m_use_filter_bool(false)
79 std::cerr <<
"[" <<
m_profile.instance_name <<
"] failed to get dt" << std::endl;
80 return RTC::RTC_ERROR;
84 double param_gravity = 9.80665;
88 std::cerr <<
"[" <<
m_profile.instance_name <<
"] gravity : " <<
m_gravity << std::endl;
93 if (filter_str.size() > 2) {
94 int dim = (filter_str.size() - 1)/2;
95 std::vector<double> bb;
96 std::vector<double> aa;
97 for(
int i = 0;
i < dim + 1;
i++) {
102 for(
int i = 0;
i < filter_str.size() - dim - 1;
i++) {
107 if (aa.size() > 0 && bb.size() > 0) {
109 std::cerr <<
"[" <<
m_profile.instance_name <<
"] pass filter_param : " << std::endl;
110 std::cerr <<
"B = [";
111 for(
int i = 0;
i < bb.size();
i++) {
112 std::cerr <<
" " << bb[
i];
114 std::cerr <<
"]" << std::endl;
115 std::cerr <<
"A = [";
116 for(
int i = 0;
i < aa.size();
i++) {
117 std::cerr <<
" " << aa[
i];
119 std::cerr <<
"]" << std::endl;
120 for (
int i = 0;
i < 3;
i++) {
122 fl->setParameter(dim, aa, bb);
123 fl->reset(param_gravity);
156 std::cerr <<
"[" <<
m_profile.instance_name<<
"] onActivated(" << ec_id <<
")" << std::endl;
161 std::cerr <<
"[" <<
m_profile.instance_name<<
"] onDeactivated(" << ec_id <<
")" << std::endl;
181 expected_vel /=
m_dt;
182 m_previous_pos =
pos;
197 for (
int i = 0;
i < 3;
i++) {
199 double filtered_acc =
m_filters[
i]->passFilter(acc_wo_g[
i]);
253 case OpenHRP::AccelerationFilterService::MODE_ZERO_VELOCITY:
258 case OpenHRP::AccelerationFilterService::MODE_RELATIVE_GLOBAL_VELOCITY:
263 case OpenHRP::AccelerationFilterService::MODE_ABSOLUTE_GLOBAL_VELOCITY:
268 case OpenHRP::AccelerationFilterService::MODE_RELATIVE_LOCAL_VELOCITY:
278 case OpenHRP::AccelerationFilterService::MODE_ABSOLUTE_LOCAL_VELOCITY:
299 if(i_param.filter_param.length() > 1) {
301 std::vector<double>
A;
302 std::vector<double>
B;
303 dim = (i_param.filter_param.length() - 1)/2;
304 for(
int i = 0;
i < dim + 1;
i++) {
305 B.push_back(i_param.filter_param[
i]);
307 for(
int i = 0;
i < i_param.filter_param.length() - dim - 1;
i++) {
308 A.push_back(i_param.filter_param[dim+1+
i]);
311 for(
int i = 0;
i < 3;
i++) {
313 fl->setParameter(dim, A, B);
327 std::vector<double>
A;
328 std::vector<double>
B;
330 i_param.filter_param.length(2*(dim+1));
331 for(
int i = 0;
i < dim+1;
i++) {
332 i_param.filter_param[
i] = B[
i];
333 i_param.filter_param[
i + dim + 1] = A[
i];
345 RTC::Create<AccelerationFilter>,
346 RTC::Delete<AccelerationFilter>);
ComponentProfile m_profile
bool setParam(const ::OpenHRP::AccelerationFilterService::AccelerationFilterParam &i_param)
png_infop png_charpp int png_charpp profile
OutPort< TimedVector3D > m_velOutOut
static const char * accelerationfilter_spec[]
bool stringTo(To &val, const char *str)
virtual RTC::ReturnCode_t onActivated(RTC::UniqueId ec_id)
RTC::CorbaPort m_AccelerationFilterServicePort
Acceleration Filter component *.
virtual RTC::ReturnCode_t onInitialize()
TimedAcceleration3D m_accIn
vstring split(const std::string &input, const std::string &delimiter, bool ignore_empty)
bool getParam(::OpenHRP::AccelerationFilterService::AccelerationFilterParam &i_param)
coil::Properties & getProperties()
void AccelerationFilterInit(RTC::Manager *manager)
bool addOutPort(const char *name, OutPortBase &outport)
InPort< TimedAngularVelocity3D > m_rateInIn
Matrix33 rotFromRpy(const Vector3 &rpy)
virtual RTC::ReturnCode_t onExecute(RTC::UniqueId ec_id)
AccelerationFilterService_impl m_service0
std::vector< std::string > vstring
ExecutionContextHandle_t UniqueId
hrp::Vector3 m_previous_pos
TimedOrientation3D m_rpyIn
AccelerationFilter(RTC::Manager *manager)
coil::Guard< coil::Mutex > Guard
virtual RTC::ReturnCode_t onDeactivated(RTC::UniqueId ec_id)
void setInstance(AccelerationFilter *i_instance)
InPort< TimedPoint3D > m_posInIn
InPort< TimedAcceleration3D > m_accInIn
bool addPort(PortBase &port)
virtual bool write(DataType &value)
InPort< TimedOrientation3D > m_rpyInIn
bool addInPort(const char *name, InPortBase &inport)
bool resetFilter(const OpenHRP::AccelerationFilterService::ControlMode &mode, const double *vel)
bool registerFactory(coil::Properties &profile, RtcNewFunc new_func, RtcDeleteFunc delete_func)
bool registerProvider(const char *instance_name, const char *type_name, PortableServer::RefCountServantBase &provider)
hrp::Vector3 m_global_vel
std::vector< IIRFilterPtr > m_filters