VR-Forces 4.0.4 Class Documentation
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes
DtGroundFollowEntityController Class Reference

DtGroundFollowEntityController is a controller that models following behavior for ground vehicles. More...

Inheritance diagram for DtGroundFollowEntityController:
Inheritance graph
[legend]

List of all members.

Public Member Functions

 DtGroundFollowEntityController (const DtString &name, DtVrfObject *owner, DtSimManager *simManager, DtComponentDescriptor *desc=0, DtReaderWriterRegistry *parentRegistry=0)
 (const DtString&,DtVrfObject*,DtSimManager*,
virtual ~DtGroundFollowEntityController ()
 destructor
virtual DtString type () const
 Returns a string identifies the class type of component.
virtual void processFollowEntityTask (DtSimMessage *msg)
virtual const DtStringentityToFollow ()
 What entity are we following? This accessor has the side effect of setting myProcessState->myEntityToFollow to DtString::nullString(), if the entity is not tasked and myEntityToFollow is not already the null string.
virtual void setEntityToFollow (const DtString &entity)
virtual const DtVectoroffsetVector () const
 The offset from the entity's position to follow at, in entity coordinates.
virtual void setOffsetVector (const DtVector &offsets)
virtual void registerTaskMsgCallbacks ()
 Overrides this so it can register its interest in followEntity commands.
virtual bool setupDestination ()
 Sets the world destination in the process state repository to the location of the entity we're following plus the indicated offset and then calls down to the base class.
virtual bool passedDestination ()
 Overrides to force the entity to be near the destination as well as across the 'destination' line to be considered past the destination.
virtual double findDesiredSpeed ()
 Overrides so we can speed up when falling behind and slow down if we get past the position we're supposed to be in.
virtual double findDesiredHeading ()
 Overrides so the entity won't turn toward the destination point when it is close to or past the destination; rather, in these cases, it assumes the heading of the lead entity.
virtual void setupDestinationVector () const
 Determine the destination vector for the entity out of the heading of the entity being followed.
virtual DtAutoTransmissionGear determineGearSetting ()
 Sets myProcessState->myCurrentGear to DtAutoGearReverse or DtAutoGearForward based on dot product of the followed entity's velocity vector and it's heading vector.
virtual void stop ()
 Overrides so we don't complete the task when we're at the right location with regard to the followed entity.

Static Public Member Functions

static void followEntityCallback (DtSimMessage *msg, void *usrData)
 Instances of this component will register this callback with their own 'this' pointer as user data with the msg executive requesting notification of move-to tasks.
static DtSimComponentcreator (const DtString &name, DtVrfObject *owner, DtSimManager *simManager, DtComponentDescriptor *desc=0, DtReaderWriterRegistry *parentRegistry=0)
 (const DtString&,DtVrfObject*,DtSimManager*,

Protected Member Functions

 DtGroundFollowEntityController ()
 Default constructor; should not be called.
 DtGroundFollowEntityController (const DtGroundFollowEntityController &orig)
 copy constructor; shallow; does not copy the ports.
const
DtGroundFollowEntityController
operator= (const DtGroundFollowEntityController &orig)
 assignment operator; see comments on copy constructor!
bool createPorts ()
 Overridden to create the automotive ports.

Protected Attributes

DtVrfObjectmyEntityPointer
 Set fresh each frame by setupDestination()
DtStringOutputPortmyFollowEntityOutputPort

Detailed Description

DtGroundFollowEntityController is a controller that models following behavior for ground vehicles.

Developer Description: Each simulation frame the destination to which the entity moves is recalculated to be in the right place with respect to the followed entity.

Uses Descriptor Type: DtGroundMoveToDescriptor


Constructor & Destructor Documentation

DtGroundFollowEntityController::DtGroundFollowEntityController ( const DtString name,
DtVrfObject owner,
DtSimManager simManager,
DtComponentDescriptor desc = 0,
DtReaderWriterRegistry parentRegistry = 0 
)

(const DtString&,DtVrfObject*,DtSimManager*,

Parameters:
nameReader writer name of this component.
ownerThe DtVrfObject that owns this component
simManagerThe simulation manager (provides access to terrain, message interface, simulation clock).
descThe component descriptor used to initialize this component.
parentRegistryPointer to the parent reader writer registry (the containing object that reads/writes this object).
(const DtString&,DtVrfObject*,DtSimManager*, DtComponentDescriptor*,DtReaderWriterRegistry* parentRegistry)

destructor

Default constructor; should not be called.

Here because the compiler will generate an unprotected one otherwise.

copy constructor; shallow; does not copy the ports.


Member Function Documentation

virtual DtString DtGroundFollowEntityController::type ( ) const [virtual]

Returns a string identifies the class type of component.

Type values are defined in compTypes.h. DtSimComponent creation functions are registered with the DtSimComponentFactory using the type values as the key.

Returns:
DtGroundAutoFollowEntityType

Reimplemented from DtGroundMoveToDestinationControllerComponent.

static void DtGroundFollowEntityController::followEntityCallback ( DtSimMessage msg,
void *  usrData 
) [static]

Instances of this component will register this callback with their own 'this' pointer as user data with the msg executive requesting notification of move-to tasks.

What entity are we following? This accessor has the side effect of setting myProcessState->myEntityToFollow to DtString::nullString(), if the entity is not tasked and myEntityToFollow is not already the null string.

virtual void DtGroundFollowEntityController::setEntityToFollow ( const DtString entity) [virtual]
virtual const DtVector& DtGroundFollowEntityController::offsetVector ( ) const [virtual]

The offset from the entity's position to follow at, in entity coordinates.

This comes from the follow task message.

virtual void DtGroundFollowEntityController::setOffsetVector ( const DtVector offsets) [virtual]
static DtSimComponent* DtGroundFollowEntityController::creator ( const DtString name,
DtVrfObject owner,
DtSimManager simManager,
DtComponentDescriptor desc = 0,
DtReaderWriterRegistry parentRegistry = 0 
) [static]

(const DtString&,DtVrfObject*,DtSimManager*,

Parameters:
nameReader writer name of this component.
ownerThe DtVrfObject that owns this component
simManagerThe simulation manager (provides access to terrain, message interface, simulation clock).
descThe component descriptor used to initialize this component.
parentRegistryPointer to the parent reader writer registry (the containing object that reads/writes this object).
(const DtString&,DtVrfObject*,DtSimManager*, DtComponentDescriptor*,DtReaderWriterRegistry* parentRegistry)

Returns:
New instance of this class.

Reimplemented from DtGroundMoveToDestinationControllerComponent.

Overrides this so it can register its interest in followEntity commands.

Reimplemented from DtGroundMoveToDestinationControllerComponent.

Sets the world destination in the process state repository to the location of the entity we're following plus the indicated offset and then calls down to the base class.

Reimplemented from DtGroundMoveToDestinationControllerComponent.

Overrides to force the entity to be near the destination as well as across the 'destination' line to be considered past the destination.

Reimplemented from DtGroundMoveToDestinationControllerComponent.

Overrides so we can speed up when falling behind and slow down if we get past the position we're supposed to be in.

Reimplemented from DtGroundMoveToDestinationControllerComponent.

Overrides so the entity won't turn toward the destination point when it is close to or past the destination; rather, in these cases, it assumes the heading of the lead entity.

Reimplemented from DtGroundMoveToDestinationControllerComponent.

Determine the destination vector for the entity out of the heading of the entity being followed.

Converts the heading into topo coordinates, creates a topo destination vector, and then converts that to the entity's local coordinate system. This is used by the entity to determine if it has passed it's destination which is the entity being followed, including the specified offset.

Note:
this function is not currently used.
Assumes that the entity pointer member, the sim manager, the terrain database in the sim manager, and the coordinate system object in the terrain database are all non-NULL.

Reimplemented from DtGroundMoveToDestinationControllerComponent.

Sets myProcessState->myCurrentGear to DtAutoGearReverse or DtAutoGearForward based on dot product of the followed entity's velocity vector and it's heading vector.

If the followed entity is not moving, then gear is the same as the previous frame.

Reimplemented from DtGroundMoveToDestinationControllerComponent.

virtual void DtGroundFollowEntityController::stop ( ) [virtual]

Overrides so we don't complete the task when we're at the right location with regard to the followed entity.

Simply calls DtGroundMoveToControllerComponent::doMoving().

Reimplemented from DtGroundMoveToDestinationControllerComponent.

const DtGroundFollowEntityController& DtGroundFollowEntityController::operator= ( const DtGroundFollowEntityController orig) [protected]

assignment operator; see comments on copy constructor!

Overridden to create the automotive ports.

Reimplemented from DtGroundMoveToDestinationControllerComponent.


Member Data Documentation

Set fresh each frame by setupDestination()


The documentation for this class was generated from the following file:

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)