VR-Forces 4.0.4 Class Documentation
Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions
DtGroundAutoControllerComponent Class Reference

DtGroundAutoControllerComponent is a base controller that holds capabilitites common to all automotive controllers. More...

Inheritance diagram for DtGroundAutoControllerComponent:
Inheritance graph
[legend]

List of all members.

Public Member Functions

 DtGroundAutoControllerComponent (const DtString &name, DtVrfObject *owner, DtSimManager *simManager, DtComponentDescriptor *desc=0, DtReaderWriterRegistry *parentRegistry=0)
 (const DtString&,DtVrfObject*,DtSimManager*,
virtual ~DtGroundAutoControllerComponent ()
 destructor
virtual bool init ()
 Initializes myGroundVehicleState.
virtual DtString type () const
 Returns a string identifies the class type of component.
virtual void clearTask ()
 Overridden to call deactive the port group when this controller completes a task.
virtual double approximateThrottle (double speed)
 We use this to approximate the correct throttle for a given speed, much like a real (experienced) driver does.
virtual double calculateSteering (double currentHeading, double desiredHeading) const
virtual double calculateCurrentBrakingDistance () const
virtual bool createAutomotiveControlPortGroup ()
 These are called in init to create the ports used to communicate with the actuator.
virtual bool createThrottlePort ()
virtual bool createSteeringPort ()
virtual bool createBrakePort ()
virtual bool createGearPort ()
virtual bool createParkingBrakePort ()
virtual
DtConstrainedAnalogOutputPort
throttlePort ()
virtual
DtConstrainedAnalogOutputPort
steeringPort ()
virtual
DtConstrainedAnalogOutputPort
brakePort ()
virtual
DtConstrainedIntegerOutputPort
gearPort ()
virtual DtBooleanOutputPortparkingBrakePort ()
virtual double decelerationSoilFactor () const
virtual double calcSteeringForTurnInPlace ()
 calcSteering() calculates steering values for executing either a pivot or a (reverse) k turn.
virtual double calcThrottleForTurnInPlace ()
 calcThrottle() calculates throttle values for executing either a pivot or a (reverse) k turn.
virtual double calcBrakeForTurnInPlace ()
 If the vehicle can pivot, 0.0 is returned and otherwise a call to calcBrakeForKTurn() is returned.
virtual int calcGearForTurnInPlace ()
 calcGear() determines the correct gear setting for executing either a pivot or (reverse) k turn.
virtual double calcSteeringForPivot ()
 calcSteeringForPivot() determines an appropriate steering value for executing a pivot turn.
virtual double calcThrottleForPivot ()
 calcThrottleForPivot() determines an appropriate throttle value for executing a pivot turn.
virtual double calcSteeringForKTurn ()
 If the entity can not pivot, then this method can be used to calculate a steering value for a (reverse) k turn.
virtual double calcThrottleForKTurn ()
 If the entity can not pivot, then this method can be used to calculate a throttle value for a (reverse) k turn.
virtual double calcBrakeForKTurn ()
 If kTurnReverseComplete() returns true but the entity is still moving backwards, this function sets the brakes to 1.0 until the entity comes to a complete stop.
virtual double findSpeedForKTurn ()
 If the entity is in the reverse phase of the k turn, the maximum reverse speed of the vehicle is returned.
virtual double findHeadingForKTurn ()
 If the entity is in the reverse phase of the k turn, kTurnReverseGoalHeading() is returned, otherwise headingToTurnTo() is returned.
virtual void setHeadingToTurnTo (double headingToTurnTo)
 Get/Set the heading we the entity has been tasked to turn to.
virtual double headingToTurnTo () const
virtual void setKTurnReverseGoalHeading (double kTurnReverseGoalHeading)
 Get/Set the heading that is halfway between the original heading and the heading to turn to.
virtual double kTurnReverseGoalHeading () const
virtual void setKTurnReverseComplete (bool kTurnReverseComplete)
 Get/set the flag that indicates whether or not the entity has completed first half of the turn maneuver (backing up until at kTurnReverseGoalHeading())
virtual bool kTurnReverseComplete () const

Protected Member Functions

virtual bool createPorts ()
 Overridden to create the automotive ports.
virtual bool createPortGroups ()
 Overridden to create myAutomotiveControlPortGroup.
virtual void lookupAndCacheProcessSR ()
 This function looks up a process state repository in the process state repository manager by name, and caches a pointer to it in

myProcessState.


virtual bool postAddComponentsInit ()
 Calls lookupAndCacheProcessSR(), to look up our process state repository after all of the components have been created and loaded.
virtual DtSoilFactorscurrentSoilFactors () const
virtual bool decideToGiveUpTask () const
 If the entity is attached and the target of the current task is not, give up on the task.

Protected Attributes

DtGroundVehicleStateRepositorymyGroundVehicleState
DtAutomotivePSRmyProcessState
 Pointer to a process state repository used to store state data associated with this component.
Ports and Port Groups
DtConstrainedAnalogOutputPortmyThrottlePort
 Output Port Name: throttle
Output Port Description:
Output Port Range: 0.
DtConstrainedAnalogOutputPortmySteeringPort
 Output Port Name: steering
Output Port Description:
Output Port Range: -1.0 to 1.0
Output Port Default Value:
Output Group Parent: automotive-control.
DtConstrainedAnalogOutputPortmyBrakePort
 Output Port Name: brake
Output Port Description:
Output Port Range: 0.
DtConstrainedIntegerOutputPortmyGearPort
 Output Port Name: gear
Output Port Description:
Output Port Range:
Output Port Default Value:
Output Group Parent: automotive-control.
DtBooleanOutputPortmyParkingBrakePort
 Output Port Name: parking-brake
Output Port Description:
Output Port Default Value: True
Output Group Parent: automotive-control.
DtOutputPortGroupmyAutomotiveControlPortGroup
 Output Port Group Name: automotive-control
Output Port Group Description: Collection of control output for automotive entity movement controllers.

Private Member Functions

 DtGroundAutoControllerComponent ()
 default constructor; not implemented
 DtGroundAutoControllerComponent (const DtGroundAutoControllerComponent &orig)
 copy constructor; not implemented
const
DtGroundAutoControllerComponent
operator= (const DtGroundAutoControllerComponent &orig)
 assignment operator; not implemented

Detailed Description

DtGroundAutoControllerComponent is a base controller that holds capabilitites common to all automotive controllers.

Uses Descriptor Type: DtComponentDescriptor

Examples

Constructor & Destructor Documentation

DtGroundAutoControllerComponent::DtGroundAutoControllerComponent ( 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; not implemented

copy constructor; not implemented


Member Function Documentation

virtual DtString DtGroundAutoControllerComponent::type ( ) const [virtual]
virtual void DtGroundAutoControllerComponent::clearTask ( ) [virtual]

Overridden to call deactive the port group when this controller completes a task.

Reimplemented from DtSingleTaskControllerComponent.

Reimplemented in DtGroundMoveAlongControllerComponent.

virtual double DtGroundAutoControllerComponent::approximateThrottle ( double  speed) [virtual]

We use this to approximate the correct throttle for a given speed, much like a real (experienced) driver does.

Reimplemented in BHAVE::DtBhaveMoveDirectionController.

virtual double DtGroundAutoControllerComponent::calculateSteering ( double  currentHeading,
double  desiredHeading 
) const [virtual]

These are called in init to create the ports used to communicate with the actuator.

virtual double DtGroundAutoControllerComponent::decelerationSoilFactor ( ) const [virtual]

calcSteering() calculates steering values for executing either a pivot or a (reverse) k turn.

An outside automotive controller could use this function in conjunction with calcThrottle() and calcGear() to effect turns as part of some other maneuver. An outside caller can ignore the last 2 arguments if it knows the entity is pivot-capable.

calcThrottle() calculates throttle values for executing either a pivot or a (reverse) k turn.

An outside caller can ignore the last argument if it knows the entity is pivot-capable.

If the vehicle can pivot, 0.0 is returned and otherwise a call to calcBrakeForKTurn() is returned.

calcGear() determines the correct gear setting for executing either a pivot or (reverse) k turn.

So that it may be used from outside the controller, a writable flag is passed to indicate whether, in the case of a k turn being executed, the first part of the maneuver has been completed. The tick() method calls this routine using the myProcessState->myKTurnReverseComplete member, but outside callers should maintain this value across simulation frames.

calcSteeringForPivot() determines an appropriate steering value for executing a pivot turn.

This is called by calcSteering() for pivot-capable entities

calcThrottleForPivot() determines an appropriate throttle value for executing a pivot turn.

This is called by calcThrottle() for pivot-capable entities

If the entity can not pivot, then this method can be used to calculate a steering value for a (reverse) k turn.

It is called by calcSteering() for non-pivot capable entities.

If the entity can not pivot, then this method can be used to calculate a throttle value for a (reverse) k turn.

It is called by calcThrottle() for non-pivot capable entities.

If kTurnReverseComplete() returns true but the entity is still moving backwards, this function sets the brakes to 1.0 until the entity comes to a complete stop.

If the entity is in the reverse phase of the k turn, the maximum reverse speed of the vehicle is returned.

If the entity has turned far enough in reverse and needs to begin braking, 0.0 is returned. Otherwise if the entity has completed the reverse phase, the ordered speed of the entity is returned.

If the entity is in the reverse phase of the k turn, kTurnReverseGoalHeading() is returned, otherwise headingToTurnTo() is returned.

virtual void DtGroundAutoControllerComponent::setHeadingToTurnTo ( double  headingToTurnTo) [virtual]

Get/Set the heading we the entity has been tasked to turn to.

virtual double DtGroundAutoControllerComponent::headingToTurnTo ( ) const [virtual]
virtual void DtGroundAutoControllerComponent::setKTurnReverseGoalHeading ( double  kTurnReverseGoalHeading) [virtual]

Get/Set the heading that is halfway between the original heading and the heading to turn to.

This is only used fore entities that are not pivot capable.

virtual void DtGroundAutoControllerComponent::setKTurnReverseComplete ( bool  kTurnReverseComplete) [virtual]

Get/set the flag that indicates whether or not the entity has completed first half of the turn maneuver (backing up until at kTurnReverseGoalHeading())

virtual bool DtGroundAutoControllerComponent::createPorts ( ) [protected, virtual]
virtual bool DtGroundAutoControllerComponent::createPortGroups ( ) [protected, virtual]

Overridden to create myAutomotiveControlPortGroup.

Reimplemented from DtSimComponent.

Reimplemented in DtGroundMoveToDestinationControllerComponent, DtGroundCollisionAvoidanceController, and DtGroundMoveDirectionController.

virtual void DtGroundAutoControllerComponent::lookupAndCacheProcessSR ( ) [protected, virtual]

This function looks up a process state repository in the process state repository manager by name, and caches a pointer to it in

myProcessState.

The name (if it exists) is given in the component descriptor (DtComponentDescriptor::processStateRepositoryName). If the name does not exist, it uses the appropriate default name defined in procSRTypes.h. Another component is responsible for creating and destroying the process state repository.

Calls lookupAndCacheProcessSR(), to look up our process state repository after all of the components have been created and loaded.

Reimplemented from DtSimComponent.

virtual DtSoilFactors* DtGroundAutoControllerComponent::currentSoilFactors ( ) const [protected, virtual]
virtual bool DtGroundAutoControllerComponent::decideToGiveUpTask ( ) const [protected, virtual]

If the entity is attached and the target of the current task is not, give up on the task.

Reimplemented from DtSingleTaskControllerComponent.

Reimplemented in DtGroundMoveToDestinationControllerComponent, DtGroundMoveAlongControllerComponent, and DerivedMoveToController.

const DtGroundAutoControllerComponent& DtGroundAutoControllerComponent::operator= ( const DtGroundAutoControllerComponent orig) [private]

assignment operator; not implemented


Member Data Documentation

Output Port Name: throttle
Output Port Description:
Output Port Range: 0.

to 1.
Output Port Default Value:
Output Group Parent: automotive-control

Output Port Name: steering
Output Port Description:
Output Port Range: -1.0 to 1.0
Output Port Default Value:
Output Group Parent: automotive-control.

Output Port Name: brake
Output Port Description:
Output Port Range: 0.

to 1.
Output Port Default Value:
Output Group Parent: automotive-control

Output Port Name: gear
Output Port Description:
Output Port Range:
Output Port Default Value:
Output Group Parent: automotive-control.

Output Port Name: parking-brake
Output Port Description:
Output Port Default Value: True
Output Group Parent: automotive-control.

Output Port Group Name: automotive-control
Output Port Group Description: Collection of control output for automotive entity movement controllers.

Pointer to a process state repository used to store state data associated with this component.

This process state repository is shared with other components. Another component is responsible for creating and destroying the process state repository. This state is saved and restored as part of a scenario (or checkpoint).


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)