10 #ifndef AUTOBALANCER_H 11 #define AUTOBALANCER_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" 30 #include "../TorqueFilter/IIRFilter.h" 51 virtual RTC::ReturnCode_t onInitialize();
55 virtual RTC::ReturnCode_t onFinalize();
96 bool goPos(
const double&
x,
const double&
y,
const double& th);
97 bool goVelocity(
const double& vx,
const double& vy,
const double& vth);
99 bool emergencyStop ();
100 bool setFootSteps(
const OpenHRP::AutoBalancerService::FootstepSequence& fs, CORBA::Long overwrite_fs_idx);
101 bool setFootSteps(
const OpenHRP::AutoBalancerService::FootstepsSequence& fss, CORBA::Long overwrite_fs_idx);
102 bool setFootStepsWithParam(
const OpenHRP::AutoBalancerService::FootstepSequence& fs,
const OpenHRP::AutoBalancerService::StepParamSequence& sps, CORBA::Long overwrite_fs_idx);
103 bool setFootStepsWithParam(
const OpenHRP::AutoBalancerService::FootstepsSequence& fss,
const OpenHRP::AutoBalancerService::StepParamsSequence& spss, CORBA::Long overwrite_fs_idx);
104 void waitFootSteps();
105 void waitFootStepsEarly(
const double tm);
106 bool startAutoBalancer(const ::OpenHRP::AutoBalancerService::StrSequence& limbs);
107 bool stopAutoBalancer();
108 bool setGaitGeneratorParam(
const OpenHRP::AutoBalancerService::GaitGeneratorParam& i_param);
109 bool getGaitGeneratorParam(OpenHRP::AutoBalancerService::GaitGeneratorParam& i_param);
110 bool setAutoBalancerParam(
const OpenHRP::AutoBalancerService::AutoBalancerParam& i_param);
111 bool getAutoBalancerParam(OpenHRP::AutoBalancerService::AutoBalancerParam& i_param);
112 bool getFootstepParam(OpenHRP::AutoBalancerService::FootstepParam& i_param);
113 bool adjustFootSteps(
const OpenHRP::AutoBalancerService::Footstep& rfootstep,
const OpenHRP::AutoBalancerService::Footstep& lfootstep);
114 bool getRemainingFootstepSequence(OpenHRP::AutoBalancerService::FootstepSequence_out o_footstep, CORBA::Long& o_current_fs_idx);
115 bool getGoPosFootstepsSequence(
const double& x,
const double& y,
const double& th, OpenHRP::AutoBalancerService::FootstepsSequence_out o_footstep);
116 bool releaseEmergencyStop();
117 void distributeReferenceZMPToWrenches (
const hrp::Vector3& _ref_zmp);
209 void getTargetParameters();
210 void solveFullbodyIK ();
211 void startABCparam(const ::OpenHRP::AutoBalancerService::StrSequence& limbs);
213 void waitABCTransition();
216 void getOutputParametersForWalking ();
217 void getOutputParametersForABC ();
218 void getOutputParametersForIDLE ();
219 void interpolateLegNamesAndZMPOffsets();
223 void calculateOutputRefForces ();
226 void calcReferenceJointAnglesForIK ();
230 bool startWalking ();
232 void copyRatscoords2Footstep(OpenHRP::AutoBalancerService::Footstep& out_fs,
const rats::coordinates& in_fs);
234 void static_balance_point_proc_one(
hrp::Vector3& tmp_input_sbp,
const double ref_com_height);
235 void calc_static_balance_point_from_forces(
hrp::Vector3& sb_point,
const hrp::Vector3& tmpcog,
const double ref_com_height);
239 return (std::fabs(m_optionalData.data[contact_states_index_map[ee_name]]-1.0)<0.1)?
true:
false;
241 bool calc_inital_support_legs(
const double& y, std::vector<rats::coordinates>& initial_support_legs_coords, std::vector<rats::leg_type>& initial_support_legs,
rats::coordinates& start_ref_coords);
242 std::string getUseForceModeString ();
251 hrp::Vector3 ref_cog,
ref_zmp, prev_ref_zmp, prev_imu_sensor_pos, prev_imu_sensor_vel, hand_fix_initial_offset;
252 enum {BIPED,
TROT, PACE, CRAWL, GALLOP} gait_type;
254 std::map<std::string, ABCIKparam>
ikp;
256 std::map<std::string, hrp::VirtualForceSensorParam>
m_vfs;
265 double d_pos_z_root, limb_stretch_avoidance_time_const, limb_stretch_avoidance_vlimit[2];
268 double transition_interpolator_ratio, transition_time,
zmp_transition_time, adjust_footstep_transition_time, leg_names_interpolator_ratio;
282 bool is_legged_robot,
is_stop_mode, is_hand_fix_mode, is_hand_fix_initial;
303 #endif // IMPEDANCE_H TimedOrientation3D m_baseRpy
TimedBooleanSeq m_contactStates
TimedDoubleSeq m_toeheelRatio
InPort< TimedBoolean > m_refFootOriginExtMomentIsHoldValueIn
bool graspless_manip_mode
rats::coordinates fix_leg_coords2
std::vector< InPort< TimedDoubleSeq > * > m_ref_forceIn
std::map< std::string, ABCIKparam > ikp
InPort< TimedPoint3D > m_basePosIn
void AutoBalancerInit(RTC::Manager *manager)
OutPort< TimedPoint3D > m_sbpCogOffsetOut
InPort< TimedDoubleSeq > m_optionalDataIn
OutPort< TimedDoubleSeq > m_controlSwingSupportTimeOut
std::vector< TimedPoint3D > m_limbCOPOffset
interpolator * adjust_footstep_interpolator
std::vector< hrp::Vector3 > default_zmp_offsets
OutPort< TimedDoubleSeq > m_toeheelRatioOut
boost::shared_ptr< SimpleFullbodyInverseKinematicsSolver > fikPtr
boost::shared_ptr< rats::gait_generator > ggPtr
hrp::Link * additional_force_applied_link
double zmp_transition_time
bool use_limb_stretch_avoidance
OutPort< TimedBooleanSeq > m_contactStatesOut
OutPort< TimedDoubleSeq > m_baseTformOut
TimedLong m_emergencySignal
std::map< std::string, size_t > contact_states_index_map
TimedBooleanSeq m_actContactStates
OutPort< TimedPoint3D > m_cogOut
std::vector< std::string > sensor_names
unsigned int m_debugLevel
ExecutionContextHandle_t UniqueId
std::string graspless_manip_arm
interpolator * transition_interpolator
std::vector< hrp::Vector3 > ref_moments
std::map< std::string, hrp::VirtualForceSensorParam > m_vfs
interpolator * leg_names_interpolator
InPort< TimedLong > m_emergencySignalIn
TimedPoint3D m_refFootOriginExtMoment
RTC::OutPort< RTC::TimedPoint3D > m_zmpOut
std::vector< OutPort< TimedDoubleSeq > * > m_ref_forceOut
InPort< TimedPoint3D > m_zmpIn
std::vector< TimedDoubleSeq > m_ref_force
TimedPoint3D m_sbpCogOffset
OutPort< TimedPoint3D > m_basePosOut
AutoBalancerService_impl m_service0
TimedAcceleration3D m_accRef
OutPort< TimedAcceleration3D > m_accRefOut
TimedDoubleSeq m_optionalData
TimedBoolean m_walkingStates
OutPort< TimedDoubleSeq > m_qOut
hrp::Vector3 graspless_manip_p_gain
OutPort< TimedPose3D > m_basePoseOut
InPort< TimedBooleanSeq > m_actContactStatesIn
std::vector< OutPort< TimedPoint3D > * > m_limbCOPOffsetOut
hrp::InvDynStateBuffer idsb
InPort< TimedDoubleSeq > m_qRefIn
TimedDoubleSeq m_baseTform
InPort< TimedPoint3D > m_refFootOriginExtMomentIn
InPort< TimedOrientation3D > m_baseRpyIn
std::vector< IIRFilter > invdyn_zmp_filters
TimedDoubleSeq m_controlSwingSupportTime
RTC::CorbaPort m_AutoBalancerServicePort
hrp::Vector3 additional_force_applied_point_offset
InPort< TimedPoint3D > m_diffCPIn
OutPort< TimedOrientation3D > m_baseRpyOut
hrp::Matrix33 target_root_R
std::vector< TimedDoubleSeq > m_force
interpolator * zmp_offset_interpolator
OutPort< TimedBoolean > m_walkingStatesOut
hrp::Matrix33 input_baseRot
rats::coordinates graspless_manip_reference_trans_coords
bool isOptionalDataContact(const std::string &ee_name)
hrp::Vector3 target_root_p
TimedBoolean m_refFootOriginExtMomentIsHoldValue