58 : control_cycle_msec_(8)
116 Eigen::MatrixXd A(6,6), B(6, 1);
117 A << 0.0, 0.0, 0.0, 0.0, 0.0, 1.0,
118 0.0, 0.0, 0.0, 0.0, 1.0, 0.0,
119 0.0, 0.0, 0.0, 2.0, 0.0, 0.0,
120 tf*tf*tf*tf*tf, tf*tf*tf*tf, tf*tf*tf, tf*tf, tf, 1.0,
121 5.0*tf*tf*tf*tf, 4.0*tf*tf*tf, 3.0*tf*tf, 2.0*tf, 1.0, 0.0,
122 20.0*tf*tf*tf, 12.0*tf*tf, 6.0*tf, 2.0, 0.0, 0.0;
124 B << 0, 0, 0, 2.0, 0, 0;
155 0, 0.093, -0.63, 0, 0, 0,
184 online_walking->
start();
301 robotis_controller_msgs::StatusMsg status_msg;
303 status_msg.type = type;
304 status_msg.module_name =
"Walking";
305 status_msg.status_msg = msg;
312 std_msgs::String done_msg;
320 int copy_result = thormang3_walking_module_msgs::AddStepDataArray::Response::NO_ERROR;
367 copy_result |= thormang3_walking_module_msgs::AddStepDataArray::Response::PROBLEM_IN_TIME_DATA;
369 if((src.time_data.start_time_delay_ratio_x < 0)
370 || (src.time_data.start_time_delay_ratio_y < 0)
371 || (src.time_data.start_time_delay_ratio_z < 0)
372 || (src.time_data.start_time_delay_ratio_roll < 0)
373 || (src.time_data.start_time_delay_ratio_pitch < 0)
374 || (src.time_data.start_time_delay_ratio_yaw < 0) )
375 copy_result |= thormang3_walking_module_msgs::AddStepDataArray::Response::PROBLEM_IN_TIME_DATA;
377 if((src.time_data.finish_time_advance_ratio_x < 0)
378 || (src.time_data.finish_time_advance_ratio_y < 0)
379 || (src.time_data.finish_time_advance_ratio_z < 0)
380 || (src.time_data.finish_time_advance_ratio_roll < 0)
381 || (src.time_data.finish_time_advance_ratio_pitch < 0)
382 || (src.time_data.finish_time_advance_ratio_yaw < 0) )
383 copy_result |= thormang3_walking_module_msgs::AddStepDataArray::Response::PROBLEM_IN_TIME_DATA;
385 if(((src.time_data.start_time_delay_ratio_x + src.time_data.finish_time_advance_ratio_x) > 1.0)
386 || ((src.time_data.start_time_delay_ratio_y + src.time_data.finish_time_advance_ratio_y ) > 1.0)
387 || ((src.time_data.start_time_delay_ratio_z + src.time_data.finish_time_advance_ratio_z ) > 1.0)
388 || ((src.time_data.start_time_delay_ratio_roll + src.time_data.finish_time_advance_ratio_roll ) > 1.0)
389 || ((src.time_data.start_time_delay_ratio_pitch + src.time_data.finish_time_advance_ratio_pitch ) > 1.0)
390 || ((src.time_data.start_time_delay_ratio_yaw + src.time_data.finish_time_advance_ratio_yaw ) > 1.0) )
391 copy_result |= thormang3_walking_module_msgs::AddStepDataArray::Response::PROBLEM_IN_TIME_DATA;
396 copy_result |= thormang3_walking_module_msgs::AddStepDataArray::Response::PROBLEM_IN_POSITION_DATA;
398 if(src.position_data.foot_z_swap < 0)
399 copy_result |= thormang3_walking_module_msgs::AddStepDataArray::Response::PROBLEM_IN_POSITION_DATA;
410 des.time_data.start_time_delay_ratio_x = des.time_data.finish_time_advance_ratio_x = 0;
411 des.time_data.start_time_delay_ratio_y = des.time_data.finish_time_advance_ratio_y = 0;
412 des.time_data.start_time_delay_ratio_z = des.time_data.finish_time_advance_ratio_z = 0;
413 des.time_data.start_time_delay_ratio_roll = des.time_data.finish_time_advance_ratio_roll = 0;
414 des.time_data.start_time_delay_ratio_pitch = des.time_data.finish_time_advance_ratio_pitch = 0;
415 des.time_data.start_time_delay_ratio_yaw = des.time_data.finish_time_advance_ratio_yaw = 0;
443 thormang3_walking_module_msgs::GetReferenceStepData::Response &res)
457 thormang3_walking_module_msgs::AddStepDataArray::Response &res)
460 res.result = thormang3_walking_module_msgs::AddStepDataArray::Response::NO_ERROR;
464 res.result |= thormang3_walking_module_msgs::AddStepDataArray::Response::NOT_ENABLED_WALKING_MODULE;
466 publishStatusMsg(robotis_controller_msgs::StatusMsg::STATUS_ERROR, status_msg);
470 if((req.step_data_array.size() > 100)
471 && (req.remove_existing_step_data ==
true)
472 && ((online_walking->
isRunning() ==
true)))
474 res.result |= thormang3_walking_module_msgs::AddStepDataArray::Response::TOO_MANY_STEP_DATA;
476 publishStatusMsg(robotis_controller_msgs::StatusMsg::STATUS_ERROR, status_msg);
481 std::vector<robotis_framework::StepData> req_step_data_array;
485 for(
int i = 0; i < req.step_data_array.size(); i++)
491 res.result |= thormang3_walking_module_msgs::AddStepDataArray::Response::PROBLEM_IN_TIME_DATA;
496 if(step_data.
time_data.
abs_step_time <= req_step_data_array[req_step_data_array.size() - 1].time_data.abs_step_time)
498 res.result |= thormang3_walking_module_msgs::AddStepDataArray::Response::PROBLEM_IN_TIME_DATA;
505 res.result |= thormang3_walking_module_msgs::AddStepDataArray::Response::PROBLEM_IN_TIME_DATA;
509 if(res.result != thormang3_walking_module_msgs::AddStepDataArray::Response::NO_ERROR)
512 publishStatusMsg(robotis_controller_msgs::StatusMsg::STATUS_ERROR, status_msg);
516 req_step_data_array.push_back(step_data);
519 if(req.remove_existing_step_data ==
true)
522 if(exist_num_of_step_data != 0)
523 for(
int remove_count = 0; remove_count < exist_num_of_step_data; remove_count++)
530 res.result |= thormang3_walking_module_msgs::AddStepDataArray::Response::ROBOT_IS_WALKING_NOW;
532 publishStatusMsg(robotis_controller_msgs::StatusMsg::STATUS_ERROR, status_msg);
540 publishStatusMsg(robotis_controller_msgs::StatusMsg::STATUS_ERROR, status_msg);
544 for(
unsigned int i = 0; i < req_step_data_array.size() ; i++)
545 online_walking->
addStepData(req_step_data_array[i]);
547 if( req.auto_start ==
true)
549 online_walking->
start();
556 thormang3_walking_module_msgs::StartWalking::Response &res)
559 res.result = thormang3_walking_module_msgs::StartWalking::Response::NO_ERROR;
563 res.result |= thormang3_walking_module_msgs::StartWalking::Response::NOT_ENABLED_WALKING_MODULE;
569 res.result |= thormang3_walking_module_msgs::StartWalking::Response::ROBOT_IS_WALKING_NOW;
576 publishStatusMsg(robotis_controller_msgs::StatusMsg::STATUS_ERROR, status_msg);
582 res.result |= thormang3_walking_module_msgs::StartWalking::Response::NO_STEP_DATA;
586 if(res.result == thormang3_walking_module_msgs::StartWalking::Response::NO_ERROR)
588 prev_walking->
start();
595 thormang3_walking_module_msgs::IsRunning::Response &res)
598 res.is_running = is_running;
609 thormang3_walking_module_msgs::SetJointFeedBackGain::Response &res)
613 res.result = thormang3_walking_module_msgs::SetJointFeedBackGain::Response::NO_ERROR;
616 res.result |= thormang3_walking_module_msgs::SetJointFeedBackGain::Response::NOT_ENABLED_WALKING_MODULE;
619 res.result |= thormang3_walking_module_msgs::SetJointFeedBackGain::Response::PREV_REQUEST_IS_NOT_FINISHED;
621 if( res.result != thormang3_walking_module_msgs::SetJointFeedBackGain::Response::NO_ERROR)
627 if( req.updating_duration <= 0.0 )
632 publishStatusMsg(robotis_controller_msgs::StatusMsg::STATUS_INFO, status_msg);
645 Eigen::MatrixXd A(6,6), B(6, 1);
646 A << 0.0, 0.0, 0.0, 0.0, 0.0, 1.0,
647 0.0, 0.0, 0.0, 0.0, 1.0, 0.0,
648 0.0, 0.0, 0.0, 2.0, 0.0, 0.0,
649 tf*tf*tf*tf*tf, tf*tf*tf*tf, tf*tf*tf, tf*tf, tf, 1.0,
650 5.0*tf*tf*tf*tf, 4.0*tf*tf*tf, 3.0*tf*tf, 2.0*tf, 1.0, 0.0,
651 20.0*tf*tf*tf, 12.0*tf*tf, 6.0*tf, 2.0, 0.0, 0.0;
653 B << 0, 0, 0, 1.0, 0, 0;
691 thormang3_walking_module_msgs::SetBalanceParam::Response &res)
694 res.result = thormang3_walking_module_msgs::SetBalanceParam::Response::NO_ERROR;
697 res.result |= thormang3_walking_module_msgs::SetBalanceParam::Response::NOT_ENABLED_WALKING_MODULE;
701 res.result |= thormang3_walking_module_msgs::SetBalanceParam::Response::PREV_REQUEST_IS_NOT_FINISHED;
704 if( (req.balance_param.roll_gyro_cut_off_frequency <= 0) ||
705 (req.balance_param.pitch_gyro_cut_off_frequency <= 0) ||
706 (req.balance_param.roll_angle_cut_off_frequency <= 0) ||
707 (req.balance_param.pitch_angle_cut_off_frequency <= 0) ||
708 (req.balance_param.foot_x_force_cut_off_frequency <= 0) ||
709 (req.balance_param.foot_y_force_cut_off_frequency <= 0) ||
710 (req.balance_param.foot_z_force_cut_off_frequency <= 0) ||
711 (req.balance_param.foot_roll_torque_cut_off_frequency <= 0) ||
712 (req.balance_param.foot_pitch_torque_cut_off_frequency <= 0) )
722 previous_balance_param_.foot_roll_torque_cut_off_frequency = req.balance_param.foot_roll_torque_cut_off_frequency;
723 previous_balance_param_.foot_pitch_torque_cut_off_frequency = req.balance_param.foot_pitch_torque_cut_off_frequency;
726 if(res.result != thormang3_walking_module_msgs::SetBalanceParam::Response::NO_ERROR)
732 if( req.updating_duration <= 0.0 )
737 publishStatusMsg(robotis_controller_msgs::StatusMsg::STATUS_INFO, status_msg);
750 Eigen::MatrixXd A(6,6), B(6, 1);
751 A << 0.0, 0.0, 0.0, 0.0, 0.0, 1.0,
752 0.0, 0.0, 0.0, 0.0, 1.0, 0.0,
753 0.0, 0.0, 0.0, 2.0, 0.0, 0.0,
754 tf*tf*tf*tf*tf, tf*tf*tf*tf, tf*tf*tf, tf*tf, tf, 1.0,
755 5.0*tf*tf*tf*tf, 4.0*tf*tf*tf, 3.0*tf*tf, 2.0*tf, 1.0, 0.0,
756 20.0*tf*tf*tf, 12.0*tf*tf, 6.0*tf, 2.0, 0.0, 0.0;
758 B << 0, 0, 0, 1.0, 0, 0;
813 publishStatusMsg(robotis_controller_msgs::StatusMsg::STATUS_INFO, status_msg);
1046 thormang3_walking_module_msgs::RemoveExistingStepData::Response &res)
1050 res.result = thormang3_walking_module_msgs::RemoveExistingStepData::Response::NO_ERROR;
1054 res.result |= thormang3_walking_module_msgs::RemoveExistingStepData::Response::ROBOT_IS_WALKING_NOW;
1059 if(exist_num_of_step_data != 0)
1060 for(
int remove_count = 0; remove_count < exist_num_of_step_data; remove_count++)
1072 msg->orientation.x, msg->orientation.y, msg->orientation.z,
1073 msg->orientation.w);
1080 publishStatusMsg(robotis_controller_msgs::StatusMsg::STATUS_INFO, status_msg);
1148 publishStatusMsg(robotis_controller_msgs::StatusMsg::STATUS_INFO, status_msg);
1197 publishStatusMsg(robotis_controller_msgs::StatusMsg::STATUS_INFO, status_msg);
1251 for(std::map<std::string, robotis_framework::DynamixelState*>::iterator result_it =
result_.begin();
1255 std::map<std::string, robotis_framework::Dynamixel*>::iterator dxls_it = dxls.find(result_it->first);
1256 if(dxls_it != dxls.end())
1320 publishStatusMsg(robotis_controller_msgs::StatusMsg::STATUS_INFO, status_msg);
1325 publishStatusMsg(robotis_controller_msgs::StatusMsg::STATUS_INFO, status_msg);
BalanceLowPassFilter left_foot_force_z_lpf_
static const std::string WALKING_MODULE_IS_DISABLED_MSG
void updateJointFeedBackGain()
double current_right_tz_Nm_
BalanceLowPassFilter roll_gyro_lpf_
static const int STANDING
BalancePDController left_foot_force_y_ctrl_
ros::Publisher walking_joint_states_pub_
BalanceLowPassFilter right_foot_torque_pitch_lpf_
std::map< std::string, DynamixelState * > result_
void getReferenceStepDatafotAddition(robotis_framework::StepData *ref_step_data_for_addition)
double current_left_tx_Nm_
static const int IN_WALKING_STARTING
void setBalanceParam(thormang3_walking_module_msgs::BalanceParam &balance_param_msg)
double balance_update_sys_time_
Eigen::MatrixXd mat_g_to_cob_
double start_time_delay_ratio_y
void process(std::map< std::string, robotis_framework::Dynamixel * > dxls, std::map< std::string, double > sensors)
void publish(const boost::shared_ptr< M > &message) const
boost::mutex process_mutex_
BalanceLowPassFilter pitch_gyro_lpf_
boost::thread queue_thread_
virtual ~OnlineWalkingModule()
BalanceLowPassFilter left_foot_torque_roll_lpf_
static const int RIGHT_FOOT_SWING
double getCOBManualAdjustmentX()
bool addStepDataServiceCallback(thormang3_walking_module_msgs::AddStepDataArray::Request &req, thormang3_walking_module_msgs::AddStepDataArray::Response &res)
thormang3_walking_module_msgs::BalanceParam current_balance_param_
double balance_update_duration_
BalanceLowPassFilter left_foot_torque_pitch_lpf_
void quaternionEigenToMsg(const Eigen::Quaterniond &e, geometry_msgs::Quaternion &m)
Subscriber subscribe(const std::string &topic, uint32_t queue_size, void(T::*fp)(M), T *obj, const TransportHints &transport_hints=TransportHints())
double current_right_ty_Nm_
double current_right_fz_N_
double current_left_fx_N_
Eigen::MatrixXd rot_z_pi_3d_
thormang3_walking_module_msgs::BalanceParam desired_balance_param_
double out_angle_rad_[16]
double current_left_fy_N_
Eigen::MatrixXd mat_g_to_rfoot_
double curr_angle_rad_[12]
double hip_roll_feedforward_angle_rad_
void initialize(const int control_cycle_msec, robotis_framework::Robot *robot)
double current_right_fy_N_
double current_left_tz_Nm_
static const int IN_WALKING
BalancePDController foot_roll_gyro_ctrl_
BalancePDController right_foot_force_y_ctrl_
thormang3_walking_module_msgs::JointFeedBackGain desired_joint_feedback_gain_
BalancePDController right_foot_force_x_ctrl_
ServiceServer advertiseService(const std::string &service, bool(T::*srv_func)(MReq &, MRes &), T *obj)
thormang3::BalanceControlUsingPDController balance_ctrl_
StepPositionData position_data
double finish_time_advance_ratio_pitch
thormang3_walking_module_msgs::BalanceParam previous_balance_param_
static const std::string JOINT_FEEDBACK_GAIN_UPDATE_FINISHED_MSG
double start_time_delay_ratio_x
ControlMode control_mode_
void setJointFeedBackGain(thormang3_walking_module_msgs::JointFeedBackGain &msg)
BalancePDController left_foot_torque_roll_ctrl_
double current_left_ty_Nm_
bool setInitialPose(double r_foot_x, double r_foot_y, double r_foot_z, double r_foot_roll, double r_foot_pitch, double r_foot_yaw, double l_foot_x, double l_foot_y, double l_foot_z, double l_foot_roll, double l_foot_pitch, double l_foot_yaw, double center_of_body_x, double center_of_body_y, double center_of_body_z, double center_of_body_roll, double center_of_body_pitch, double center_of_body_yaw)
int convertStepDataToStepDataMsg(robotis_framework::StepData &src, thormang3_walking_module_msgs::StepData &des)
ros::Publisher done_msg_pub_
BalanceLowPassFilter right_foot_force_x_lpf_
thormang3_walking_module_msgs::JointFeedBackGain current_joint_feedback_gain_
thormang3_walking_module_msgs::WalkingJointStatesStamped walking_joint_states_msg_
double start_time_delay_ratio_z
int getNumofRemainingUnreservedStepData()
BalanceLowPassFilter pitch_angle_lpf_
BalanceLowPassFilter left_foot_force_x_lpf_
void setCurrentIMUSensorOutput(double gyro_x, double gyro_y, double quat_x, double quat_y, double quat_z, double quat_w)
double current_right_tx_Nm_
void publishStatusMsg(unsigned int type, std::string msg)
static const std::string BALANCE_HAS_BEEN_TURNED_OFF
BalanceLowPassFilter right_foot_force_z_lpf_
ros::Publisher robot_pose_pub_
double orientation_pitch_
ROSCPP_DECL bool get(const std::string &key, std::string &s)
void publishRobotPose(void)
double getCOBManualAdjustmentY()
double current_right_fx_N_
void setCallbackQueue(CallbackQueueInterface *queue)
BalanceLowPassFilter roll_angle_lpf_
static const int IN_WALKING_ENDING
int r_foot_ft_publish_checker_
double finish_time_advance_ratio_z
double finish_time_advance_ratio_x
BalanceLowPassFilter right_foot_force_y_lpf_
double joint_feedback_update_duration_
void setCutOffFrequency(double cut_off_frequency)
bool startWalkingServiceCallback(thormang3_walking_module_msgs::StartWalking::Request &req, thormang3_walking_module_msgs::StartWalking::Response &res)
double finish_time_advance_ratio_yaw
Publisher advertise(const std::string &topic, uint32_t queue_size, bool latch=false)
bool removeExistingStepDataServiceCallback(thormang3_walking_module_msgs::RemoveExistingStepData::Request &req, thormang3_walking_module_msgs::RemoveExistingStepData::Response &res)
BalancePDController left_foot_force_x_ctrl_
static const std::string WALKING_MODULE_IS_ENABLED_MSG
static const std::string BALANCE_PARAM_SETTING_STARTED_MSG
double finish_time_advance_ratio_y
static const std::string JOINT_FEEDBACK_GAIN_UPDATE_STARTED_MSG
static const std::string BALANCE_PARAM_SETTING_FINISHED_MSG
bool addStepData(robotis_framework::StepData step_data)
void updateBalanceParam()
std::map< std::string, int > joint_name_to_index_
bool getReferenceStepDataServiceCallback(thormang3_walking_module_msgs::GetReferenceStepData::Request &req, thormang3_walking_module_msgs::GetReferenceStepData::Response &res)
double finish_time_advance_ratio_roll
double start_time_delay_ratio_pitch
static const std::string WALKING_START_MSG
Eigen::MatrixXd balance_update_polynomial_coeff_
thormang3_walking_module_msgs::JointFeedBackGain previous_joint_feedback_gain_
BalanceLowPassFilter left_foot_force_y_lpf_
static const std::string WALKING_FINISH_MSG
double start_time_delay_ratio_roll
double powDI(double a, int b)
static const int LEFT_FOOT_SWING
BalancePDController left_foot_force_z_ctrl_
Eigen::MatrixXd desired_matrix_g_to_rfoot_
BalancePDController foot_roll_angle_ctrl_
double l_leg_out_angle_rad_[6]
double r_leg_out_angle_rad_[6]
BalancePDController right_foot_torque_pitch_ctrl_
BalanceLowPassFilter right_foot_torque_roll_lpf_
thormang3::BalancePDController leg_angle_feed_back_[12]
bool balance_update_with_loop_
ros::Publisher pelvis_base_msg_pub_
bool setBalanceParamServiceCallback(thormang3_walking_module_msgs::SetBalanceParam::Request &req, thormang3_walking_module_msgs::SetBalanceParam::Response &res)
static const std::string FAILED_TO_ADD_STEP_DATA_MSG
int convertStepDataMsgToStepData(thormang3_walking_module_msgs::StepData &src, robotis_framework::StepData &des)
double getCutOffFrequency(void)
bool joint_feedback_update_with_loop_
void publishDoneMsg(std::string msg)
BalancePDController foot_pitch_angle_ctrl_
double joint_feedback_update_sys_time_
bool IsRunningServiceCallback(thormang3_walking_module_msgs::IsRunning::Request &req, thormang3_walking_module_msgs::IsRunning::Response &res)
BalancePDController left_foot_torque_pitch_ctrl_
BalancePDController right_foot_torque_roll_ctrl_
Eigen::MatrixXd desired_matrix_g_to_cob_
thormang3_walking_module_msgs::RobotPose robot_pose_msg_
BalancePDController right_foot_force_z_ctrl_
Eigen::MatrixXd mat_g_to_lfoot_
BalancePDController foot_pitch_gyro_ctrl_
Eigen::MatrixXd rot_x_pi_3d_
double shoulder_swing_gain
void imuDataOutputCallback(const sensor_msgs::Imu::ConstPtr &msg)
int l_foot_ft_publish_checker_
Eigen::MatrixXd joint_feedback_update_polynomial_coeff_
double start_time_delay_ratio_yaw
ros::Publisher status_msg_pub_
double current_left_fz_N_
bool setJointFeedBackGainServiceCallback(thormang3_walking_module_msgs::SetJointFeedBackGain::Request &req, thormang3_walking_module_msgs::SetJointFeedBackGain::Response &res)
void setCOBManualAdjustment(double cob_x_adjustment_m, double cob_y_adjustment_m, double cob_z_adjustment_m)
Eigen::MatrixXd desired_matrix_g_to_lfoot_