NimbRo ROS Soccer Package
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
poseconverter.h
1 // Handle conversions between poses
2 // Author: Dmytro Pavlichenko <dm.mark999@gmail.com>
3 
4 #ifndef POSECONVERTER_H
5 #define POSECONVERTER_H
6 
7 #include <motion_file/motionfile.h>
8 
9 #include <gait/util/gait_joint_pose.h>
10 #include <gait/util/gait_abstract_pose.h>
11 #include <gait/util/gait_inverse_pose.h>
12 
13 namespace motionfile
14 {
15 
16 class PoseConverter
17 {
18 public:
19  struct Angles
20  {
21  double yaw;
22  double roll;
23  double pitch;
24  };
25 
26  gait::JointPose getJointPose(motionfile::KeyframePtr frame, const std::vector<std::string> &jointList);
27 
28  void updateFrame(gait::AbstractPose &abstractPose, motionfile::KeyframePtr frame, const std::vector<std::string> &jointList);
29  void updateFrame(gait::InversePose &inversePose, motionfile::KeyframePtr frame, const std::vector<std::string> &jointList);
30 
31  // Returns true if all joints except 'joint_name' are the same in two given poses
32  static bool equalExcept(gait::InversePose &pose_one, gait::InversePose &pose_two, const std::string &joint_name, const double epsilon);
33 
34  static PoseConverter::Angles anglesFromQuaternion(Eigen::Quaterniond q);
35  static Eigen::Quaterniond quaternionFromAngles(PoseConverter::Angles angles);
36 private:
37  // Get position of joint namejointName
38  double getPos(motionfile::KeyframePtr frame, const std::vector<std::string> &jointList, std::string jointName);
39 
40  // Set position of joint namejointName to 'pos'
41  void setPos(motionfile::KeyframePtr frame, const std::vector<std::string> &jointList, std::string jointName, double pos);
42 
43  void updateFrame(gait::JointPose &pose, motionfile::KeyframePtr frame, const std::vector<std::string> &jointList, bool fromInverse);
44 };
45 
46 }
47 
48 #endif // POSECONVERTER_H
Data struct that encompasses the joint representation of a robot pose.
Definition: gait_joint_pose.h:242
Data struct that encompasses the inverse representation of a robot pose.
Definition: gait_inverse_pose.h:188
Data struct that encompasses the abstract representation of a robot pose.
Definition: gait_abstract_pose.h:214