NimbRo ROS Soccer Package
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
jointperspective.h
1 // Class to load joint perspective from yaml
2 // Author: Dmytro Pavlichenko <dm.mark999@gmail.com>
3 
4 #ifndef JOINT_PERSPECTIVE_H
5 #define JOINT_PERSPECTIVE_H
6 
7 #include <vector>
8 #include <string>
9 #include <yaml-cpp/yaml.h>
10 
11 #include <trajectory_editor/spaces/basicsmallview.h>
12 
13 namespace joint_perspective
14 {
15 
16 struct Joint
17 {
18  std::string joint_name; // The actual name of a joint
19  std::string visual_name; // The name you see in GUI
20 
21  BasicSmallView::Alignment alignment;
22  BasicSmallView::Type type;
23 
24  bool mirror_on_shift;
25  bool spacer;
26 };
27 
28 class JointPerspective
29 {
30 public:
31  JointPerspective();
32  ~JointPerspective();
33 
34  bool load(std::string path_to_file);
35  bool correspondsTo(std::vector<std::string> &joint_list);
36 
37 public:
38  std::string m_name;
39  std::string m_model;
40  std::string m_robot_name;
41 
42  bool m_joint_space_allowed;
43  bool m_pid_space_allowed;
44  bool m_abstract_space_allowed;
45  bool m_inverse_space_allowed;
46 
47  std::vector<Joint> m_joints;
48 
49 private:
50  void nodeToPerspective(const YAML::Node& node);
51 };
52 
53 
54 // Wrapper around vector of perspectives
55 // TODO move to separate file?
56 class PerspectiveManager
57 {
58 public:
59  PerspectiveManager();
60  ~PerspectiveManager();
61 
62  bool isNewPerspective(std::vector<std::string> &joint_list, bool &ok);
63 
64  JointPerspective& getCurrentPerspective();
65  const std::vector<JointPerspective>& getPerspectives();
66 
67 private:
68  std::vector<JointPerspective> m_perspectives;
69  JointPerspective m_current_perspective;
70 };
71 
72 }
73 
74 #endif