1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
/**
* @file RobotPose.h
*
* Definition of class RobotPose which represents the position and direction of the robot on the field
* @author <a href="mailto:mellmann@informatik.hu-berlin.de">Heinrich Mellmann</a>
*/

#ifndef RobotPose_h
#define RobotPose_h

#include "Tools/Math/Pose2D.h"
#include "Tools/DataStructures/Printable.h"
#include "Tools/DataStructures/Serializer.h"

#include "Tools/Debug/DebugDrawings.h"
namespace naoth
{
class RobotPose: public Pose2D, public naoth::Printable<--- The class 'RobotPose' has 'operator=' but lack of 'copy constructor'.
{
public:
  RobotPose() : isValid(false) {}

  RobotPose (const Pose2D& other) : isValid(false)
  {
    Pose2D::operator=(other);
  }

  virtual ~RobotPose(){}

  const RobotPose& operator=(const RobotPose& other)
  {
    Pose2D::operator=(other);
    this->isValid = other.isValid;
    return *this;
  }

  // NOTE: only the pose is modified the all the other members are left untouched
  const RobotPose& operator=(const Pose2D& other)
  {
    Pose2D::operator=(other);
    return *this;
  } 

  // indicates whether the pose is valid :)
  bool isValid;

  // estimated principal axes of the position belief (not for angle)
  // can be used as a measure for how 'precise' the position estimation is
  Vector2d principleAxisMajor;
  Vector2d principleAxisMinor;


  virtual void print(std::ostream& stream) const;
  void draw(DrawingCanvas2D& canvas, bool drawDeviation=false) const;
  
};

template<>
class Serializer<RobotPose>
{
public:
  static void serialize(const RobotPose& representation, std::ostream& stream);
  static void deserialize(std::istream& stream, RobotPose& representation);
};
}
#endif// RobotPose_h