10 #ifndef REFERENCEFORCEUPDATOR_COMPONENT_H 11 #define REFERENCEFORCEUPDATOR_COMPONENT_H 13 #include <rtm/idl/BasicDataType.hh> 14 #include <rtm/idl/ExtendedDataTypes.hh> 16 #include <rtm/DataFlowComponentBase.h> 20 #include <rtm/idl/BasicDataTypeSkel.h> 21 #include <rtm/idl/ExtendedDataTypesSkel.h> 23 #include "../ImpedanceController/JointPathEx.h" 24 #include "../ImpedanceController/RatsMatrix.h" 25 #include "../SequencePlayer/interpolator.h" 26 #include "../TorqueFilter/IIRFilter.h" 27 #include <boost/shared_ptr.hpp> 63 virtual RTC::ReturnCode_t onInitialize();
67 virtual RTC::ReturnCode_t onFinalize();
109 bool setReferenceForceUpdaterParam(
const std::string& i_name_,
const OpenHRP::ReferenceForceUpdaterService::ReferenceForceUpdaterParam& i_param);
110 bool getReferenceForceUpdaterParam(
const std::string& i_name_, OpenHRP::ReferenceForceUpdaterService::ReferenceForceUpdaterParam_out i_param);
111 bool startReferenceForceUpdater(
const std::string& i_name_);
112 bool stopReferenceForceUpdater(
const std::string& i_name_);
113 bool startReferenceForceUpdaterNoWait(
const std::string& i_name_);
114 bool stopReferenceForceUpdaterNoWait(
const std::string& i_name_);
115 void waitReferenceForceUpdaterTransition(
const std::string& i_name_);
116 bool getSupportedReferenceForceUpdaterNameSequence(OpenHRP::ReferenceForceUpdaterService::StrSequence_out o_names);
117 void getTargetParameters ();
119 void updateRefFootOriginExtMoment (
const std::string& arm);
120 void updateRefObjExtMoment0 (
const std::string& arm);
121 void updateRefForces (
const std::string& arm);
122 inline bool eps_eq(
const double a,
const double b,
const double eps = 1e-3) {
return std::fabs((a)-(b)) <=
eps; };
204 std::cerr <<
"[" << print_str <<
"] p_gain = " << p_gain <<
", d_gain = " << d_gain <<
", i_gain = " << i_gain << std::endl;
205 std::cerr <<
"[" << print_str <<
"] update_freq = " << update_freq <<
"[Hz], update_count = " << update_count <<
", update_time_ratio = " << update_time_ratio <<
", transition_time = " << transition_time <<
"[s], cutoff_freq = " << act_force_filter->getCutOffFreq() <<
"[Hz]" << std::endl;
206 std::cerr <<
"[" << print_str <<
"] motion_dir = " << motion_dir.format(Eigen::IOFormat(Eigen::StreamPrecision, 0,
", ",
", ",
"",
"",
" [",
"]")) << std::endl;
207 std::cerr <<
"[" << print_str <<
"] frame = " << frame <<
", is_hold_value = " << (is_hold_value?
"true":
"false") << std::endl;
211 motion_dir = hrp::Vector3::UnitZ();
214 update_time_ratio = 0.5;
218 transition_time = 1.0;
222 is_hold_value =
false;
229 update_count = round((1/update_freq)/_dt);
230 double default_cutoff_freq = 1e8;
234 std::map<std::string, hrp::VirtualForceSensorParam>
m_vfs;
241 std::map<std::string, ReferenceForceUpdaterParam>
m_RFUParam;
258 #endif // REFERENCEFORCEUPDATOR_COMPONENT_H
std::map< std::string, hrp::VirtualForceSensorParam > m_vfs
unsigned int m_debugLevel
InPort< TimedOrientation3D > m_baseRpyIn
OutPort< TimedPoint3D > m_refFootOriginExtMomentOut
const std::string objextmoment0_name
ReferenceForceUpdaterParam()
InPort< TimedOrientation3D > m_rpyIn
sample RT component which has one data input port and one data output port
InPort< TimedPoint3D > m_diffFootOriginExtMomentIn
TimedOrientation3D m_baseRpy
std::map< std::string, ee_trans > ee_map
InPort< TimedPoint3D > m_basePosIn
ReferenceForceUpdaterParam(const double _dt)
std::vector< TimedDoubleSeq > m_ref_force_out
ReferenceForceUpdaterService_impl m_ReferenceForceUpdaterService
TimedBoolean m_refFootOriginExtMomentIsHoldValue
std::vector< InPort< TimedDoubleSeq > * > m_ref_forceIn
ExecutionContextHandle_t UniqueId
std::map< std::string, size_t > ee_index_map
std::map< std::string, interpolator * > ref_force_interpolator
hrp::Matrix33 foot_origin_rot
std::vector< TimedDoubleSeq > m_force
std::vector< TimedDoubleSeq > m_ref_force_in
std::vector< InPort< TimedDoubleSeq > * > m_forceIn
RTC::CorbaPort m_ReferenceForceUpdaterServicePort
InPort< TimedDoubleSeq > m_qRefIn
TimedPoint3D m_diffFootOriginExtMoment
void printParam(const std::string print_str)
TimedPoint3D m_refFootOriginExtMoment
OutPort< TimedBoolean > m_refFootOriginExtMomentIsHoldValueOut
std::vector< OutPort< TimedDoubleSeq > * > m_ref_forceOut
std::vector< double > transition_interpolator_ratio
std::vector< hrp::Vector3 > ref_force
boost::shared_ptr< FirstOrderLowPassFilter< hrp::Vector3 > > act_force_filter
std::map< std::string, ReferenceForceUpdaterParam > m_RFUParam
std::map< std::string, interpolator * > transition_interpolator
void ReferenceForceUpdaterInit(RTC::Manager *manager)
#define eps_eq(a, b, epsilon)