VR-Forces 4.0.4 Class Documentation
include/vrfmodel/humanFollowController.h
Go to the documentation of this file.
00001 /*******************************************************************************
00002 ** Copyright (c) 2003 MAK Technologies, Inc.
00003 ** All rights reserved.
00004 *******************************************************************************/
00005 /*******************************************************************************
00006 ** $RCSfile: humanFollowController.h,v $ $Revision: 1.4 $ $State: Exp $
00007 *******************************************************************************/
00008 
00011 
00014 
00015 
00016 #ifndef humanFollowController_H_
00017 #define humanFollowController_H_
00018 
00019 #include <vrfobjcore/singleTaskControllerComponent.h>
00020 #include "vrfmodel/vrfmodelDefines.h"
00021 
00022 class DtHumanStateRepository;
00023 class DtHumanFollowPSR;
00024 class DtInputPortGroup;
00025 class DtCollisionInputPort;
00026 class DtHumanMovementControlOutputPortGroup;
00027 class DtVectorOutputPort;
00028 
00037 class DT_DLL_vrfmodel DtHumanFollowController : public DtSingleTaskControllerComponent
00038 {
00039 
00040 public:
00041 
00044    DtHumanFollowController(const DtString& name, 
00045       DtVrfObject* owner,
00046       DtSimManager* simManager, 
00047       DtComponentDescriptor* desc = 0,
00048       DtReaderWriterRegistry* parentRegistry = 0);
00049 
00051    virtual ~DtHumanFollowController();
00052 
00055    virtual DtString type() const;
00056 
00058    virtual bool init();
00059 
00065    virtual bool createPSR();
00066 
00068    virtual void tick();
00069 
00073    static void followEntityCallback(DtSimMessage* msg, void* usrData);
00074 
00075    virtual void processFollowEntityTask(DtSimMessage* msg);
00076 
00081    virtual const DtString& entityToFollow();
00082    virtual void setEntityToFollow(const DtString& entity);
00083 
00086    virtual const DtVector& offsetVector() const;
00087    virtual void setOffsetVector(const DtVector& offsets);
00088 
00092    static DtSimComponent * creator(const DtString& name, 
00093       DtVrfObject* owner,
00094       DtSimManager* simManager, 
00095       DtComponentDescriptor* desc = 0,
00096       DtReaderWriterRegistry* parentRegistry = 0);
00097 
00099    virtual void registerTaskMsgCallbacks();
00100 
00104    virtual bool setupDestination();
00105 
00108    virtual bool passedDestination();
00109 
00112    virtual double findDesiredSpeed();
00113 
00117    virtual double findDesiredHeading();
00118    
00129    virtual void setupDestinationVector() const;
00130 
00134    virtual void stop();
00135 
00136    virtual void clearTask();
00137 
00138 protected:
00139 
00141    DtHumanFollowController(const DtHumanFollowController & 
00142       orig);
00143 
00145    const DtHumanFollowController & operator=(const 
00146       DtHumanFollowController & orig);
00147 
00149    virtual void invalidateDestinationVector() const;
00150 
00161    virtual bool nearDestination();
00162 
00171    virtual bool getDestination(DtVector & destination);
00172 
00177    virtual const DtVector& destinationVector() const;
00178 
00187    virtual bool atDestination();
00188 
00191    virtual void doMoving();
00192 
00194    virtual bool destinationIsInsideObstruction(
00195       const DtVector& localDestination) const;
00196 
00198    virtual bool createPortGroups();
00199 
00201    virtual bool createPorts();
00202 
00204    virtual void moveToDestination();
00205 
00206    virtual double distanceToDestination() const;
00207 
00208 protected:
00209 
00211    DtVrfObject* myEntityToFollow;
00212 
00214    DtHumanStateRepository* myHumanStateRepository;
00215 
00218    DtHumanFollowPSR* myProcessState;
00219 
00222 
00228    DtCollisionInputPort*   myCollisionAvoidancePort;
00229 
00232    DtInputPortGroup*       myCollisionAvoidancePortGroup;
00233 
00235    DtHumanMovementControlOutputPortGroup* myHumanMovementControlOutputPortGroup;
00236 
00242    DtVectorOutputPort* myDestinationOutputPort;
00243 
00245 
00246    DtVector          myLocalDestination;
00247    DtVector          myWorldDestination;
00248    mutable DtVector  myDestinationVector;
00249    mutable bool      myDestinationVectorIsValid;
00250    bool              myNearDestination;
00251    bool              myPassedDestination;
00252    bool              myAtDestination;
00253    double            myDistanceSquared;
00254    bool myDestinationIsInsideObstruction;
00255    double            myCurrentSpeed;
00256 
00260    double myAtDistanceSquared;
00261 
00265    double myNearDistanceSquared;
00266 
00270    double myApproachSpeed;
00271 
00277    double myPassedSlowDownFactor;
00278 
00285    double myFarCatchUpFactor;
00286 
00293    double myNearCatchUpFactor; 
00294 };
00295 
00296 #endif
00297 
00298 
00299 

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)