Free Electron
lab/intelligence/Scanner.h
Go to the documentation of this file.
1 /* Copyright (C) 2003-2021 Free Electron Organization
2  Any use of this software requires a license. If a valid license
3  was not distributed with this file, visit freeelectron.org. */
4 
5 /** @file */
6 
7 #ifndef __intelligence_Scanner_h__
8 #define __intelligence_Scanner_h__
9 namespace fe
10 {
11 namespace ext
12 {
13 
14 /**************************************************************************//**
15  @brief Scanner RecordView
16 
17  @ingroup intelligence
18 *//***************************************************************************/
19 class FE_DL_EXPORT Scanner: public Controlled
20 {
21  public:
23  Functor<SpatialQuaternion> autoRotate;
24  Functor<SpatialQuaternion> rotVelocity;
25  Functor< sp<RecordGroup> > selection;
26  Functor<Record> purview;
27  Functor<Record> nearest;
28  Functor<F32> maxRotVelocity;
29  Functor<F32> maxRotAcceleration;
30  Functor<I32> tracking;
31  Functor<I32> ignoreFriend;
32  Functor<I32> ignoreNeutral;
33  Functor<I32> ignoreEnemy;
34 
35  Scanner(void) { setName("Scanner"); }
36 virtual void addFunctors(void)
37  {
39 
40  add(track, FE_SPEC("ai:track",
41  "Location of attention"));
42  add(autoRotate, FE_SPEC("ai:autoRotate",
43  "Default Rotational Velocity"));
44  add(rotVelocity, FE_SPEC("ai:rotVelocity",
45  "Current Rotational Velocity"));
46  add(selection, FE_SPEC("ai:selection",
47  "RG of interest"));
48  add(purview, FE_SPEC("ai:observation",
49  "Record describing region of sight"));
50  add(nearest, FE_SPEC("ai:nearest",
51  "The nearest Record in selection"));
52  add(maxRotVelocity, FE_SPEC("ai:maxRotVel",
53  "Max angular velocity in degrees/second"));
54  add(maxRotAcceleration, FE_SPEC("ai:maxRotAccel",
55  "Max angular acceleration in degrees/second^2"));
56  add(tracking, FE_SPEC("ai:tracking",
57  "Flag to track a point"));
58  add(ignoreFriend, FE_SPEC("ai:ignFriend",
59  "Flag to ignore friends"));
60  add(ignoreNeutral, FE_SPEC("ai:ignNeutral",
61  "Flag to ignore those neither friend nor enemy"));
62  add(ignoreEnemy, FE_SPEC("ai:ignEnemy",
63  "Flag to ignore enemies"));
64  }
65 virtual void initializeRecord(void)
66  {
68 
69  identifier()="Scanner";
70 
71  Observation observationRV;
72  observationRV.bind(scope());
73  purview()=observationRV.createRecord();
74  observationRV.observer()=record();
75 
76  Cylinder cylinderRV;
77  cylinderRV.bind(scope());
78  observationRV.shape()=cylinderRV.createRecord();
79 
80  set(cylinderRV.span(),8.0f);
81  cylinderRV.baseRadius()=0.4f;
82  cylinderRV.endRadius()=4.0f;
83 
84  //* per ms
85  autoRotate()=SpatialQuaternion(3.0f,e_zAxis);
86  set(rotVelocity());
87 
88  maxRotVelocity()=1.0f;
89  maxRotAcceleration()=1.0f;
90  tracking()=false;
91  ignoreFriend()=false;
92  ignoreNeutral()=false;
93  ignoreEnemy()=false;
94  }
95 };
96 
97 } /* namespace ext */
98 } /* namespace fe */
99 
100 #endif /* __intelligence_Scanner_h__ */
virtual void addFunctors(void)
Called at instantiation to add functors.
Definition: lab/intelligence/Scanner.h:36
Controlled RecordView.
Definition: Controlled.h:19
void bind(sp< Scope > &rspScope)
Associate with a Scope.
Definition: RecordView.h:319
kernel
Definition: namespace.dox:3
Bound accessor in a RecordView.
Definition: RecordView.h:147
Cylinder RecordView.
Definition: Cylinder.h:27
Scanner RecordView.
Definition: lab/intelligence/Scanner.h:19
Observation RecordView.
Definition: Observation.h:22
virtual void initializeRecord(void)
Called at instantiation to initialize attributes.
Definition: Controlled.h:37
virtual void addFunctors(void)
Called at instantiation to add functors.
Definition: Controlled.h:27
Record createRecord(void)
Create a Record using all the attributes.
Definition: RecordView.h:469
virtual void initializeRecord(void)
Called at instantiation to initialize attributes.
Definition: lab/intelligence/Scanner.h:65