NimbRo ROS Soccer Package
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
gait_abstract_pose.h
1 // Gait utility class that provides abstract pose representation functionality
2 // File: gait_abstract_pose.h
3 // Author: Philipp Allgeuer <pallgeuer@ais.uni-bonn.de>
4 
5 // Ensure header is only included once
6 #ifndef GAIT_ABSTRACT_POSE_H
7 #define GAIT_ABSTRACT_POSE_H
8 
9 // Includes
10 #include <gait/util/gait_common_pose.h>
11 
12 // Gait namespace
13 namespace gait
14 {
15  // Class forward declarations
16  class JointPose;
17  class JointLegPose;
18  class JointArmPose;
19  class InversePose;
20  class InverseLegPose;
21  class InverseArmPose;
22  class AbstractPose;
23  class AbstractLegPose;
24  class AbstractArmPose;
25 
36  {
37  //
38  // Constructor
39  //
40 
42  explicit AbstractLegPose(bool left = true) { reset(left); }
43 
45  inline void reset(bool left = true)
46  {
47  cld.reset(left);
48  setPose(0.0, 0.0, 0.0, 0.0);
49  setFootPose(0.0, 0.0);
50  }
51 
52  //
53  // Set functions
54  //
55 
57  inline void setPose(double ext, double angX, double angY, double angZ)
58  {
59  extension = ext;
60  angleX = angX;
61  angleY = angY;
62  angleZ = angZ;
63  }
64 
66  inline void setPoseMirrored(double ext, double angX, double angY, double angZ)
67  {
68  extension = ext;
69  angleX = (cld.isLeft ? angX : -angX);
70  angleY = angY;
71  angleZ = (cld.isLeft ? angZ : -angZ);
72  }
73 
75  inline void setFootPose(double footAngX, double footAngY)
76  {
77  footAngleX = footAngX;
78  footAngleY = footAngY;
79  }
80 
82  inline void setFootPoseMirrored(double footAngX, double footAngY)
83  {
84  footAngleX = (cld.isLeft ? footAngX : -footAngX);
85  footAngleY = footAngY;
86  }
87 
89  inline void setLinkLength(double length)
90  {
91  cld.linkLength = length;
92  }
93 
94  //
95  // Pose conversion functions
96  //
97 
99  void setFromJointPose(const JointLegPose& pose);
100 
102  void setFromInversePose(const InverseLegPose& pose);
103 
105  void fromJointAngles(double hipYaw, double hipRoll, double hipPitch, double kneePitch, double anklePitch, double ankleRoll);
106 
108  void getJointAngles(double& hipYaw, double& hipRoll, double& hipPitch, double& kneePitch, double& anklePitch, double& ankleRoll) const;
109 
110  //
111  // Data members
112  //
113 
114  // Common leg data
116 
117  // Leg pose
118  double extension;
119  double angleX;
120  double angleY;
121  double angleZ;
122 
123  // Foot pose
124  double footAngleX;
125  double footAngleY;
126  };
127 
137  {
138  //
139  // Constructor
140  //
141 
143  explicit AbstractArmPose(bool left = true) { reset(left); }
144 
146  inline void reset(bool left = true)
147  {
148  cad.reset(left);
149  setPose(0.0, 0.0, 0.0);
150  }
151 
152  //
153  // Set functions
154  //
155 
157  inline void setPose(double ext, double angX, double angY)
158  {
159  extension = ext;
160  angleX = angX;
161  angleY = angY;
162  }
163 
165  inline void setPoseMirrored(double ext, double angX, double angY)
166  {
167  extension = ext;
168  angleX = (cad.isLeft ? angX : -angX);
169  angleY = angY;
170  }
171 
173  inline void setLinkLength(double length)
174  {
175  cad.linkLength = length;
176  }
177 
178  //
179  // Pose conversion functions
180  //
181 
183  void setFromJointPose(const JointArmPose& pose);
184 
186  void setFromInversePose(const InverseArmPose& pose);
187 
189  void fromJointAngles(double shoulderPitch, double shoulderRoll, double elbowPitch);
190 
192  void getJointAngles(double& shoulderPitch, double& shoulderRoll, double& elbowPitch) const;
193 
194  //
195  // Data members
196  //
197 
198  // Common arm data
200 
201  // Arm pose
202  double extension;
203  double angleX;
204  double angleY;
205  };
206 
215  {
216  //
217  // Constructor
218  //
219 
222 
224  inline void reset()
225  {
226  leftLeg.reset(true);
227  rightLeg.reset(false);
228  leftArm.reset(true);
229  rightArm.reset(false);
230  }
231 
232  //
233  // Set functions
234  //
235 
237  inline void setLinkLengths(double legLinkLength, double armLinkLength)
238  {
239  leftLeg.cld.setLinkLength(legLinkLength);
240  rightLeg.cld.setLinkLength(legLinkLength);
241  leftArm.cad.setLinkLength(armLinkLength);
242  rightArm.cad.setLinkLength(armLinkLength);
243  }
244 
245  //
246  // Pose conversion functions
247  //
248 
250  void setFromJointPose(const JointPose& pose);
251 
253  void setFromInversePose(const InversePose& pose);
254 
256  inline void setLegsFromJointPose(const JointLegPose& left, const JointLegPose& right)
257  {
259  rightLeg.setFromJointPose(right);
260  }
261 
263  inline void setLegsFromInversePose(const InverseLegPose& left, const InverseLegPose& right)
264  {
267  }
268 
270  inline void setArmsFromJointPose(const JointArmPose& left, const JointArmPose& right)
271  {
273  rightArm.setFromJointPose(right);
274  }
275 
277  inline void setArmsFromInversePose(const InverseArmPose& left, const InverseArmPose& right)
278  {
281  }
282 
283  //
284  // Data members
285  //
286 
287  // Abstract limb pose structs
292  };
293 }
294 
295 #endif /* GAIT_ABSTRACT_POSE_H */
296 // EOF
void getJointAngles(double &hipYaw, double &hipRoll, double &hipPitch, double &kneePitch, double &anklePitch, double &ankleRoll) const
Calculate the joint angles corresponding to the current abstract leg pose.
Definition: gait_abstract_pose.cpp:49
void setLinkLength(double length)
Set the link length used for pose conversions.
Definition: gait_common_pose.h:178
void reset(bool left=true)
Reset function.
Definition: gait_common_pose.h:135
void setArmsFromJointPose(const JointArmPose &left, const JointArmPose &right)
Set the abstract arm poses to given joint poses.
Definition: gait_abstract_pose.h:270
AbstractLegPose leftLeg
Abstract pose of the left leg.
Definition: gait_abstract_pose.h:288
CommonLegData cld
Data that is shared by all leg pose representations.
Definition: gait_abstract_pose.h:115
void setLegsFromInversePose(const InverseLegPose &left, const InverseLegPose &right)
Set the abstract leg poses to given inverse poses.
Definition: gait_abstract_pose.h:263
Data struct that contains the information pertaining to an arm pose that should be common amongst all...
Definition: gait_common_pose.h:125
AbstractArmPose(bool left=true)
Default constructor.
Definition: gait_abstract_pose.h:143
void setFromInversePose(const InversePose &pose)
Set the abstract pose to a given inverse pose.
Definition: gait_abstract_pose.cpp:112
Data struct that encompasses the joint representation of a robot pose.
Definition: gait_joint_pose.h:242
void reset()
Reset function.
Definition: gait_abstract_pose.h:224
void setLinkLength(double length)
Set the link length used for pose conversions.
Definition: gait_abstract_pose.h:173
double angleX
Orientation angle of the leg axis about the positive x axis (2nd ZXY Euler angle) ...
Definition: gait_abstract_pose.h:119
void fromJointAngles(double hipYaw, double hipRoll, double hipPitch, double kneePitch, double anklePitch, double ankleRoll)
Set the pose of the leg to the pose defined by the given joint angles.
Definition: gait_abstract_pose.cpp:37
void setFromInversePose(const InverseArmPose &pose)
Set the abstract arm pose to a given inverse arm pose.
Definition: gait_abstract_pose.cpp:72
void setLinkLength(double length)
Set the link length used for pose conversions.
Definition: gait_abstract_pose.h:89
void setLegsFromJointPose(const JointLegPose &left, const JointLegPose &right)
Set the abstract leg poses to given joint poses.
Definition: gait_abstract_pose.h:256
Data struct that encompasses the abstract representation of an arm pose.
Definition: gait_abstract_pose.h:136
void fromJointAngles(double shoulderPitch, double shoulderRoll, double elbowPitch)
Set the pose of the arm to the pose defined by the given joint angles.
Definition: gait_abstract_pose.cpp:81
AbstractArmPose rightArm
Abstract pose of the right arm.
Definition: gait_abstract_pose.h:291
void reset(bool left=true)
Reset function.
Definition: gait_common_pose.h:30
double angleX
Orientation angle of the arm axis about the positive x axis (3rd ZYX Euler angle, angleZ is zero) ...
Definition: gait_abstract_pose.h:203
void setFromJointPose(const JointArmPose &pose)
Set the abstract arm pose to a given joint arm pose.
Definition: gait_abstract_pose.cpp:65
void setFootPoseMirrored(double footAngX, double footAngY)
Set the abstract foot pose in mirror mode (directly set the abstract foot pose parameters if this is ...
Definition: gait_abstract_pose.h:82
double footAngleX
Global orientation angle of the foot about the positive x axis (more precisely, if all non-roll servo...
Definition: gait_abstract_pose.h:124
double linkLength
The assumed (equal) length of the upper and lower leg links (used for joint pose conversions) ...
Definition: gait_common_pose.h:114
double linkLength
The assumed (equal) length of the upper and lower arm links (used for joint pose conversions) ...
Definition: gait_common_pose.h:197
CommonArmData cad
Data that is shared by all arm pose representations.
Definition: gait_abstract_pose.h:199
void setFromInversePose(const InverseLegPose &pose)
Set the abstract leg pose to a given inverse leg pose.
Definition: gait_abstract_pose.cpp:28
void setLinkLengths(double legLinkLength, double armLinkLength)
Set the arm and leg link lengths used for pose conversions.
Definition: gait_abstract_pose.h:237
Data struct that encompasses the inverse representation of an arm pose.
Definition: gait_inverse_pose.h:118
AbstractLegPose rightLeg
Abstract pose of the right leg.
Definition: gait_abstract_pose.h:289
double extension
Extension of the arm (in the range [0,1], 0 = Fully extended, 1 = Fully contracted) ...
Definition: gait_abstract_pose.h:202
Data struct that encompasses the joint representation of an arm pose.
Definition: gait_joint_pose.h:147
void getJointAngles(double &shoulderPitch, double &shoulderRoll, double &elbowPitch) const
Calculate the joint angles corresponding to the current abstract arm pose.
Definition: gait_abstract_pose.cpp:90
double angleY
Orientation angle of the arm axis about the positive y axis (2nd ZYX Euler angle, angleZ is zero) ...
Definition: gait_abstract_pose.h:204
void setPoseMirrored(double ext, double angX, double angY)
Set the abstract pose in mirror mode (directly set the abstract pose parameters if this is the left a...
Definition: gait_abstract_pose.h:165
void setFromJointPose(const JointPose &pose)
Set the abstract pose to a given joint pose.
Definition: gait_abstract_pose.cpp:103
void reset(bool left=true)
Reset function.
Definition: gait_abstract_pose.h:45
void setFootPose(double footAngX, double footAngY)
Set the abstract foot pose (directly set the abstract foot pose parameters)
Definition: gait_abstract_pose.h:75
double footAngleY
Global orientation angle of the foot about the positive y axis (more precisely, if all non-pitch serv...
Definition: gait_abstract_pose.h:125
double angleY
Orientation angle of the leg axis about the positive y axis (3rd ZXY Euler angle) ...
Definition: gait_abstract_pose.h:120
Data struct that encompasses the inverse representation of a robot pose.
Definition: gait_inverse_pose.h:188
void setPose(double ext, double angX, double angY)
Set the abstract pose (directly set the abstract pose parameters)
Definition: gait_abstract_pose.h:157
void setFromJointPose(const JointLegPose &pose)
Set the abstract leg pose to a given joint leg pose.
Definition: gait_abstract_pose.cpp:21
Data struct that encompasses the abstract representation of a robot pose.
Definition: gait_abstract_pose.h:214
AbstractArmPose leftArm
Abstract pose of the left arm.
Definition: gait_abstract_pose.h:290
bool isLeft
Boolean flag that is true if this is a left leg and false if this is a right leg. ...
Definition: gait_common_pose.h:110
bool isLeft
Boolean flag that is true if this is a left arm and false if this is a right arm. ...
Definition: gait_common_pose.h:193
Data struct that encompasses the abstract representation of a leg pose.
Definition: gait_abstract_pose.h:35
AbstractPose()
Default constructor.
Definition: gait_abstract_pose.h:221
Data struct that encompasses the joint representation of a leg pose.
Definition: gait_joint_pose.h:36
Data struct that encompasses the inverse representation of a leg pose.
Definition: gait_inverse_pose.h:36
double angleZ
Orientation angle of the leg axis about the positive z axis (1st ZXY Euler angle) ...
Definition: gait_abstract_pose.h:121
double extension
Extension of the leg (in the range [0,1], 0 = Fully extended, 1 = Fully contracted) ...
Definition: gait_abstract_pose.h:118
void reset(bool left=true)
Reset function.
Definition: gait_abstract_pose.h:146
void setPoseMirrored(double ext, double angX, double angY, double angZ)
Set the abstract pose in mirror mode (directly set the abstract pose parameters if this is the left l...
Definition: gait_abstract_pose.h:66
void setPose(double ext, double angX, double angY, double angZ)
Set the abstract pose (directly set the abstract pose parameters)
Definition: gait_abstract_pose.h:57
Data struct that contains the information pertaining to a leg pose that should be common amongst all ...
Definition: gait_common_pose.h:20
AbstractLegPose(bool left=true)
Default constructor.
Definition: gait_abstract_pose.h:42
void setArmsFromInversePose(const InverseArmPose &left, const InverseArmPose &right)
Set the abstract arm poses to given inverse poses.
Definition: gait_abstract_pose.h:277
void setLinkLength(double length)
Set the link length used for pose conversions.
Definition: gait_common_pose.h:89