~ubuntu-branches/ubuntu/precise/flightgear/precise

« back to all changes in this revision

Viewing changes to src/AIModel/AIWingman.hxx

  • Committer: Package Import Robot
  • Author(s): Ove Kaaven
  • Date: 2011-09-03 22:16:12 UTC
  • mfrom: (3.1.9 sid)
  • Revision ID: package-import@ubuntu.com-20110903221612-2cjy0z7ztj5nkln5
Tags: 2.4.0-1
* New upstream release. Closes: #638588.
* Build-Depend on OpenSceneGraph 3.0, and the Subversion library.
* Recommend fgfs-scenery-base.
* Enable parallel builds (shorter compile times on multicore CPUs).
* Removed hack that tried to build without optimizations if
  building with optimizations fails.

Show diffs side-by-side

added added

removed removed

Lines of Context:
25
25
#include "AIManager.hxx"
26
26
#include "AIBase.hxx"
27
27
 
 
28
#include <simgear/sg_inlines.h>
 
29
#include <simgear/math/SGMath.hxx>
 
30
 
 
31
 
28
32
class FGAIWingman : public FGAIBallistic {
29
33
public:
30
34
    FGAIWingman();
42
46
    virtual void reinit() { init(); }
43
47
    virtual void update (double dt);
44
48
 
 
49
    void formateToAC(double dt);
 
50
    void Break(double dt);
 
51
    void Join(double dt);
 
52
    void Run(double dt);
 
53
 
 
54
    double getDistanceToOffset() const;
 
55
    double getElevToOffset() const;
 
56
 
 
57
    double calcAngle(double rangeM, SGGeod pos1, SGGeod pos2);
 
58
    double calcDistanceM(SGGeod pos1, SGGeod pos2) const;
 
59
 
 
60
    bool   _formate_to_ac;
 
61
    bool   _break;
 
62
    bool   _join;
 
63
 
 
64
    double _break_angle; //degrees relative
 
65
    double _coeff_hdg; //dimensionless coefficient
 
66
    double _coeff_pch; //dimensionless coefficient
 
67
    double _coeff_bnk; //dimensionless coefficient
 
68
    double _coeff_spd; //dimensionless coefficient
 
69
 
 
70
    SGPropertyNode_ptr user_WoW_node;
 
71
 
 
72
    inline void setFormate(bool f);
 
73
    inline void setTgtHdg(double hdg);
 
74
    inline void setTgtSpd(double spd);
 
75
    inline void setBrkHdg(double angle);
 
76
    inline void setBrkAng(double angle);
 
77
    inline void setCoeffHdg(double h);
 
78
    inline void setCoeffPch(double p);
 
79
    inline void setCoeffBnk(double r);
 
80
    inline void setCoeffSpd(double s);
 
81
 
 
82
    inline bool getFormate() const { return _formate_to_ac;}
 
83
 
 
84
    inline double getTgtHdg() const { return tgt_heading;}
 
85
    inline double getTgtSpd() const { return tgt_speed;}
 
86
    inline double getBrkAng() const { return _break_angle;}
 
87
 
 
88
    inline SGVec3d getCartInPos(SGGeod in_pos) const;
 
89
 
45
90
};
46
91
 
 
92
void FGAIWingman::setFormate(bool f) {
 
93
    _formate_to_ac = f;
 
94
}
 
95
 
 
96
void FGAIWingman::setTgtHdg(double h) {
 
97
    tgt_heading = h;
 
98
}
 
99
 
 
100
void FGAIWingman::setTgtSpd(double s) {
 
101
    tgt_speed = s;
 
102
}
 
103
 
 
104
void FGAIWingman::setBrkHdg(double a){
 
105
    tgt_heading = hdg + a ;
 
106
    SG_NORMALIZE_RANGE(tgt_heading, 0.0, 360.0);
 
107
}
 
108
 
 
109
void FGAIWingman::setBrkAng(double a){
 
110
    _break_angle = a ;
 
111
    SG_NORMALIZE_RANGE(_break_angle, -180.0, 180.0);
 
112
}
 
113
 
 
114
void FGAIWingman::setCoeffHdg(double h){
 
115
    _coeff_hdg = h;
 
116
}
 
117
 
 
118
void FGAIWingman::setCoeffPch(double p){
 
119
    _coeff_pch = p;
 
120
}
 
121
 
 
122
void FGAIWingman::setCoeffBnk(double b){
 
123
    _coeff_bnk = b;
 
124
}
 
125
 
 
126
void FGAIWingman::setCoeffSpd(double s){
 
127
    _coeff_spd = s;
 
128
}
 
129
 
 
130
//bool FGAIWingman::getFormate() const {
 
131
//    return _formate_to_ac;
 
132
//}
 
133
 
 
134
//double FGAIWingman::getTgtHdg() const{
 
135
//    return tgt_heading;
 
136
//}
 
137
 
 
138
//double FGAIWingman::getTgtSpd() const{
 
139
//    return tgt_speed;
 
140
//}
 
141
 
 
142
//double FGAIWingman::getBrkAng() const{
 
143
//    return _break_angle;
 
144
//}
 
145
 
 
146
SGVec3d FGAIWingman::getCartInPos(SGGeod in_pos) const {
 
147
    SGVec3d cartPos = SGVec3d::fromGeod(in_pos);
 
148
    return cartPos;
 
149
}
 
150
 
47
151
#endif  // FG_AIWINGMAN_HXX