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
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
/**
* @file GoalModel.h
*
* @author <a href="mailto:borisov@informatik.hu-berlin.de">Alexander Borisov</a>
* @author <a href="mailto:xu@informatik.hu-berlin.de">Xu, Yuan</a>
* @author <a href="mailto:scheunem@informatik.hu-berlin.de">Marcus Scheunemann</a>
* @author <a href="mailto:mellmann@informatik.hu-berlin.de">Heinrich Mellmann</a>
* Definition of class GoalModel
*/

#ifndef _GoalModel_h_
#define _GoalModel_h_

#include <Tools/Math/Vector2.h>
#include <Tools/Math/Pose2D.h>
#include "Tools/ColorClasses.h"
#include <Tools/DataStructures/Printable.h>

#include "Representations/Infrastructure/FieldInfo.h"
#include "Representations/Infrastructure/FrameInfo.h"
#include "Representations/Modeling/PlayerInfo.h"
#include "Representations/Modeling/CompassDirection.h"

class GoalModel : public naoth::Printable
{
public:
  class Goal
  {
  public:
    Goal(){}
    virtual ~Goal(){}

    Vector2d leftPost;
    Vector2d rightPost;
    naoth::FrameInfo frameInfoWhenGoalLastSeen;
    
    /* color of the goal */
    ColorClasses::Color color;

    Vector2d calculateCenter() const {
      return (leftPost + rightPost)*0.5;
    }

  };//end class Goal

  Goal goal;

  Goal getOwnGoal(const CompassDirection& compassDirection, const FieldInfo& fieldInfo) const;
  Goal getOppGoal(const CompassDirection& compassDirection, const FieldInfo& fieldInfo) const;
  Goal getOppGoal(double angle, const FieldInfo& fieldInfo) const;
  Goal getOwnGoal(double angle, const FieldInfo& fieldInfo) const;


  // TODO: deprecated?!
  //const Goal& getTeamGoal(naoth::GameData::TeamColor teamColor) const;
  //Goal& getTeamGoal(naoth::GameData::TeamColor teamColor);

  virtual void print(std::ostream& stream) const;

  void draw() const;

  static GoalModel::Goal calculateAnotherGoal(const GoalModel::Goal& one, double distance);<--- Function 'calculateAnotherGoal' argument 1 names different: declaration 'one' definition 'goal'.
  Pose2D calculatePose(const CompassDirection& compassDirection, const FieldInfo& fieldInfo) const;
  Pose2D calculatePose(double angle, const FieldInfo& fieldInfo) const;

  //private:
  //  Goal another;
};//end class GoalModel

/** goal model in robot's local coordinates based on pure observations of the goal posts */
class LocalGoalModel : public GoalModel
{
public:
  LocalGoalModel();

  /** indicates whether a complete goal was seen in the last frame */
  bool someGoalWasSeen;

  bool opponentGoalIsValid;
  bool ownGoalIsValid;

  virtual void print(std::ostream& stream) const;

  Vector2d seen_center;
  double seen_angle;

  naoth::FrameInfo frameWhenOpponentGoalWasSeen;
  naoth::FrameInfo frameWhenOwnGoalWasSeen;
};

/** goal model in robot's local coordinates, it is updated by robot's pose */
class SelfLocGoalModel : public GoalModel
{
public:
  void update(const Pose2D& robotPose, const FieldInfo& fieldInfo);
  /*
  inline const Goal getOwnGoal(const CompassDirection& compassDirection, const FieldInfo& fieldInfo) const { return GoalModel::getOwnGoal(compassDirection, fieldInfo); }
  inline const Goal getOppGoal(const CompassDirection& compassDirection, const FieldInfo& fieldInfo) const { return GoalModel::getOppGoal(compassDirection, fieldInfo); }
  */
};

class SensingGoalModel : public GoalModel
{
public:
  SensingGoalModel();

  //indicates whether a complete goal was seen in the last frame
  bool someGoalWasSeen;
  bool horizonScan;
};

#endif // __GoalModel_h_