step_data_define.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 
18 #include <iostream>
19 #include <iomanip>
20 
21 namespace robotis_framework
22 {
23 std::string dispatchMovingFoot(int moving_foot)
24 {
25  switch (moving_foot)
26  {
27  case 1: return "LEFT_FOOT_SWING";
28  case 2: return "RIGHT_FOOT_SWING";
29  case 3: return "STANDING";
30  default: return "UNKOWN";
31  }
32 }
33 
34 std::string dispatchWalkingState(int walking_state)
35 {
36  switch (walking_state)
37  {
38  case 0: return "IN_WALKING_STARTING";
39  case 1: return "IN_WALKING";
40  case 2: return "IN_WALKING_ENDING";
41  default: return "UNKOWN";
42  }
43 }
44 
45 std::ostream& operator<<(std::ostream& out, const Pose3D& pose)
46 {
47  return out << std::fixed << std::setprecision(3) << pose.x << "/" << pose.y << "/" << pose.z << "|" << pose.roll << "/" << pose.pitch << "/" << pose.yaw;
48 }
49 
50 std::ostream& operator<<(std::ostream& out, const StepPositionData& position_data)
51 {
52  out << std::fixed << std::setprecision(3);
53  out << "[ Left] " << position_data.left_foot_pose << "\n";
54  out << "[ RIGHT] " << position_data.right_foot_pose << "\n";
55  out << "[ BODY] " << position_data.body_pose << "\n";
56  out << "[ WAIST] " << "r/p/y: " << position_data.waist_roll_angle << "/" << position_data.waist_pitch_angle << "/" << position_data.waist_yaw_angle << "\n";
57  out << "[PARAMS] " << "moving_foot: " << dispatchMovingFoot(position_data.moving_foot) << " | foot_z_swap: " << position_data.foot_z_swap << " | body_z_swap: " << position_data.body_z_swap << "\n";
58  out << "[PARAMS] " << "x_zmp_shift: " << position_data.x_zmp_shift << " | y_zmp_shift: " << position_data.y_zmp_shift << "\n";
59  out << "[PARAMS] " << "shoulder_swing_gain: " << position_data.shoulder_swing_gain << " | elbow_swing_gain: " << position_data.elbow_swing_gain;
60  return out;
61 }
62 
63 std::ostream& operator<<(std::ostream& out, const StepTimeData& time_data)
64 {
65  out << std::fixed << std::setprecision(3);
66  out << "[PARAMS] " << "walking_state: " << dispatchWalkingState(time_data.walking_state) << " | abs_step_time: " << time_data.abs_step_time << " | dsp_ratio: " << time_data.dsp_ratio << "\n";
67  out << "[ START] " << time_data.start_time_delay_ratio_x << "/" << time_data.start_time_delay_ratio_y << "/" << time_data.start_time_delay_ratio_z << "|"
68  << time_data.start_time_delay_ratio_roll << "/" << time_data.start_time_delay_ratio_pitch << "/" << time_data.start_time_delay_ratio_yaw << "\n";
69  out << "[FINISH] " << time_data.finish_time_advance_ratio_x << "/" << time_data.finish_time_advance_ratio_y << "/" << time_data.finish_time_advance_ratio_z << "|"
70  << time_data.finish_time_advance_ratio_roll << "/" << time_data.finish_time_advance_ratio_pitch << "/" << time_data.finish_time_advance_ratio_yaw;
71 }
72 
73 std::ostream& operator<<(std::ostream& out, const StepData& step_data)
74 {
75  out << "------- StepPositionData: -------\n" << step_data.position_data << "\n";
76  out << "--------- StepTimeData: ---------\n" << step_data.time_data;
77  return out;
78 }
79 }
std::string dispatchWalkingState(int walking_state)
StepPositionData position_data
std::string dispatchMovingFoot(int moving_foot)
std::ostream & operator<<(std::ostream &out, const Pose3D &pose)


robotis_math
Author(s): SCH , Kayman , Jay Song
autogenerated on Fri Jul 17 2020 03:17:50