qnode.cpp
Go to the documentation of this file.
1 /*******************************************************************************
2 * Copyright 2018 ROBOTIS CO., LTD.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 *******************************************************************************/
16 
17 /* Author: Kayman Jung */
18 
19 /*****************************************************************************
20  ** Includes
21  *****************************************************************************/
22 
23 #include "../include/thormang3_demo/qnode.hpp"
24 
25 /*****************************************************************************
26  ** Namespaces
27  *****************************************************************************/
28 
29 namespace thormang3_demo
30 {
31 
32 /*****************************************************************************
33  ** Implementation
34  *****************************************************************************/
35 
36 QNodeThor3::QNodeThor3(int argc, char** argv)
37  : init_argc_(argc),
38  init_argv_(argv),
39  marker_name_("THORMANG3_demo_marker"),
40  frame_id_("pelvis_link")
41 {
42  // code to DEBUG
43  debug_print_ = false;
44 
45  if (argc >= 2)
46  {
47  std::string debug_code(argv[1]);
48  if (debug_code == "debug")
49  debug_print_ = true;
50  else
51  debug_print_ = false;
52  }
53 }
54 
56 {
57  if (ros::isStarted())
58  {
59  ros::shutdown(); // explicitly needed since we use ros::start();
61  }
62 
63  wait();
64 }
65 
67 {
68  ros::init(init_argc_, init_argv_, "thormang3_demo");
69 
70  if (ros::master::check() == false)
71  {
72  return false;
73  }
74 
75  ros::start(); // explicitly needed since our nodehandle is going out of scope.
76 
77  ros::NodeHandle nh;
78 
79  package_name_ = ros::package::getPath("thormang3_demo");
80 
81  // Add your ros communications here.
82  status_msg_sub_ = nh.subscribe("/robotis/status", 10, &QNodeThor3::statusMsgCallback, this);
83  current_module_control_sub_ = nh.subscribe("/robotis/present_joint_ctrl_modules", 10,
85  current_joint_states_sub_ = nh.subscribe("/robotis/present_joint_states", 10,
87 
88  get_module_control_client_ = nh.serviceClient<robotis_controller_msgs::GetJointModule>(
89  "/robotis/get_present_joint_ctrl_modules");
90 
91  move_lidar_pub_ = nh.advertise<std_msgs::String>("/robotis/head_control/move_lidar", 0);
92  module_control_pub_ = nh.advertise<robotis_controller_msgs::JointCtrlModule>("/robotis/set_joint_ctrl_modules", 0);
93  module_control_preset_pub_ = nh.advertise<std_msgs::String>("/robotis/enable_ctrl_module", 0);
94  init_pose_pub_ = nh.advertise<std_msgs::String>("/robotis/base/ini_pose", 0);
95  init_ft_pub_ = nh.advertise<std_msgs::String>("/robotis/feet_ft/ft_calib_command", 0);
96 
97  init_ft_foot_sub_ = nh.subscribe("/robotis/feet_ft/both_ft_value", 10, &QNodeThor3::initFTFootCallback, this);
98 
99  // demo
100  rviz_clicked_point_sub_ = nh.subscribe("clicked_point", 0, &QNodeThor3::pointStampedCallback, this);
101  interactive_marker_server_.reset(new interactive_markers::InteractiveMarkerServer("THORMANG_Pose", "", false));
102 
103  // Manipulation
104  kenematics_pose_sub_ = nh.subscribe("/thormang3_demo/ik_target_pose", 10, &QNodeThor3::getKinematicsPoseCallback,
105  this);
106 
107  send_ini_pose_msg_pub_ = nh.advertise<std_msgs::String>("/robotis/manipulation/ini_pose_msg", 0);
108  send_des_joint_msg_pub_ = nh.advertise<thormang3_manipulation_module_msgs::JointPose>(
109  "/robotis/manipulation/joint_pose_msg", 0);
110  send_ik_msg_pub_ = nh.advertise<thormang3_manipulation_module_msgs::KinematicsPose>(
111  "/robotis/manipulation/kinematics_pose_msg", 0);
112 
113  get_joint_pose_client_ = nh.serviceClient<thormang3_manipulation_module_msgs::GetJointPose>(
114  "/robotis/manipulation/get_joint_pose");
115  get_kinematics_pose_client_ = nh.serviceClient<thormang3_manipulation_module_msgs::GetKinematicsPose>(
116  "/robotis/manipulation/get_kinematics_pose");
117  send_gripper_pub_ = nh.advertise<sensor_msgs::JointState>("/robotis/gripper/joint_pose_msg", 0);
118 
119  // Walking
120  set_balance_param_client_ = nh.serviceClient<thormang3_walking_module_msgs::SetBalanceParam>(
121  "/robotis/walking/set_balance_param");
122  set_joint_feedback_gain_client_ = nh.serviceClient<thormang3_walking_module_msgs::SetJointFeedBackGain>("/robotis/walking/joint_feedback_gain");
123  set_walking_command_pub_ = nh.advertise<thormang3_foot_step_generator::FootStepCommand>(
124  "/robotis/thormang3_foot_step_generator/walking_command", 0);
125  set_walking_footsteps_pub_ = nh.advertise<thormang3_foot_step_generator::Step2DArray>(
126  "/robotis/thormang3_foot_step_generator/footsteps_2d", 0);
127  set_walking_balance_pub_ = nh.advertise<std_msgs::Bool>("/robotis/thormang3_foot_step_generator/balance_command", 0);
128 
129  humanoid_footstep_client_ = nh.serviceClient<humanoid_nav_msgs::PlanFootsteps>("plan_footsteps");
130  marker_pub_ = nh.advertise<visualization_msgs::MarkerArray>("/robotis/demo/foot_step_marker", 0);
131  pose_sub_ = nh.subscribe("/robotis/demo/pose", 10, &QNodeThor3::poseCallback, this);
132 
133  // Head control
134  set_head_joint_angle_pub_ = nh.advertise<sensor_msgs::JointState>("/robotis/head_control/set_joint_states", 0);
135 
136  // Action
137  motion_index_pub_ = nh.advertise<std_msgs::Int32>("/robotis/demo/action_index", 0);
138  motion_page_pub_ = nh.advertise<std_msgs::Int32>("/robotis/action/page_num", 0);
139 
140  // Config
141  std::string default_config_path = ros::package::getPath("thormang3_demo") + "/config/demo_config.yaml";
142  std::string config_path = nh.param<std::string>("demo_config", default_config_path);
143  parseJointNameFromYaml(config_path);
144 
145  std::string motion_path = ros::package::getPath("thormang3_demo") + "/config/motion.yaml";
146  parseMotionMapFromYaml(motion_path);
147 
148  // set start time
150 
151  // start qthread
152  start();
153 
154  return true;
155 }
156 
158 {
159  ros::Rate loop_rate(100);
160 
161  while (ros::ok())
162  {
163  ros::spinOnce();
164  loop_rate.sleep();
165  }
166 
168 
169  std::cout << "Ros shutdown, proceeding to close the gui." << std::endl;
170  Q_EMIT rosShutdown(); // used to signal the gui for a shutdown (useful to roslaunch)
171 }
172 
173 void QNodeThor3::parseJointNameFromYaml(const std::string &path)
174 {
175  YAML::Node doc;
176  try
177  {
178  // load yaml
179  doc = YAML::LoadFile(path.c_str());
180  } catch (const std::exception& e)
181  {
182  ROS_ERROR("Fail to load id_joint table yaml.");
183  return;
184  }
185 
186  // parse id_joint table
187  YAML::Node id_sub_node = doc["id_joint"];
188  for (YAML::iterator yaml_it = id_sub_node.begin(); yaml_it != id_sub_node.end(); ++yaml_it)
189  {
190  int id;
191  std::string joint_name;
192 
193  id = yaml_it->first.as<int>();
194  joint_name = yaml_it->second.as<std::string>();
195 
196  id_joint_table_[id] = joint_name;
197  joint_id_table_[joint_name] = id;
198 
199  ROS_DEBUG_STREAM_COND(debug_print_, "Joint ID : " << id << " - " << joint_name);
200  }
201 
202  // parse module
203  std::vector<std::string> modules = doc["module_list"].as<std::vector<std::string> >();
204 
205  int module_index = 0;
206  for (std::vector<std::string>::iterator module_it = modules.begin(); module_it != modules.end(); ++module_it)
207  {
208  std::string module_name = *module_it;
209 
210  index_mode_table_[module_index] = module_name;
211  mode_index_table_[module_name] = module_index++;
212 
213  using_mode_table_[module_name] = false;
214  }
215 
216  // parse module_joint preset
217  YAML::Node sub_node = doc["module_button"];
218  for (YAML::iterator button_it = sub_node.begin(); button_it != sub_node.end(); ++button_it)
219  {
220  int key;
221  std::string module_name;
222 
223  key = button_it->first.as<int>();
224  module_name = button_it->second.as<std::string>();
225 
226  module_table_[key] = module_name;
227 
228  ROS_DEBUG_STREAM_COND(debug_print_, "Preset : " << module_name);
229  }
230 }
231 
232 void QNodeThor3::parseMotionMapFromYaml(const std::string &path)
233 {
234  YAML::Node doc;
235  try
236  {
237  // load yaml
238  doc = YAML::LoadFile(path.c_str());
239  } catch (const std::exception& e)
240  {
241  ROS_ERROR("Fail to load motion yaml.");
242  return;
243  }
244 
245  // parse motion_table
246  YAML::Node motion_sub_node = doc["motion"];
247  for (YAML::iterator motion_it = motion_sub_node.begin(); motion_it != motion_sub_node.end(); ++motion_it)
248  {
249  int motion_index;
250  std::string motion_name;
251 
252  motion_index = motion_it->first.as<int>();
253  motion_name = motion_it->second.as<std::string>();
254 
255  motion_table_[motion_index] = motion_name;
256 
257  ROS_DEBUG_STREAM_COND(debug_print_, "Motion Index : " << motion_index << " - " << motion_name);
258  }
259 }
260 
261 // joint id -> joint name
262 bool QNodeThor3::getJointNameFromID(const int &id, std::string &joint_name)
263 {
264  std::map<int, std::string>::iterator map_it;
265 
266  map_it = id_joint_table_.find(id);
267  if (map_it == id_joint_table_.end())
268  return false;
269 
270  joint_name = map_it->second;
271  return true;
272 }
273 
274 // joint name -> joint id
275 bool QNodeThor3::getIDFromJointName(const std::string &joint_name, int &id)
276 {
277  std::map<std::string, int>::iterator map_it;
278 
279  map_it = joint_id_table_.find(joint_name);
280  if (map_it == joint_id_table_.end())
281  return false;
282 
283  id = map_it->second;
284  return true;
285 }
286 
287 // map index -> joint id & joint name
288 bool QNodeThor3::getIDJointNameFromIndex(const int &index, int &id, std::string &joint_name)
289 {
290  std::map<int, std::string>::iterator map_it;
291 
292  int count = 0;
293  for (map_it = id_joint_table_.begin(); map_it != id_joint_table_.end(); ++map_it, count++)
294  {
295  if (index == count)
296  {
297  id = map_it->first;
298  joint_name = map_it->second;
299  return true;
300  }
301  }
302 
303  return false;
304 }
305 
306 // mode(module) index -> mode(module) name
307 std::string QNodeThor3::getModuleName(const int &index)
308 {
309  std::string mode = "";
310  std::map<int, std::string>::iterator map_it = index_mode_table_.find(index);
311 
312  if (map_it != index_mode_table_.end())
313  mode = map_it->second;
314 
315  return mode;
316 }
317 
318 // mode(module) name -> mode(module) index, fail to find out :-1
319 int QNodeThor3::getModuleIndex(const std::string &mode_name)
320 {
321  int mode_index = -1;
322  std::map<std::string, int>::iterator map_it = mode_index_table_.find(mode_name);
323 
324  if (map_it != mode_index_table_.end())
325  mode_index = map_it->second;
326 
327  return mode_index;
328 }
329 
330 // number of mode(module)s
332 {
333  return index_mode_table_.size();
334 }
335 
336 // number of joints
338 {
339  return id_joint_table_.size();
340 }
341 
343 {
344  for (std::map<std::string, bool>::iterator map_it = using_mode_table_.begin(); map_it != using_mode_table_.end();
345  ++map_it)
346  map_it->second = false;
347 }
348 
349 bool QNodeThor3::isUsingModule(const std::string &module_name)
350 {
351  std::map<std::string, bool>::iterator map_it = using_mode_table_.find(module_name);
352 
353  if (map_it == using_mode_table_.end())
354  return false;
355 
356  return map_it->second;
357 }
358 
360 {
361  current_control_ui_ = mode;
362 
363  ROS_INFO("Current UI : %d", mode);
364 }
365 
366 // move to init pose : base module
368 {
369  std_msgs::String init_msg;
370  init_msg.data = "ini_pose";
371 
372  init_pose_pub_.publish(init_msg);
373 
374  log(Info, "Go to robot initial pose.");
375 }
376 
377 void QNodeThor3::initFTCommand(std::string command)
378 {
379  std_msgs::String ft_msg;
380  ft_msg.data = command;
381 
382  init_ft_pub_.publish(ft_msg);
383 }
384 
385 // move head to assemble 3d lidar(pointcloud)
387 {
388  std_msgs::String lidar_msg;
389  lidar_msg.data = "start";
390 
391  move_lidar_pub_.publish(lidar_msg);
392  log(Info, "Publish move_lidar topic");
393 }
394 
395 // enable mode(module)
396 void QNodeThor3::enableControlModule(const std::string &mode)
397 {
398  std_msgs::String msg;
399  msg.data = mode;
400 
402 
403  std::stringstream ss;
404  ss << "Set Mode : " << mode;
405  log(Info, ss.str());
406 }
407 
408 // get current mode(module) of joints
410 {
411  robotis_controller_msgs::GetJointModule get_joint;
412  std::map<std::string, int> service_map;
413 
414  // get_joint.request
415  std::map<int, std::string>::iterator map_it;
416  int index = 0;
417  for (map_it = id_joint_table_.begin(); map_it != id_joint_table_.end(); ++map_it, index++)
418  {
419  get_joint.request.joint_name.push_back(map_it->second);
420  service_map[map_it->second] = index;
421  }
422 
423  if (get_module_control_client_.call(get_joint))
424  {
425  // get_joint.response
426  std::vector<int> modules;
427  modules.resize(getJointTableSize());
428 
429  // clear current using modules
431 
432  for (int ix = 0; ix < get_joint.response.joint_name.size(); ix++)
433  {
434  std::string joint_name = get_joint.response.joint_name[ix];
435  std::string module_name = get_joint.response.module_name[ix];
436 
437  std::map<std::string, int>::iterator service_iter = service_map.find(joint_name);
438  if (service_iter == service_map.end())
439  continue;
440 
441  index = service_iter->second;
442 
443  service_iter = mode_index_table_.find(module_name);
444  if (service_iter == mode_index_table_.end())
445  continue;
446 
447  ROS_DEBUG_STREAM_COND(debug_print_, "joint[" << ix << "] : " << service_iter->second);
448 
449  modules.at(index) = service_iter->second;
450 
451  std::map<std::string, bool>::iterator module_iter = using_mode_table_.find(module_name);
452  if (module_iter != using_mode_table_.end())
453  module_iter->second = true;
454  }
455 
456  // update ui
457  Q_EMIT updatePresentJointControlModules(modules);
458  log(Info, "Get current Mode");
459  }
460  else
461  log(Error, "Fail to get current joint control module.");
462 }
463 
464 void QNodeThor3::refreshCurrentJointControlCallback(const robotis_controller_msgs::JointCtrlModule::ConstPtr &msg)
465 {
466  ROS_INFO("set current joint module");
467 
468  std::vector<int> modules;
469  modules.resize(getJointTableSize());
470 
471  std::map<std::string, int> joint_module;
472 
473  // clear current using modules
475 
476  for (int ix = 0; ix < msg->joint_name.size(); ix++)
477  {
478  std::string joint_name = msg->joint_name[ix];
479  std::string module_name = msg->module_name[ix];
480 
481  joint_module[joint_name] = getModuleIndex(module_name);
482 
483  std::map<std::string, bool>::iterator module_iter = using_mode_table_.find(module_name);
484  if (module_iter != using_mode_table_.end())
485  module_iter->second = true;
486  }
487 
488  for (int ix = 0; ix < getJointTableSize(); ix++)
489  {
490  int id = 0;
491  std::string joint_name = "";
492 
493  if (getIDJointNameFromIndex(ix, id, joint_name) == false)
494  continue;
495 
496  std::map<std::string, int>::iterator module_iter = joint_module.find(joint_name);
497  if (module_iter == joint_module.end())
498  continue;
499 
500  ROS_DEBUG_STREAM_COND(debug_print_, "joint[" << ix << "] : " << module_iter->second);
501  modules.at(ix) = module_iter->second;
502  }
503 
504  // update ui
505  Q_EMIT updatePresentJointControlModules(modules);
506 
507  log(Info, "Applied Mode", "Manager");
508 }
509 
510 void QNodeThor3::updateHeadJointStatesCallback(const sensor_msgs::JointState::ConstPtr &msg)
511 {
512  double head_pan, head_tilt;
513  int count_getting_joint = 0;
514 
515  for (int ix = 0; ix < msg->name.size(); ix++)
516  {
517  if (msg->name[ix] == "head_y")
518  {
519  head_pan = -msg->position[ix];
520  count_getting_joint += 1;
521  }
522  else if (msg->name[ix] == "head_p")
523  {
524  head_tilt = -msg->position[ix];
525  count_getting_joint += 1;
526  }
527 
528  if (count_getting_joint == 2)
529  break;
530  }
531 
532  if (count_getting_joint > 0)
533  Q_EMIT updateHeadJointsAngle(head_pan, head_tilt);
534 }
535 
536 void QNodeThor3::initFTFootCallback(const thormang3_feet_ft_module_msgs::BothWrench::ConstPtr &msg)
537 {
538  std::stringstream ss;
539  ss << "Type : " << msg->name << std::endl;
540  ss << " - Right - " << std::endl << msg->right << std::endl;
541  ss << " - Left - " << std::endl << msg->left;
542 
543  log(Info, ss.str());
544 }
545 
546 void QNodeThor3::setHeadJoint(double pan, double tilt)
547 {
548  sensor_msgs::JointState head_angle_msg;
549 
550  head_angle_msg.name.push_back("head_y");
551  head_angle_msg.name.push_back("head_p");
552 
553  head_angle_msg.position.push_back(-pan);
554  head_angle_msg.position.push_back(-tilt);
555 
556  set_head_joint_angle_pub_.publish(head_angle_msg);
557 }
558 
559 // Manipulation
560 void QNodeThor3::sendInitPoseMsg(std_msgs::String msg)
561 {
563 
564  log(Info, "Send Ini. Pose");
565 }
566 
567 void QNodeThor3::sendDestJointMsg(thormang3_manipulation_module_msgs::JointPose msg)
568 {
570 
571  log(Info, "Set Des. Joint Vale");
572 
573  std::stringstream log_msg;
574 
575  log_msg << " \n " << "joint name : " << msg.name << " \n " << "joint value : " << msg.value * RADIAN2DEGREE << " \n ";
576 
577  log(Info, log_msg.str());
578 }
579 
580 void QNodeThor3::sendIkMsg(thormang3_manipulation_module_msgs::KinematicsPose msg)
581 {
583 
584  log(Info, "Solve Inverse Kinematics");
585  log(Info, "Set Des. End Effector's Pose : ");
586 
587  std::stringstream log_msgs;
588 
589  log_msgs << " \n " << "group name : " << msg.name << " \n " << "des. pos. x : " << msg.pose.position.x << " \n "
590  << "des. pos. y : " << msg.pose.position.y << " \n " << "des. pos. z : " << msg.pose.position.z << " \n "
591  << "des. ori. x : " << msg.pose.orientation.x << " \n " << "des. ori. y : " << msg.pose.orientation.y
592  << " \n " << "des. ori. z : " << msg.pose.orientation.z << " \n " << "des. ori. w : "
593  << msg.pose.orientation.w << " \n ";
594 
595  log(Info, log_msgs.str());
596 }
597 
598 void QNodeThor3::sendGripperPosition(sensor_msgs::JointState msg)
599 {
600  // publish gripper angle
602 }
603 
604 void QNodeThor3::getJointPose(std::string joint_name)
605 {
606  thormang3_manipulation_module_msgs::GetJointPose get_joint_pose;
607 
608  // requeset
609  get_joint_pose.request.joint_name = joint_name;
610 
611  log(Info, "Get Curr. Joint Value");
612 
613  std::stringstream log_msg;
614 
615  log_msg << " \n " << "joint name : " << joint_name << " \n ";
616 
617  log(Info, log_msg.str());
618 
619  //response
620  if (get_joint_pose_client_.call(get_joint_pose))
621  {
622  double joint_value = get_joint_pose.response.joint_value;
623 
624  log(Info, "Joint Curr. Value");
625 
626  std::stringstream log_msg;
627 
628  log_msg << " \n " << "curr. value : " << joint_value << " \n ";
629 
630  log(Info, log_msg.str());
631 
632  Q_EMIT updateCurrJoint(joint_value);
633  }
634  else
635  log(Error, "fail to get joint pose.");
636 }
637 
638 void QNodeThor3::getKinematicsPose(std::string group_name)
639 {
640  thormang3_manipulation_module_msgs::GetKinematicsPose get_kinematics_pose;
641 
642  //request
643  get_kinematics_pose.request.group_name = group_name;
644 
645  log(Info, "Solve Forward Kinematics");
646 
647  log(Info, "Get Curr. End Effector's Pose");
648 
649  std::stringstream log_msg;
650 
651  log_msg << " \n " << "group name : " << group_name << " \n ";
652 
653  log(Info, log_msg.str());
654 
655  //response
656  if (get_kinematics_pose_client_.call(get_kinematics_pose))
657  {
658  double pos_x = get_kinematics_pose.response.group_pose.position.x;
659  double pos_y = get_kinematics_pose.response.group_pose.position.y;
660  double pos_z = get_kinematics_pose.response.group_pose.position.z;
661 
662  double ori_x = get_kinematics_pose.response.group_pose.orientation.x;
663  double ori_y = get_kinematics_pose.response.group_pose.orientation.y;
664  double ori_z = get_kinematics_pose.response.group_pose.orientation.z;
665  double ori_w = get_kinematics_pose.response.group_pose.orientation.w;
666 
667  log(Info, "End Effector Curr. Pose : ");
668 
669  std::stringstream log_msg;
670 
671  log_msg << " \n " << "curr. pos. x : " << pos_x << " \n " << "curr. pos. y : " << pos_y << " \n "
672  << "curr. pos. z : " << pos_z << " \n " << "curr. ori. w : " << ori_w << " \n " << "curr. ori. x : "
673  << ori_x << " \n " << "curr. ori. y : " << ori_y << " \n " << "curr. ori. z : " << ori_z << " \n ";
674 
675  log(Info, log_msg.str());
676 
677  Q_EMIT updateCurrPos(pos_x, pos_y, pos_z);
678  Q_EMIT updateCurrOri(ori_x, ori_y, ori_z, ori_w);
679  }
680  else
681  log(Error, "fail to get kinematics pose.");
682 }
683 
684 void QNodeThor3::getKinematicsPoseCallback(const geometry_msgs::Pose::ConstPtr &msg)
685 {
686  double z_offset = 0.801;
687  Q_EMIT updateCurrPos(msg->position.x, msg->position.y, msg->position.z + z_offset);
688  Q_EMIT updateCurrOri(msg->orientation.x, msg->orientation.y, msg->orientation.z, msg->orientation.w);
689 }
690 
691 // Walking
692 void QNodeThor3::setWalkingCommand(thormang3_foot_step_generator::FootStepCommand msg)
693 {
695 
696  std::stringstream ss;
697  ss << "Set Walking Command : " << msg.command << std::endl;
698  ss << "- Number of Step : " << msg.step_num << std::endl;
699  ss << "- Step Length : " << msg.step_length << std::endl;
700  ss << "- Side Step Length : " << msg.side_step_length << std::endl;
701  ss << "- Rotation Angle : " << msg.step_angle_rad << std::endl;
702 
703  log(Info, ss.str());
704 }
705 
706 void QNodeThor3::setWalkingBalance(bool on_command)
707 {
708  if (on_command == true)
709  turnOnBalance();
710  else
711  turnOffBalance();
712 }
713 
714 void QNodeThor3::setWalkingBalanceParam(const double &gyro_gain, const double &ft_gain_ratio,
715  const double &imu_time_const, const double &ft_time_const)
716 {
717  // todo : make the walking balance param msg and fill it, sent to the mpc of thormange3
718  if (loadBalanceParameterFromYaml() == false)
719  {
720  return;
721  }
722 
723  // set_balance_param_srv_.request.updating_duration = 2.0;
724 
725  // set_balance_param_srv_.request.balance_param.gyro_gain = gyro_gain;
726  // set_balance_param_srv_.request.balance_param.foot_x_force_gain *= ft_gain_ratio;
727  // set_balance_param_srv_.request.balance_param.foot_y_force_gain *= ft_gain_ratio;
728  // set_balance_param_srv_.request.balance_param.foot_z_force_gain *= ft_gain_ratio;
729  // set_balance_param_srv_.request.balance_param.foot_roll_torque_gain *= ft_gain_ratio;
730  // set_balance_param_srv_.request.balance_param.foot_pitch_torque_gain *= ft_gain_ratio;
731 
732  // set_balance_param_srv_.request.balance_param.foot_roll_angle_time_constant = imu_time_const;
733  // set_balance_param_srv_.request.balance_param.foot_pitch_angle_time_constant = imu_time_const;
734 
735  // set_balance_param_srv_.request.balance_param.foot_x_force_time_constant = ft_time_const;
736  // set_balance_param_srv_.request.balance_param.foot_y_force_time_constant = ft_time_const;
737  // set_balance_param_srv_.request.balance_param.foot_z_force_time_constant = ft_time_const;
738  // set_balance_param_srv_.request.balance_param.foot_roll_torque_time_constant = ft_time_const;
739  // set_balance_param_srv_.request.balance_param.foot_pitch_torque_time_constant = ft_time_const;
740 
741  // setBalanceParameter();
742 }
743 
745 {
746  if (preview_foot_steps_.size() != preview_foot_types_.size())
747  {
748  log(Error, "Footsteps are corrupted.");
749  return;
750  }
751  else if (preview_foot_steps_.size() == 0)
752  {
753  log(Warn, "No Footsteps");
754  return;
755  }
756 
757  thormang3_foot_step_generator::Step2DArray footsteps;
758 
759  for (int ix = 0; ix < preview_foot_steps_.size(); ix++)
760  {
761  thormang3_foot_step_generator::Step2D step;
762 
763  int type = preview_foot_types_[ix];
764  if (type == humanoid_nav_msgs::StepTarget::right)
765  step.moving_foot = thormang3_foot_step_generator::Step2D::RIGHT_FOOT_SWING;
766  else if (type == humanoid_nav_msgs::StepTarget::left)
767  step.moving_foot = thormang3_foot_step_generator::Step2D::LEFT_FOOT_SWING;
768  else
769  step.moving_foot = thormang3_foot_step_generator::Step2D::STANDING;
770 
771  step.step2d = preview_foot_steps_[ix];
772 
773  footsteps.footsteps_2d.push_back(step);
774  }
775 
777 
778  log(Info, "Set command to walk using footsteps");
779 
780  clearFootsteps();
781 }
782 
784 {
785  // clear foot step marker array
787 
788  preview_foot_steps_.clear();
789  preview_foot_types_.clear();
790 }
791 
793 {
795 }
796 
797 void QNodeThor3::makeFootstepUsingPlanner(const geometry_msgs::Pose &target_foot_pose)
798 {
799  //foot step service
800  humanoid_nav_msgs::PlanFootsteps get_step;
801 
802  geometry_msgs::Pose2D start;
803  geometry_msgs::Pose2D goal;
804  goal.x = target_foot_pose.position.x;
805  goal.y = target_foot_pose.position.y;
806 
807  Eigen::Quaterniond goal_orientation;
808  tf::quaternionMsgToEigen(target_foot_pose.orientation, goal_orientation);
809 
810  Eigen::Vector3d forward, f_x(1, 0, 0);
811  forward = goal_orientation.toRotationMatrix() * f_x;
812  double theta = forward.y() > 0 ? acos(forward.x()) : -acos(forward.x());
813  goal.theta = theta;
814 
815  get_step.request.start = start;
816  get_step.request.goal = goal;
817 
818  std::stringstream call_msg;
819  call_msg << "Start [" << start.x << ", " << start.y << " | " << start.theta << "]" << " , Goal [" << goal.x << ", "
820  << goal.y << " | " << goal.theta << "]";
821  log(Info, call_msg.str());
822 
823  // clear visualization
825 
826  // init foot steps
827  preview_foot_steps_.clear();
828  preview_foot_types_.clear();
829 
830  if (humanoid_footstep_client_.call(get_step))
831  {
832  if (get_step.response.result)
833  {
834  for (int ix = 0; ix < get_step.response.footsteps.size(); ix++)
835  {
836  // foot step log
837  std::stringstream msg_stream;
838  int foot_type = get_step.response.footsteps[ix].leg;
839  std::string foot = (foot_type == humanoid_nav_msgs::StepTarget::right) ? "right" : "left";
840  geometry_msgs::Pose2D foot_pose = get_step.response.footsteps[ix].pose;
841 
842  // log footsteps
843  msg_stream << "Foot Step #" << ix + 1 << " [ " << foot << "] - [" << foot_pose.x << ", " << foot_pose.y << " | "
844  << (foot_pose.theta * RADIAN2DEGREE) << "]";
845  log(Info, msg_stream.str());
846 
847  preview_foot_steps_.push_back(foot_pose);
848  preview_foot_types_.push_back(foot_type);
849  }
850 
851  // visualize foot steps
853  }
854  else
855  {
856  log(Info, "fail to get foot step from planner");
857  return;
858  }
859  }
860  else
861  {
862  log(Error, "cannot call service");
863  return;
864  }
865 
866  return;
867 }
868 
870 {
871  if (clear && preview_foot_steps_.size() == 0)
872  return;
873 
874  visualization_msgs::MarkerArray marker_array;
875  ros::Time now = ros::Time::now();
876  visualization_msgs::Marker rviz_marker;
877 
878  rviz_marker.header.frame_id = "pelvis_link";
879  rviz_marker.header.stamp = now;
880  rviz_marker.ns = "foot_step_marker";
881 
882  rviz_marker.id = 1;
883  rviz_marker.type = visualization_msgs::Marker::CUBE;
884  rviz_marker.action = (clear == false) ? visualization_msgs::Marker::ADD : visualization_msgs::Marker::DELETE;
885 
886  rviz_marker.scale.x = 0.216;
887  rviz_marker.scale.y = 0.144;
888  rviz_marker.scale.z = 0.01;
889 
890  double alpha = 0.7;
891  double height = -0.723;
892 
893  for (int ix = preview_foot_types_.size() - 1; ix >= 0; ix--)
894  {
895  // foot step marker array
896  rviz_marker.id += 10;
897 
898  if (!clear)
899  {
900  Eigen::Vector3d marker_position(preview_foot_steps_[ix].x, preview_foot_steps_[ix].y, height);
901  Eigen::Vector3d marker_position_offset;
902 
903  Eigen::Vector3d toward(1, 0, 0), direction(cos(preview_foot_steps_[ix].theta), sin(preview_foot_steps_[ix].theta),
904  0);
905  Eigen::Quaterniond marker_orientation(Eigen::Quaterniond::FromTwoVectors(toward, direction));
906 
907  if (debug_print_)
908  {
909  std::stringstream msg;
910  msg << "Foot Step #" << ix << " [ " << preview_foot_types_[ix] << "] - [" << rviz_marker.pose.position.x << ", "
911  << rviz_marker.pose.position.y << "]";
912  log(Info, msg.str());
913  }
914  alpha *= 0.9;
915 
916  // set foot step color
917  if (preview_foot_types_[ix] == humanoid_nav_msgs::StepTarget::left) // left
918  {
919  rviz_marker.color.r = 0.0;
920  rviz_marker.color.g = 0.0;
921  rviz_marker.color.b = 1.0;
922  rviz_marker.color.a = alpha + 0.3;
923 
924  Eigen::Vector3d offset_y(0, 0.015, 0);
925  marker_position_offset = marker_orientation.toRotationMatrix() * offset_y;
926 
927  }
928  else if (preview_foot_types_[ix] == humanoid_nav_msgs::StepTarget::right) //right
929  {
930  rviz_marker.color.r = 1.0;
931  rviz_marker.color.g = 0.0;
932  rviz_marker.color.b = 0.0;
933  rviz_marker.color.a = alpha + 0.3;
934 
935  Eigen::Vector3d offset_y(0, -0.015, 0);
936  marker_position_offset = marker_orientation.toRotationMatrix() * offset_y;
937  }
938 
939  marker_position = marker_position_offset + marker_position;
940 
941  tf::pointEigenToMsg(marker_position, rviz_marker.pose.position);
942  tf::quaternionEigenToMsg(marker_orientation, rviz_marker.pose.orientation);
943 
944  // apply foot x offset
945  }
946 
947  marker_array.markers.push_back(rviz_marker);
948  }
949 
950  // publish foot step marker array
951  if (clear == false)
952  log(Info, "Visualize Preview Footstep Marker Array");
953  else
954  log(Info, "Clear Visualize Preview Footstep Marker Array");
955 
956  marker_pub_.publish(marker_array);
957 }
958 
960 {
961  bool service_result = false;
962 
963  // call service
965  if (service_result == true)
966  {
967  int _result = set_balance_param_srv_.response.result;
968  if (_result == thormang3_walking_module_msgs::SetBalanceParam::Response::NO_ERROR)
969  {
970  ROS_INFO("[Demo] : Succeed to set balance param");
971  ROS_INFO("[Demo] : Please wait 2 sec for turning on balance");
972  log(Info, "Set Walking Balance parameters");
973  }
974  else
975  {
976  if (_result & thormang3_walking_module_msgs::SetBalanceParam::Response::NOT_ENABLED_WALKING_MODULE)
977  ROS_ERROR("[Demo] : BALANCE_PARAM_ERR::NOT_ENABLED_WALKING_MODULE");
978  if (_result & thormang3_walking_module_msgs::SetBalanceParam::Response::PREV_REQUEST_IS_NOT_FINISHED)
979  ROS_ERROR("[Demo] : BALANCE_PARAM_ERR::PREV_REQUEST_IS_NOT_FINISHED");
980  }
981  }
982  else
983  ROS_ERROR("[Demo] : Failed to set balance param ");
984 
985  setFeedBackGain();
986 }
987 
989 {
990  std::string balance_yaml_path = "";
991  balance_yaml_path = package_name_ + "/config/balance_param.yaml";
992 
993  YAML::Node doc;
994  try
995  {
996  // load yaml
997  doc = YAML::LoadFile(balance_yaml_path.c_str());
998 
999  double cob_x_offset_m = doc["cob_x_offset_m"].as<double>();
1000  double cob_y_offset_m = doc["cob_y_offset_m"].as<double>();
1001  double hip_roll_swap_angle_rad = doc["hip_roll_swap_angle_rad"].as<double>();
1002  double foot_roll_gyro_p_gain = doc["foot_roll_gyro_p_gain"].as<double>();
1003  double foot_roll_gyro_d_gain = doc["foot_roll_gyro_d_gain"].as<double>();
1004  double foot_pitch_gyro_p_gain = doc["foot_pitch_gyro_p_gain"].as<double>();
1005  double foot_pitch_gyro_d_gain = doc["foot_pitch_gyro_d_gain"].as<double>();
1006  double foot_roll_angle_p_gain = doc["foot_roll_angle_p_gain"].as<double>();
1007  double foot_roll_angle_d_gain = doc["foot_roll_angle_d_gain"].as<double>();
1008  double foot_pitch_angle_p_gain = doc["foot_pitch_angle_p_gain"].as<double>();
1009  double foot_pitch_angle_d_gain = doc["foot_pitch_angle_d_gain"].as<double>();
1010  double foot_x_force_p_gain = doc["foot_x_force_p_gain"].as<double>();
1011  double foot_x_force_d_gain = doc["foot_x_force_d_gain"].as<double>();
1012  double foot_y_force_p_gain = doc["foot_y_force_p_gain"].as<double>();
1013  double foot_y_force_d_gain = doc["foot_y_force_d_gain"].as<double>();
1014  double foot_z_force_p_gain = doc["foot_z_force_p_gain"].as<double>();
1015  double foot_z_force_d_gain = doc["foot_z_force_d_gain"].as<double>();
1016  double foot_roll_torque_p_gain = doc["foot_roll_torque_p_gain"].as<double>();
1017  double foot_roll_torque_d_gain = doc["foot_roll_torque_d_gain"].as<double>();
1018  double foot_pitch_torque_p_gain = doc["foot_pitch_torque_p_gain"].as<double>();
1019  double foot_pitch_torque_d_gain = doc["foot_pitch_torque_d_gain"].as<double>();
1020  double roll_gyro_cut_off_frequency = doc["roll_gyro_cut_off_frequency"].as<double>();
1021  double pitch_gyro_cut_off_frequency = doc["pitch_gyro_cut_off_frequency"].as<double>();
1022  double roll_angle_cut_off_frequency = doc["roll_angle_cut_off_frequency"].as<double>();
1023  double pitch_angle_cut_off_frequency = doc["pitch_angle_cut_off_frequency"].as<double>();
1024  double foot_x_force_cut_off_frequency = doc["foot_x_force_cut_off_frequency"].as<double>();
1025  double foot_y_force_cut_off_frequency = doc["foot_y_force_cut_off_frequency"].as<double>();
1026  double foot_z_force_cut_off_frequency = doc["foot_z_force_cut_off_frequency"].as<double>();
1027  double foot_roll_torque_cut_off_frequency = doc["foot_roll_torque_cut_off_frequency"].as<double>();
1028  double foot_pitch_torque_cut_off_frequency = doc["foot_pitch_torque_cut_off_frequency"].as<double>();
1029 
1030  set_balance_param_srv_.request.updating_duration = 2.0;
1031  set_balance_param_srv_.request.balance_param.cob_x_offset_m = cob_x_offset_m ;
1032  set_balance_param_srv_.request.balance_param.cob_y_offset_m = cob_y_offset_m ;
1033  set_balance_param_srv_.request.balance_param.hip_roll_swap_angle_rad = hip_roll_swap_angle_rad ;
1034  set_balance_param_srv_.request.balance_param.foot_roll_gyro_p_gain = foot_roll_gyro_p_gain ;
1035  set_balance_param_srv_.request.balance_param.foot_roll_gyro_d_gain = foot_roll_gyro_d_gain ;
1036  set_balance_param_srv_.request.balance_param.foot_pitch_gyro_p_gain = foot_pitch_gyro_p_gain ;
1037  set_balance_param_srv_.request.balance_param.foot_pitch_gyro_d_gain = foot_pitch_gyro_d_gain ;
1038  set_balance_param_srv_.request.balance_param.foot_roll_angle_p_gain = foot_roll_angle_p_gain ;
1039  set_balance_param_srv_.request.balance_param.foot_roll_angle_d_gain = foot_roll_angle_d_gain ;
1040  set_balance_param_srv_.request.balance_param.foot_pitch_angle_p_gain = foot_pitch_angle_p_gain ;
1041  set_balance_param_srv_.request.balance_param.foot_pitch_angle_d_gain = foot_pitch_angle_d_gain ;
1042  set_balance_param_srv_.request.balance_param.foot_x_force_p_gain = foot_x_force_p_gain ;
1043  set_balance_param_srv_.request.balance_param.foot_x_force_d_gain = foot_x_force_d_gain ;
1044  set_balance_param_srv_.request.balance_param.foot_y_force_p_gain = foot_y_force_p_gain ;
1045  set_balance_param_srv_.request.balance_param.foot_y_force_d_gain = foot_y_force_d_gain ;
1046  set_balance_param_srv_.request.balance_param.foot_z_force_p_gain = foot_z_force_p_gain ;
1047  set_balance_param_srv_.request.balance_param.foot_z_force_d_gain = foot_z_force_d_gain ;
1048  set_balance_param_srv_.request.balance_param.foot_roll_torque_p_gain = foot_roll_torque_p_gain ;
1049  set_balance_param_srv_.request.balance_param.foot_roll_torque_d_gain = foot_roll_torque_d_gain ;
1050  set_balance_param_srv_.request.balance_param.foot_pitch_torque_p_gain = foot_pitch_torque_p_gain ;
1051  set_balance_param_srv_.request.balance_param.foot_pitch_torque_d_gain = foot_pitch_torque_d_gain ;
1052  set_balance_param_srv_.request.balance_param.roll_gyro_cut_off_frequency = roll_gyro_cut_off_frequency ;
1053  set_balance_param_srv_.request.balance_param.pitch_gyro_cut_off_frequency = pitch_gyro_cut_off_frequency ;
1054  set_balance_param_srv_.request.balance_param.roll_angle_cut_off_frequency = roll_angle_cut_off_frequency ;
1055  set_balance_param_srv_.request.balance_param.pitch_angle_cut_off_frequency = pitch_angle_cut_off_frequency ;
1056  set_balance_param_srv_.request.balance_param.foot_x_force_cut_off_frequency = foot_x_force_cut_off_frequency ;
1057  set_balance_param_srv_.request.balance_param.foot_y_force_cut_off_frequency = foot_y_force_cut_off_frequency ;
1058  set_balance_param_srv_.request.balance_param.foot_z_force_cut_off_frequency = foot_z_force_cut_off_frequency ;
1059  set_balance_param_srv_.request.balance_param.foot_roll_torque_cut_off_frequency = foot_roll_torque_cut_off_frequency ;
1060  set_balance_param_srv_.request.balance_param.foot_pitch_torque_cut_off_frequency = foot_pitch_torque_cut_off_frequency;
1061 
1062  return true;
1063  }
1064  catch (const std::exception& e)
1065  {
1066  ROS_ERROR("Failed to load balance param yaml file.");
1067  return false;
1068  }
1069 
1070  return true;
1071 }
1072 
1074 {
1075  // load joint feedback gain from yaml file
1076  bool result_load = loadFeedbackGainFromYaml();
1077 
1078  if (result_load == false)
1079  return false;
1080 
1081  bool service_result = false;
1082 
1083  // call service
1085  if (service_result == true)
1086  {
1087  int _result = set_joint_feedback_gain_srv_.response.result;
1088 
1089  if (_result == thormang3_walking_module_msgs::SetJointFeedBackGain::Response::NO_ERROR)
1090  {
1091  ROS_INFO("[Demo] : Succeed to set joint feedback gain");
1092  log(Info, "Set Walking Joint FeedBack gain");
1093  }
1094  else
1095  {
1096  if (_result & thormang3_walking_module_msgs::SetJointFeedBackGain::Response::NOT_ENABLED_WALKING_MODULE)
1097  ROS_ERROR("[Demo] : FRRDBACK_GAIN_ERR::NOT_ENABLED_WALKING_MODULE");
1098  if (_result & thormang3_walking_module_msgs::SetJointFeedBackGain::Response::PREV_REQUEST_IS_NOT_FINISHED)
1099  ROS_ERROR("[Demo] : FRRDBACK_GAIN_ERR::PREV_REQUEST_IS_NOT_FINISHED");
1100  }
1101  }
1102  else
1103  {
1104  ROS_ERROR("[Demo] : Failed to set Joint Feedback Gain");
1105  log(Error, "Fain to set Walking Joint FeedBack gain");
1106  }
1107  return true;
1108 }
1109 
1111 {
1112  std::string balance_yaml_path = "";
1113  balance_yaml_path = package_name_ + "/config/joint_feedback_gain.yaml";
1114 
1115  YAML::Node doc;
1116  try
1117  {
1118  // load yaml
1119  doc = YAML::LoadFile(balance_yaml_path.c_str());
1120 
1121  set_joint_feedback_gain_srv_.request.updating_duration = 2.0;
1122  set_joint_feedback_gain_srv_.request.feedback_gain.r_leg_hip_y_p_gain = doc["r_leg_hip_y_p_gain"].as<double>();
1123  set_joint_feedback_gain_srv_.request.feedback_gain.r_leg_hip_y_d_gain = doc["r_leg_hip_y_d_gain"].as<double>();
1124  set_joint_feedback_gain_srv_.request.feedback_gain.r_leg_hip_r_p_gain = doc["r_leg_hip_r_p_gain"].as<double>();
1125  set_joint_feedback_gain_srv_.request.feedback_gain.r_leg_hip_r_d_gain = doc["r_leg_hip_r_d_gain"].as<double>();
1126  set_joint_feedback_gain_srv_.request.feedback_gain.r_leg_hip_p_p_gain = doc["r_leg_hip_p_p_gain"].as<double>();
1127  set_joint_feedback_gain_srv_.request.feedback_gain.r_leg_hip_p_d_gain = doc["r_leg_hip_p_d_gain"].as<double>();
1128  set_joint_feedback_gain_srv_.request.feedback_gain.r_leg_kn_p_p_gain = doc["r_leg_kn_p_p_gain"].as<double>();
1129  set_joint_feedback_gain_srv_.request.feedback_gain.r_leg_kn_p_d_gain = doc["r_leg_kn_p_d_gain"].as<double>();
1130  set_joint_feedback_gain_srv_.request.feedback_gain.r_leg_an_p_p_gain = doc["r_leg_an_p_p_gain"].as<double>();
1131  set_joint_feedback_gain_srv_.request.feedback_gain.r_leg_an_p_d_gain = doc["r_leg_an_p_d_gain"].as<double>();
1132  set_joint_feedback_gain_srv_.request.feedback_gain.r_leg_an_r_p_gain = doc["r_leg_an_r_p_gain"].as<double>();
1133  set_joint_feedback_gain_srv_.request.feedback_gain.r_leg_an_r_d_gain = doc["r_leg_an_r_d_gain"].as<double>();
1134 
1135  set_joint_feedback_gain_srv_.request.feedback_gain.l_leg_hip_y_p_gain = doc["l_leg_hip_y_p_gain"].as<double>();
1136  set_joint_feedback_gain_srv_.request.feedback_gain.l_leg_hip_y_d_gain = doc["l_leg_hip_y_d_gain"].as<double>();
1137  set_joint_feedback_gain_srv_.request.feedback_gain.l_leg_hip_r_p_gain = doc["l_leg_hip_r_p_gain"].as<double>();
1138  set_joint_feedback_gain_srv_.request.feedback_gain.l_leg_hip_r_d_gain = doc["l_leg_hip_r_d_gain"].as<double>();
1139  set_joint_feedback_gain_srv_.request.feedback_gain.l_leg_hip_p_p_gain = doc["l_leg_hip_p_p_gain"].as<double>();
1140  set_joint_feedback_gain_srv_.request.feedback_gain.l_leg_hip_p_d_gain = doc["l_leg_hip_p_d_gain"].as<double>();
1141  set_joint_feedback_gain_srv_.request.feedback_gain.l_leg_kn_p_p_gain = doc["l_leg_kn_p_p_gain"].as<double>();
1142  set_joint_feedback_gain_srv_.request.feedback_gain.l_leg_kn_p_d_gain = doc["l_leg_kn_p_d_gain"].as<double>();
1143  set_joint_feedback_gain_srv_.request.feedback_gain.l_leg_an_p_p_gain = doc["l_leg_an_p_p_gain"].as<double>();
1144  set_joint_feedback_gain_srv_.request.feedback_gain.l_leg_an_p_d_gain = doc["l_leg_an_p_d_gain"].as<double>();
1145  set_joint_feedback_gain_srv_.request.feedback_gain.l_leg_an_r_p_gain = doc["l_leg_an_r_p_gain"].as<double>();
1146  set_joint_feedback_gain_srv_.request.feedback_gain.l_leg_an_r_d_gain = doc["l_leg_an_r_d_gain"].as<double>();
1147  }
1148  catch (const std::exception& e)
1149  {
1150  ROS_ERROR("Failed to load joint feedback gain yaml file.");
1151  return false;
1152  }
1153 
1154  return true;
1155 }
1156 
1158 {
1159  // load param from yaml file
1160  bool result_load = loadBalanceParameterFromYaml();
1161 
1162  if (result_load == false)
1163  return;
1164 
1166 
1167  log(Info, "Turn On Walking Balance");
1168 }
1169 
1171 {
1172  // load param from yaml file
1173  bool result_load = loadBalanceParameterFromYaml();
1174 
1175  if (result_load == false)
1176  return;
1177 
1178  set_balance_param_srv_.request.updating_duration = 2.0;
1179  set_balance_param_srv_.request.balance_param.foot_roll_gyro_p_gain = 0.0;
1180  set_balance_param_srv_.request.balance_param.foot_roll_gyro_d_gain = 0.0;
1181  set_balance_param_srv_.request.balance_param.foot_pitch_gyro_p_gain = 0.0;
1182  set_balance_param_srv_.request.balance_param.foot_pitch_gyro_d_gain = 0.0;
1183  set_balance_param_srv_.request.balance_param.foot_roll_angle_p_gain = 0.0;
1184  set_balance_param_srv_.request.balance_param.foot_roll_angle_d_gain = 0.0;
1185  set_balance_param_srv_.request.balance_param.foot_pitch_angle_p_gain = 0.0;
1186  set_balance_param_srv_.request.balance_param.foot_pitch_angle_d_gain = 0.0;
1187  set_balance_param_srv_.request.balance_param.foot_x_force_p_gain = 0.0;
1188  set_balance_param_srv_.request.balance_param.foot_x_force_d_gain = 0.0;
1189  set_balance_param_srv_.request.balance_param.foot_y_force_p_gain = 0.0;
1190  set_balance_param_srv_.request.balance_param.foot_y_force_d_gain = 0.0;
1191  set_balance_param_srv_.request.balance_param.foot_z_force_p_gain = 0.0;
1192  set_balance_param_srv_.request.balance_param.foot_z_force_d_gain = 0.0;
1193  set_balance_param_srv_.request.balance_param.foot_roll_torque_p_gain = 0.0;
1194  set_balance_param_srv_.request.balance_param.foot_roll_torque_d_gain = 0.0;
1195  set_balance_param_srv_.request.balance_param.foot_pitch_torque_p_gain = 0.0;
1196  set_balance_param_srv_.request.balance_param.foot_pitch_torque_d_gain = 0.0;
1197 
1199 
1200  log(Info, "Turn Off Walking Balance");
1201 }
1202 
1203 // Motion
1204 void QNodeThor3::playMotion(int motion_index, bool to_action_script)
1205 {
1206  if (motion_table_.find(motion_index) == motion_table_.end())
1207  {
1208  log(Error, "Motion index is not valid.");
1209  return;
1210  }
1211 
1212  std::stringstream log_stream;
1213  switch (motion_index)
1214  {
1215  case -2:
1216  log_stream << "BRAKE Motion";
1217  break;
1218 
1219  case -1:
1220  log_stream << "STOP Motion";
1221  break;
1222 
1223  default:
1224  std::string motion_name = motion_table_[motion_index];
1225  log_stream << "Play Motion : [" << motion_index << "] " << motion_name;
1226  }
1227 
1228  // publish motion index
1229  std_msgs::Int32 motion_msg;
1230  motion_msg.data = motion_index;
1231 
1232  if (to_action_script == true)
1233  motion_index_pub_.publish(motion_msg);
1234  else
1235  motion_page_pub_.publish(motion_msg);
1236 
1237  log(Info, log_stream.str());
1238 }
1239 
1240 void QNodeThor3::poseCallback(const geometry_msgs::Pose::ConstPtr &msg)
1241 {
1242  switch (current_control_ui_)
1243  {
1244  case WALKING_UI:
1245  {
1246  pose_from_ui_ = *msg;
1247  log(Info, "Get Pose For Step");
1248  break;
1249  }
1250 
1251  case MANIPULATION_UI:
1252  {
1253  double z_offset = 0.723;
1254  Q_EMIT updateCurrPos(msg->position.x, msg->position.y, msg->position.z + z_offset);
1255  Q_EMIT updateCurrOri(msg->orientation.x, msg->orientation.y, msg->orientation.z, msg->orientation.w);
1256  log(Info, "Get Pose For IK");
1257  break;
1258  }
1259 
1260  default:
1261  break;
1262  }
1263 }
1264 
1265 // demo
1266 void QNodeThor3::pointStampedCallback(const geometry_msgs::PointStamped::ConstPtr &msg)
1267 {
1268  ROS_INFO("get position from rviz");
1269 
1270  frame_id_ = msg->header.frame_id;
1271 
1272  // update point ui
1273  Q_EMIT updateDemoPoint(msg->point);
1274 }
1275 
1276 void QNodeThor3::interactiveMarkerFeedback(const visualization_msgs::InteractiveMarkerFeedbackConstPtr &feedback)
1277 {
1278  // event
1279  switch (feedback->event_type)
1280  {
1281  case visualization_msgs::InteractiveMarkerFeedback::BUTTON_CLICK:
1282  break;
1283 
1284  case visualization_msgs::InteractiveMarkerFeedback::MENU_SELECT:
1285  break;
1286 
1287  case visualization_msgs::InteractiveMarkerFeedback::POSE_UPDATE:
1288  {
1289  current_pose_ = feedback->pose;
1290 
1291  // update pose ui
1292  Q_EMIT updateDemoPose(feedback->pose);
1293 
1294  break;
1295  }
1296  case visualization_msgs::InteractiveMarkerFeedback::MOUSE_DOWN:
1297  break;
1298 
1299  case visualization_msgs::InteractiveMarkerFeedback::MOUSE_UP:
1300  break;
1301 
1302  default:
1303  break;
1304  }
1305 
1306  interactive_marker_server_->applyChanges();
1307 }
1308 
1309 void QNodeThor3::makeInteractiveMarker(const geometry_msgs::Pose &marker_pose)
1310 {
1311  if (frame_id_ == "")
1312  {
1313  ROS_ERROR("No frame id!!!");
1314  // return;
1315 
1316  frame_id_ = "pelvis_link";
1317  }
1318 
1320  "Make Interactive Marker! - " << marker_pose.position.x << ", " << marker_pose.position.y << ", " << marker_pose.position.z << " [" << marker_pose.orientation.x << ", " << marker_pose.orientation.y << ", " << marker_pose.orientation.z << " | " << marker_pose.orientation.w << "]");
1321 
1322  interactive_marker_server_->clear();
1323 
1324  visualization_msgs::InteractiveMarker interactive_marker;
1325  interactive_marker.pose = marker_pose; // set pose
1326 
1327  // Visualize Interactive Marker
1328  interactive_marker.header.frame_id = frame_id_;
1329  interactive_marker.scale = 0.3;
1330 
1331  interactive_marker.name = marker_name_; //"pose_marker";
1332  interactive_marker.description = "3D Pose Control";
1333 
1334  // ----- center marker
1335  visualization_msgs::InteractiveMarkerControl center_marker_control;
1336 
1337  center_marker_control.always_visible = true;
1338  center_marker_control.interaction_mode = visualization_msgs::InteractiveMarkerControl::NONE;
1339 
1340  visualization_msgs::Marker marker;
1341 
1342  marker.type = visualization_msgs::Marker::CUBE;
1343 
1344  // center cube
1345  marker.scale.x = 0.03;
1346  marker.scale.y = 0.03;
1347  marker.scale.z = 0.03;
1348 
1349  marker.color.r = 1.0;
1350  marker.color.g = 0.5;
1351  marker.color.b = 0.5;
1352  marker.color.a = 1.0;
1353 
1354  center_marker_control.markers.push_back(marker);
1355 
1356  // axis x
1357  marker.pose.position.x = 0.05;
1358  marker.pose.position.y = 0.0;
1359  marker.pose.position.z = 0.0;
1360 
1361  marker.scale.x = 0.1;
1362  marker.scale.y = 0.01;
1363  marker.scale.z = 0.01;
1364 
1365  marker.color.r = 1.0;
1366  marker.color.g = 0.0;
1367  marker.color.b = 0.0;
1368  marker.color.a = 1.0;
1369 
1370  center_marker_control.markers.push_back(marker);
1371 
1372  // axis y
1373  marker.pose.position.x = 0.0;
1374  marker.pose.position.y = 0.05;
1375  marker.pose.position.z = 0.0;
1376 
1377  marker.scale.x = 0.01;
1378  marker.scale.y = 0.1;
1379  marker.scale.z = 0.01;
1380 
1381  marker.color.r = 0.0;
1382  marker.color.g = 1.0;
1383  marker.color.b = 0.0;
1384  marker.color.a = 1.0;
1385 
1386  center_marker_control.markers.push_back(marker);
1387 
1388  // axis z
1389  marker.pose.position.x = 0.0;
1390  marker.pose.position.y = 0.0;
1391  marker.pose.position.z = 0.05;
1392 
1393  marker.scale.x = 0.01;
1394  marker.scale.y = 0.01;
1395  marker.scale.z = 0.1;
1396 
1397  marker.color.r = 0.0;
1398  marker.color.g = 0.0;
1399  marker.color.b = 1.0;
1400  marker.color.a = 1.0;
1401 
1402  center_marker_control.markers.push_back(marker);
1403 
1404  interactive_marker.controls.push_back(center_marker_control);
1405 
1406  // ----- controller
1407  visualization_msgs::InteractiveMarkerControl interactive_control;
1408 
1409  // move and rotate along axis x : default
1410  interactive_control.orientation.x = 1;
1411  interactive_control.orientation.y = 0;
1412  interactive_control.orientation.z = 0;
1413  interactive_control.orientation.w = 1;
1414  interactive_control.name = "rotate";
1415  interactive_control.interaction_mode = visualization_msgs::InteractiveMarkerControl::ROTATE_AXIS;
1416  interactive_marker.controls.push_back(interactive_control);
1417  interactive_control.name = "move";
1418  interactive_control.interaction_mode = visualization_msgs::InteractiveMarkerControl::MOVE_AXIS;
1419  interactive_marker.controls.push_back(interactive_control);
1420 
1421  // move and rotate along axis y
1422  interactive_control.orientation.x = 0;
1423  interactive_control.orientation.y = 1;
1424  interactive_control.orientation.z = 0;
1425  interactive_control.orientation.w = 1;
1426  interactive_control.name = "rotate";
1427  interactive_control.interaction_mode = visualization_msgs::InteractiveMarkerControl::ROTATE_AXIS;
1428  interactive_marker.controls.push_back(interactive_control);
1429  interactive_control.name = "move";
1430  interactive_control.interaction_mode = visualization_msgs::InteractiveMarkerControl::MOVE_AXIS;
1431  interactive_marker.controls.push_back(interactive_control);
1432 
1433  // move and rotate along axis z
1434  interactive_control.orientation.x = 0;
1435  interactive_control.orientation.y = 0;
1436  interactive_control.orientation.z = 1;
1437  interactive_control.orientation.w = 1;
1438  interactive_control.name = "rotate";
1439  interactive_control.interaction_mode = visualization_msgs::InteractiveMarkerControl::ROTATE_AXIS;
1440  interactive_marker.controls.push_back(interactive_control);
1441  interactive_control.name = "move";
1442  interactive_control.interaction_mode = visualization_msgs::InteractiveMarkerControl::MOVE_AXIS;
1443  interactive_marker.controls.push_back(interactive_control);
1444 
1445  interactive_marker_server_->insert(interactive_marker);
1446  interactive_marker_server_->setCallback(interactive_marker.name,
1447  boost::bind(&QNodeThor3::interactiveMarkerFeedback, this, _1));
1448 
1449  interactive_marker_server_->applyChanges();
1450 }
1451 
1452 void QNodeThor3::updateInteractiveMarker(const geometry_msgs::Pose &pose)
1453 {
1454  ROS_INFO("Update Interactive Marker Pose");
1455 
1456  visualization_msgs::InteractiveMarker interactive_marker;
1457  bool result_getting = false;
1458 
1459  result_getting = interactive_marker_server_->get(marker_name_, interactive_marker);
1460  if (result_getting == false)
1461  {
1462  ROS_ERROR("No Interactive marker to set pose");
1463  return;
1464  }
1465 
1466  interactive_marker_server_->setPose(interactive_marker.name, pose);
1467  interactive_marker_server_->applyChanges();
1468 }
1469 
1471 {
1472  ROS_INFO("Get Interactive Marker Pose");
1473 
1474  visualization_msgs::InteractiveMarker _interactive_marker;
1475  if (!(interactive_marker_server_->get(marker_name_, _interactive_marker)))
1476  {
1477  ROS_ERROR("No Interactive marker to get pose");
1478  return;
1479  }
1480 
1481  // update pose ui
1482  Q_EMIT updateDemoPose(_interactive_marker.pose);
1483 
1485 }
1486 
1488 {
1489  ROS_INFO("Clear Interactive Marker");
1490 
1491  // clear and apply
1492  interactive_marker_server_->clear();
1493  interactive_marker_server_->applyChanges();
1494 }
1495 
1496 void QNodeThor3::kickDemo(const std::string &kick_foot)
1497 {
1498  if (kick_foot == "right kick")
1499  {
1500  bool result = loadBalanceParameterFromYaml();
1501  if (result == false)
1502  return;
1503 
1504  double old_hip_swap = set_balance_param_srv_.request.balance_param.hip_roll_swap_angle_rad;
1505  set_balance_param_srv_.request.balance_param.hip_roll_swap_angle_rad = 0;
1506  set_balance_param_srv_.request.balance_param.cob_x_offset_m -= 0.03;
1507  set_balance_param_srv_.request.balance_param.cob_y_offset_m += 0.02;
1509 
1510  thormang3_foot_step_generator::FootStepCommand msg;
1511  msg.command = kick_foot;
1512  setWalkingCommand(msg);
1513 
1514  // wait for kick
1515  usleep(7.2 * 1000 * 1000);
1516 
1517  set_balance_param_srv_.request.balance_param.hip_roll_swap_angle_rad = old_hip_swap;
1518  set_balance_param_srv_.request.balance_param.cob_x_offset_m += 0.03;
1519  set_balance_param_srv_.request.balance_param.cob_y_offset_m -= 0.02;
1521 
1522  // wait for recovering balance
1523  usleep(2 * 1000 * 1000);
1524  }
1525  else if (kick_foot == "left kick")
1526  {
1527  bool result = loadBalanceParameterFromYaml();
1528  if (result == false)
1529  return;
1530 
1531  double old_hip_swap = set_balance_param_srv_.request.balance_param.hip_roll_swap_angle_rad;
1532  set_balance_param_srv_.request.balance_param.cob_x_offset_m -= 0.03;
1533  set_balance_param_srv_.request.balance_param.cob_y_offset_m -= 0.02;
1535 
1536  thormang3_foot_step_generator::FootStepCommand msg;
1537  msg.command = kick_foot;
1538  setWalkingCommand(msg);
1539 
1540  // wait for kick
1541  usleep(7.2 * 1000 * 1000);
1542 
1543  set_balance_param_srv_.request.balance_param.hip_roll_swap_angle_rad = old_hip_swap;
1544  set_balance_param_srv_.request.balance_param.cob_x_offset_m += 0.03;
1545  set_balance_param_srv_.request.balance_param.cob_y_offset_m += 0.02;
1547 
1548  // wait for recovering balance
1549  usleep(2 * 1000 * 1000);
1550  }
1551 }
1552 
1553 // LOG
1554 void QNodeThor3::statusMsgCallback(const robotis_controller_msgs::StatusMsg::ConstPtr &msg)
1555 {
1556  log((LogLevel) msg->type, msg->status_msg, msg->module_name);
1557 }
1558 
1559 void QNodeThor3::log(const LogLevel &level, const std::string &msg, std::string sender)
1560 {
1561  logging_model_.insertRows(logging_model_.rowCount(), 1);
1562  std::stringstream logging_model_msg;
1563 
1564  ros::Duration duration_time = ros::Time::now() - start_time_;
1565  int current_time = duration_time.sec;
1566  int min_time = 0, sec_time = 0;
1567  min_time = (int) (current_time / 60);
1568  sec_time = (int) (current_time % 60);
1569 
1570  std::stringstream min_str, sec_str;
1571  if (min_time < 10)
1572  min_str << "0";
1573  if (sec_time < 10)
1574  sec_str << "0";
1575  min_str << min_time;
1576  sec_str << sec_time;
1577 
1578  std::stringstream stream_sender;
1579  stream_sender << "[" << sender << "] ";
1580 
1581  switch (level)
1582  {
1583  case (Debug):
1584  {
1585  ROS_DEBUG_STREAM(msg);
1586  logging_model_msg << "[DEBUG] [" << min_str.str() << ":" << sec_str.str() << "]: " << stream_sender.str() << msg;
1587  break;
1588  }
1589  case (Info):
1590  {
1591  ROS_INFO_STREAM(msg);
1592  logging_model_msg << "[INFO] [" << min_str.str() << ":" << sec_str.str() << "]: " << stream_sender.str() << msg;
1593  break;
1594  }
1595  case (Warn):
1596  {
1597  ROS_WARN_STREAM(msg);
1598  logging_model_msg << "[WARN] [" << min_str.str() << ":" << sec_str.str() << "]: " << stream_sender.str() << msg;
1599  break;
1600  }
1601  case (Error):
1602  {
1603  ROS_ERROR_STREAM(msg);
1604  logging_model_msg << "<ERROR> [" << min_str.str() << ":" << sec_str.str() << "]: " << stream_sender.str() << msg;
1605  break;
1606  }
1607  case (Fatal):
1608  {
1609  ROS_FATAL_STREAM(msg);
1610  logging_model_msg << "[FATAL] [" << min_str.str() << ":" << sec_str.str() << "]: " << stream_sender.str() << msg;
1611  break;
1612  }
1613  }
1614 
1615  QVariant new_row(QString(logging_model_msg.str().c_str()));
1616  logging_model_.setData(logging_model_.index(logging_model_.rowCount() - 1), new_row);
1617 
1618  Q_EMIT loggingUpdated(); // used to readjust the scrollbar
1619 }
1620 
1622 {
1623  if (logging_model_.rowCount() == 0)
1624  return;
1625 
1626  logging_model_.removeRows(0, logging_model_.rowCount());
1627 }
1628 
1629 } // namespace thormang3_demo
bool getIDJointNameFromIndex(const int &index, int &id, std::string &joint_name)
Definition: qnode.cpp:288
void statusMsgCallback(const robotis_controller_msgs::StatusMsg::ConstPtr &msg)
Definition: qnode.cpp:1554
ServiceClient serviceClient(const std::string &service_name, bool persistent=false, const M_string &header_values=M_string())
void sendInitPoseMsg(std_msgs::String msg)
Definition: qnode.cpp:560
#define ROS_DEBUG_STREAM_COND(cond, args)
std::string marker_name_
Definition: qnode.hpp:231
ros::Subscriber pose_sub_
Definition: qnode.hpp:249
ROSCPP_DECL bool check()
void pointStampedCallback(const geometry_msgs::PointStamped::ConstPtr &msg)
Definition: qnode.cpp:1266
ros::Publisher motion_page_pub_
Definition: qnode.hpp:279
ros::Publisher set_walking_footsteps_pub_
Definition: qnode.hpp:271
ros::Publisher marker_pub_
Definition: qnode.hpp:248
void parseMotionMapFromYaml(const std::string &path)
Definition: qnode.cpp:232
ROSCPP_DECL void start()
void poseCallback(const geometry_msgs::Pose::ConstPtr &msg)
Definition: qnode.cpp:1240
void publish(const boost::shared_ptr< M > &message) const
void visualizePreviewFootsteps(bool clear)
Definition: qnode.cpp:869
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())
ros::Publisher init_ft_pub_
Definition: qnode.hpp:239
void sendDestJointMsg(thormang3_manipulation_module_msgs::JointPose msg)
Definition: qnode.cpp:567
ros::Subscriber current_module_control_sub_
Definition: qnode.hpp:245
ros::ServiceClient set_balance_param_client_
Definition: qnode.hpp:268
start
QNodeThor3(int argc, char **argv)
Definition: qnode.cpp:36
void setWalkingBalanceParam(const double &gyro_gain, const double &ft_gain_ratio, const double &imu_time_const, const double &ft_time_const)
Definition: qnode.cpp:714
ros::Publisher set_head_joint_angle_pub_
Definition: qnode.hpp:253
ROSCPP_DECL void init(int &argc, char **argv, const std::string &name, uint32_t options=0)
bool call(MReq &req, MRes &res)
std::vector< int > preview_foot_types_
Definition: qnode.hpp:275
ros::Publisher module_control_pub_
Definition: qnode.hpp:240
bool isUsingModule(const std::string &module_name)
Definition: qnode.cpp:349
void getKinematicsPose(std::string group_name)
Definition: qnode.cpp:638
void enableControlModule(const std::string &mode)
Definition: qnode.cpp:396
thormang3_walking_module_msgs::SetBalanceParam set_balance_param_srv_
Definition: qnode.hpp:235
void setWalkingBalance(bool on_command)
Definition: qnode.cpp:706
ros::Subscriber current_joint_states_sub_
Definition: qnode.hpp:254
ros::Subscriber init_ft_foot_sub_
Definition: qnode.hpp:243
bool loadBalanceParameterFromYaml()
Definition: qnode.cpp:988
void kickDemo(const std::string &kick_foot)
Definition: qnode.cpp:1496
void playMotion(int motion_index, bool to_action_script=true)
Definition: qnode.cpp:1204
void sendGripperPosition(sensor_msgs::JointState msg)
Definition: qnode.cpp:598
QStringListModel logging_model_
Definition: qnode.hpp:282
void refreshCurrentJointControlCallback(const robotis_controller_msgs::JointCtrlModule::ConstPtr &msg)
Definition: qnode.cpp:464
void updateCurrOri(double x, double y, double z, double w)
ros::Subscriber rviz_clicked_point_sub_
Definition: qnode.hpp:229
void updatePresentJointControlModules(std::vector< int > mode)
static const double RADIAN2DEGREE
Definition: qnode.hpp:204
#define ROS_FATAL_STREAM(args)
bool getJointNameFromID(const int &id, std::string &joint_name)
Definition: qnode.cpp:262
ros::ServiceClient get_module_control_client_
Definition: qnode.hpp:246
std::map< std::string, int > mode_index_table_
Definition: qnode.hpp:286
void interactiveMarkerFeedback(const visualization_msgs::InteractiveMarkerFeedbackConstPtr &feedback)
Definition: qnode.cpp:1276
#define ROS_INFO(...)
thormang3_walking_module_msgs::SetJointFeedBackGain set_joint_feedback_gain_srv_
Definition: qnode.hpp:236
void setCurrentControlUI(int mode)
Definition: qnode.cpp:359
bool param(const std::string &param_name, T &param_val, const T &default_val) const
ros::Publisher motion_index_pub_
Definition: qnode.hpp:278
ros::Publisher send_des_joint_msg_pub_
Definition: qnode.hpp:258
ros::ServiceClient get_joint_pose_client_
Definition: qnode.hpp:261
ros::Publisher module_control_preset_pub_
Definition: qnode.hpp:241
void updateDemoPose(const geometry_msgs::Pose pose)
void parseJointNameFromYaml(const std::string &path)
Definition: qnode.cpp:173
std::vector< geometry_msgs::Pose2D > preview_foot_steps_
Definition: qnode.hpp:274
x
ROSCPP_DECL bool ok()
ros::Subscriber status_msg_sub_
Definition: qnode.hpp:242
std::map< int, std::string > index_mode_table_
Definition: qnode.hpp:285
geometry_msgs::Pose current_pose_
Definition: qnode.hpp:233
ros::Publisher send_gripper_pub_
Definition: qnode.hpp:264
theta
ros::Subscriber kenematics_pose_sub_
Definition: qnode.hpp:260
boost::shared_ptr< interactive_markers::InteractiveMarkerServer > interactive_marker_server_
Definition: qnode.hpp:234
Publisher advertise(const std::string &topic, uint32_t queue_size, bool latch=false)
ros::ServiceClient get_kinematics_pose_client_
Definition: qnode.hpp:262
std::string package_name_
Definition: qnode.hpp:166
std::map< int, std::string > id_joint_table_
Definition: qnode.hpp:283
ros::ServiceClient humanoid_footstep_client_
Definition: qnode.hpp:267
ros::Publisher init_pose_pub_
Definition: qnode.hpp:238
#define ROS_WARN_STREAM(args)
#define ROS_DEBUG_STREAM(args)
void updateCurrPos(double x, double y, double z)
void log(const LogLevel &level, const std::string &msg, std::string sender="Demo")
Definition: qnode.cpp:1559
void getJointPose(std::string joint_name)
Definition: qnode.cpp:604
ROSLIB_DECL std::string getPath(const std::string &package_name)
y
void pointEigenToMsg(const Eigen::Vector3d &e, geometry_msgs::Point &m)
bool sleep()
InitConstPtr init_msg
void setWalkingCommand(thormang3_foot_step_generator::FootStepCommand msg)
Definition: qnode.cpp:692
std::map< std::string, bool > using_mode_table_
Definition: qnode.hpp:287
void getKinematicsPoseCallback(const geometry_msgs::Pose::ConstPtr &msg)
Definition: qnode.cpp:684
void initFTFootCallback(const thormang3_feet_ft_module_msgs::BothWrench::ConstPtr &msg)
Definition: qnode.cpp:536
void wait(int seconds)
geometry_msgs::Pose pose_from_ui_
Definition: qnode.hpp:232
unsigned int step
void updateHeadJointStatesCallback(const sensor_msgs::JointState::ConstPtr &msg)
Definition: qnode.cpp:510
std::map< int, std::string > module_table_
Definition: qnode.hpp:163
INLINE Rall1d< T, V, S > acos(const Rall1d< T, V, S > &x)
#define ROS_INFO_STREAM(args)
void updateHeadJointsAngle(double pan, double tilt)
ROSCPP_DECL bool isStarted()
ros::Publisher send_ik_msg_pub_
Definition: qnode.hpp:259
std::string getModuleName(const int &index)
Definition: qnode.cpp:307
std::map< int, std::string > motion_table_
Definition: qnode.hpp:164
void initFTCommand(std::string command)
Definition: qnode.cpp:377
void quaternionMsgToEigen(const geometry_msgs::Quaternion &m, Eigen::Quaterniond &e)
void updateDemoPoint(const geometry_msgs::Point point)
ros::ServiceClient set_joint_feedback_gain_client_
Definition: qnode.hpp:269
ros::Publisher move_lidar_pub_
Definition: qnode.hpp:252
static Time now()
ROSCPP_DECL void shutdown()
void sendIkMsg(thormang3_manipulation_module_msgs::KinematicsPose msg)
Definition: qnode.cpp:580
INLINE Rall1d< T, V, S > cos(const Rall1d< T, V, S > &arg)
goal
#define ROS_ERROR_STREAM(args)
int getModuleIndex(const std::string &mode_name)
Definition: qnode.cpp:319
ROSCPP_DECL void spinOnce()
void makeInteractiveMarker(const geometry_msgs::Pose &marker_pose)
Definition: qnode.cpp:1309
#define ROS_ERROR(...)
ros::Publisher set_walking_balance_pub_
Definition: qnode.hpp:272
INLINE Rall1d< T, V, S > sin(const Rall1d< T, V, S > &arg)
ros::Publisher set_walking_command_pub_
Definition: qnode.hpp:270
std::map< std::string, int > joint_id_table_
Definition: qnode.hpp:284
void updateInteractiveMarker(const geometry_msgs::Pose &pose)
Definition: qnode.cpp:1452
ROSCPP_DECL void waitForShutdown()
ros::Publisher send_ini_pose_msg_pub_
Definition: qnode.hpp:257
void updateCurrJoint(double value)
bool getIDFromJointName(const std::string &joint_name, int &id)
Definition: qnode.cpp:275
void setHeadJoint(double pan, double tilt)
Definition: qnode.cpp:546


thormang3_demo
Author(s): Kayman
autogenerated on Mon Jun 10 2019 15:38:34