VR-Forces 4.0.4 Class Documentation
examples/radarWarnRx/simpleRdrWrnResp.h
Go to the documentation of this file.
00001 /*******************************************************************************
00002 ** Copyright (c) 2003 MAK Technologies, Inc.
00003 ** All rights reserved.
00004 *******************************************************************************/
00005 /*******************************************************************************
00006 ** $RCSfile: simpleRdrWrnResp.h,v $ $Revision: 1.7 $ $State: Exp $
00007 *******************************************************************************/
00008 
00009 #ifndef DtSimpleRadarWarningResponse_H_
00010 #define DtSimpleRadarWarningResponse_H_
00011 
00012 #include "vrfmodel/fixWngPltCtl.h"
00013 
00014 //class DtSimpleRadarWarningResponse:
00015 //
00016 //Instances of DtSimpleRadarWarningResponse are an example of a controller
00017 //that implements a reactive behavior when a it receives sensor input that
00018 //a radar has been detected.  It receives a list of emitter systems (hostile
00019 //radar systems).  It takes the first emitter in the list and flys away to
00020 //a location in the opposite direction.
00021 
00022 class DtVrfObject;
00023 class DtEntityListInputPort;   
00024 
00025 class DtSimpleRadarWarningResponse : public DtFixedWingPilotController
00026 {
00027 public:
00028    
00029    //constructor
00030    DtSimpleRadarWarningResponse(const DtString& name, DtVrfObject* owner,
00031       DtSimManager* simManager, DtComponentDescriptor* desc = NULL,
00032       DtReaderWriterRegistry* const parentRegistry = 0);
00033 
00034 
00035    //destructor
00036    virtual ~DtSimpleRadarWarningResponse();
00037 
00038    //This returns a string that uniquely identifies this type of component.
00039    //(must be unique with respect to the component types defined in compTypes.h
00040    //as well as any additional user-defined components).  Returns the string
00041    //"simple-radar-warning-response".
00042    virtual DtString type() const;
00043 
00044    //Calculate new control values.
00045    virtual void tick();
00046 
00047    //Returns a newly created instance of this class.  We need to provide
00048    //this function so that we can register this class with the component
00049    //factory.
00050    static DtSimComponent* creator(const DtString& name, DtVrfObject* owner,
00051       DtSimManager* simManager, DtComponentDescriptor* desc,
00052       DtReaderWriterRegistry* parentRegistry);
00053 
00054 protected:
00055 
00056    //Called by DtSimComponent::init to create myEntityListPort used to manage
00057    //multiple sensors that might provide targets to this controller.
00058    virtual bool createPorts();
00059 
00060    //Looks up safe control point by name.  If the object exists and it has
00061    //a valid state repository, returns the object.  Otherwise returns NULL.
00062    virtual DtVrfObject* getControlPoint(const DtString& name);
00063 
00064    //Returns true if we are in the vicinity of the given position.  To be
00065    //in the vicinity of the position means that we are within 5 seconds of
00066    //the given location, given our ordered speed.
00067    virtual bool inVicinity(const DtVector& localPosition);
00068 
00069 protected:
00070 
00071    //default constructor
00072    DtSimpleRadarWarningResponse();
00073 
00074    //copy constructor, not implemented
00075    DtSimpleRadarWarningResponse(const DtSimpleRadarWarningResponse& orig);
00076 
00077    //assignment operator, not implemented
00078    DtSimpleRadarWarningResponse& operator=(const DtSimpleRadarWarningResponse& orig);
00079 
00080 protected:
00081 
00082    //Port though which the list of hostile emitter systems will be received.
00083    DtEntityListInputPort* myEmitterListPort; 
00084    
00085    //true while in state of reacting to the detection of an emitter.
00086    bool myReactingToWarning;
00087 
00088    //Name of the safe location (a control point) we can retreat to.
00089    DtString mySafeControlPointName;
00090 
00091    DtVector myLocalGoal;
00092 };
00093 
00094 #endif
00095 

Document ID: Generated on Fri Jun 29 16:33:32 EDT 2012 from SVN revision 116588
Copyright © 2005-2012 VT MÄK Inc. All Rights Reserved (www.mak.com)