VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Classes | Public Member Functions | Protected Attributes
DtGroundMoveToObstacleAvoider Class Reference

Classes

struct  AvoiderStatus
 
struct  EntityObstacleData
 
struct  FeatureObstacleData
 
struct  FeatureObstacleEdge
 
class  SpeedConstraint
 
struct  SpeedInterval
 

Public Types

Speed Constraints

Classes to represent the allowed speeds at a given heading.

typedef std::list< SpeedIntervalIntervalList
 

Public Member Functions

 DtGroundMoveToObstacleAvoider (const DtSimulationServices *simsvc, const DtLocalObject *hostEntity, const DtGroundMoveToDestinationControllerComponent *parentCtrlr)
 
virtual ~DtGroundMoveToObstacleAvoider ()
 

Protected Member Functions

Behavior Constants

These functions define constants that affect various avoidance decisions. Override to change behavior.

virtual double maxOffroadSpeed () const
 
virtual double lookaheadTime () const
 
Right of Way Rules
virtual bool shouldYieldToRight ()
 
virtual bool shouldYieldToLeft ()
 
Get Obstacles

Functions to gather obstacles each tick.

virtual void provideDynamicObstacles (std::list< struct EntityObstacleData > &vehicles)
 
virtual void computeEntityObstacleData (const DtSimObjectReference &obj, EntityObstacleData &entityObstacleData)
 
virtual void provideStaticObstacles (std::list< struct FeatureObstacleData > &walls)
 
virtual void testAndSetClockwiseOrdering (FeatureObstacleData &obstacle)
 
virtual void setInitialObstacleEdgeHeadings (FeatureObstacleData &obstacle) const
 
virtual void setIsFacingEntity (FeatureObstacleData &obstacle, const DtVector &entityLocation)
 
virtual DtExtent makeDynamicObstacleSearchArea (const DtVector &localGoal)
 
virtual
MAKVRinTerra::DtFeatureGeometry::Area 
makeStaticObstacleSearchArea (const DtVector &localGoal)
 
Processing Obstacles.

Functions that examine obstacles and produce speed constraints, then call evaluation functions to find the best speed and a score for it.

virtual void computeFinalAction (const std::list< struct EntityObstacleData > &vehicles, const std::list< struct FeatureObstacleData > &walls, const double desiredHeading, const double desiredSpeed, double &outHeading, double &outSpeed, AvoiderStatus &status)
 
virtual double computeSpeedAndScoreForPathHeading (const double pathHeading, double refHeading, SpeedConstraint &refConstraint, const bool maybeYieldRow, const std::list< struct EntityObstacleData > &vehicles, const std::list< struct FeatureObstacleData > &walls, const double desiredSpeed, const double desiredHeading, double &outSpeed, SpeedConstraint &resultConstraint)
 
virtual double computeSpeedAndScoreForStraightAhead (const std::list< struct EntityObstacleData > &vehicles, const std::list< struct FeatureObstacleData > &walls, const double desiredSpeed, const double desiredHeading, SpeedConstraint &outConstraint, double &outSpeed)
 
virtual SpeedConstraint computeSpeedConstraintFromDynamicObstacle (const double originOffset, const double ownHalfWidth, const double ownHalfLength, const EntityObstacleData &obstacle, bool leftTurn, bool rightTurn, const double cornerBufferWidth)
 
virtual SpeedConstraint computeSpeedConstraintFromStaticObstacle (const double originOffset, const double ownHalfWidth, const double ownHalfLength, const FeatureObstacleData &obstacle, bool leftTurn, bool rightTurn, const double cornerBufferWidth)
 
Scoring Functions.

These functions compute a score for a given speed and heading so that actions can be compared against one another.

virtual double actionScore (const SpeedConstraint &constrainedAction, const double desiredHeading, const double desiredSpeed, double &speedForBestScore)
 
virtual void updateBestScoreAndSpeed (double &bestScore, double &bestSpeed, const double speed, const double heading, const double desiredSpeed, const double desiredHeading, const bool applyYield=false, const bool isStatic=false)
 
virtual double combinedScore (const double speed, const double heading, const double desiredSpeed, const double desiredHeading, const bool yieldTo=false, const bool isStatic=false)
 
virtual double speedGreaterThanDesiredScore (const double speed, const double heading, const double desiredSpeed, const double desiredHeading)
 
virtual double speedLessThanDesiredScore (const double speed, const double heading, const double desiredSpeed, const double desiredHeading)
 
virtual double speedInDesiredDirectionScore (const double speed, const double heading, const double desiredSpeed, const double desiredHeading)
 
virtual double speedLessThanFeasibleScore (const double speed, const double heading, const double desiredSpeed, const double desiredHeading)
 
virtual double speedGreaterThanFeasibleScore (const double speed, const double heading, const double desiredSpeed, const double desiredHeading)
 
virtual double headingInDesiredDirectionScore (const double speed, const double heading, const double desiredSpeed, const double desiredHeading)
 
virtual double yieldToScore (const double speed, const double heading, const double desiredSpeed, const double desiredHeading)
 
Utilities
virtual void computeBodyTransform ()
 
virtual void computeHorizontalRotation (const double angle, DtDcm &rot)
 
virtual void markVehiclesWithRightOfWay (const double desiredHeading, const std::list< struct EntityObstacleData > &vehicles)
 
virtual double maxSpeedForPassBehind (const double timeLimit, const double distance)
 
virtual double minSpeedForPassAhead (const double timeLimit, const double distance)
 
virtual double minTurnRadiusForCurrentSpeed () const
 
virtual double maxAccelerationForSpeed ()
 
virtual double maxTractionForConditions ()
 
virtual double highestFeasibleSpeed () const
 
virtual void setHighestFeasibleSpeed (const double s)
 
virtual double lowestFeasibleSpeed () const
 
virtual void setLowestFeasibleSpeed (const double s)
 

Protected Attributes

std::set< DtSimObjectReferencemyVehiclesToYieldTo
 
std::list< DtSimObjectReferencemyCachedEntityObstacles
 
double myLastEntityQueryTime
 
bool myWasEmbarked
 
std::shared_ptr
< MAKVRinTerra::DtFeatureSet
myObstacleFeatureSet
 
DtVector myLastObstacleSearchLocation
 
double myLastObstacleSearchHeading
 
bool myHaveAskedForFeatureObstacles
 
bool myHaveLoadedFeatureObstacles
 
std::list< FeatureObstacleDatamyCachedFeatureObstacles
 
DtCoordTransform myLocalToHorizontalBody
 
bool myDebug
 
DtSimObjectReference myKeyVehicleObstacle
 
bool myIsObstacleWall
 
DtChord myKeyWallObstacle
 
DtExtent myDynamicObstacleSearchArea
 
MAKVRinTerra::DtFeatureGeometry::PointVector myStaticObstacleSearchArea
 
Global context information
const DtSimulationServicesmySimulationServices
 
const DtLocalObjectmyEntity
 
const
DtGroundMoveToDestinationControllerComponent
myParentController
 
const
DtGroundVehicleStateRepository
myVehicleState
 
DtVector myLocalDestination
 
bool myIsGoingBackwards
 

Computed at the beginning of each use of the avoider:

double myLateralAccelerationLimit
 
double myAccelerationLimit
 
double myBrakingLimit
 
double myHighestFeasibleSpeedNow
 
double myLowestFeasibleSpeedNow
 
double myMaxSpeedForMinTurnRadius
 
double myCurrentAltitude
 
double mySpeed
 
double myHeading
 

Public API

Main interface for parent controller

enum  AvoiderStatusTypeValue {
  avoiderNotActive = 0, avoiderNoObstacles = 1, avoiderAvoiding = 2, avoiderStoppedForMovingObstacle = 3,
  avoiderStoppedForStaticObstacle = 4
}
 
enum  ObstacleType { obstacleStatic = 0, obstacleDynamic = 1 }
 
std::string avoiderStatusString (enum AvoiderStatusTypeValue)
 
virtual void steeringAndSpeedThroughObstacles (const DtVector &localGoalPosition, const double desiredImmediateHeading, const double desiredSpeed, const double desiredAccelLimit, double &desiredHeadingOut, double &desiredSpeedOut, AvoiderStatus &avoiderStatus, const bool debug=false)
 
virtual void searchAreaVisualization (std::vector< DtVector > &boundary)
 
virtual void staticObstacleVisualization (std::vector< std::vector< DtVector >> &walls)
 
virtual void dynamicObstacleVisualization (DtExtent &extent)
 

Obstacle Gathering Utilities

virtual bool isNotSelf (const DtSimObject *obj)
 
virtual bool isNotBehind (const DtSimObject *obj)
 
virtual bool isNotEmbarkedOnDifferentParent (const DtSimObject *obj)
 
virtual bool doesNotOverlapInAltitude (const DtSimObject *obj)
 
virtual DtCompositePredicate dynamicObstaclePredicate ()
 
virtual void putFeatureInCache (const MAKVRinTerra::DtFeature &f)
 
static bool ignoreSelfFilterFcn (const DtSimObject *obj, void *usr)
 
static bool ignoreBehindFilterFcn (const DtSimObject *obj, void *usr)
 
static bool ignoreEmbarkedOnDifferentParentFcn (const DtSimObject *obj, void *usr)
 
static bool ignoreDifferentAltitudeFcn (const DtSimObject *obj, void *usr)
 

Member Typedef Documentation

Member Enumeration Documentation

Called each tick of the parent controller to provide steering and speed, given the goal and considering obstacles.

Parameters
localGoalPositionThe goal location in local coordinates. This is used to allow the avoider to make sure that obstacle space buffers don't unnecessarily keep the vehicle from reaching the goal.
desiredImmediateHeadingThe heading desired this tick. Often this will be the heading to the goal position, but the caller may instead want to move the entity back toward a line or something.
desiredSpeedThe desired unrestricted speed (e.g. ordered speed).
desiredLatAccelLimitLateral acceleration limit to use when considering turning maneuvers.
desiredHeadingOutThe output heading to turn to.
desiredSpeedOutThe output speed. This is usually an upper bound, but a maneuver to pass in front of another vehicle may require driving this speed. If the vehicle is moving in reverse, this will still be a positive value.
Enumerator
avoiderNotActive 
avoiderNoObstacles 
avoiderAvoiding 
avoiderStoppedForMovingObstacle 
avoiderStoppedForStaticObstacle 

Called each tick of the parent controller to provide steering and speed, given the goal and considering obstacles.

Parameters
localGoalPositionThe goal location in local coordinates. This is used to allow the avoider to make sure that obstacle space buffers don't unnecessarily keep the vehicle from reaching the goal.
desiredImmediateHeadingThe heading desired this tick. Often this will be the heading to the goal position, but the caller may instead want to move the entity back toward a line or something.
desiredSpeedThe desired unrestricted speed (e.g. ordered speed).
desiredLatAccelLimitLateral acceleration limit to use when considering turning maneuvers.
desiredHeadingOutThe output heading to turn to.
desiredSpeedOutThe output speed. This is usually an upper bound, but a maneuver to pass in front of another vehicle may require driving this speed. If the vehicle is moving in reverse, this will still be a positive value.
Enumerator
obstacleStatic 
obstacleDynamic 

Constructor & Destructor Documentation

DtGroundMoveToObstacleAvoider::DtGroundMoveToObstacleAvoider ( const DtSimulationServices simsvc,
const DtLocalObject hostEntity,
const DtGroundMoveToDestinationControllerComponent parentCtrlr 
)
virtual DtGroundMoveToObstacleAvoider::~DtGroundMoveToObstacleAvoider ( )
virtual

destructor

Member Function Documentation

std::string DtGroundMoveToObstacleAvoider::avoiderStatusString ( enum  AvoiderStatusTypeValue)

Called each tick of the parent controller to provide steering and speed, given the goal and considering obstacles.

Parameters
localGoalPositionThe goal location in local coordinates. This is used to allow the avoider to make sure that obstacle space buffers don't unnecessarily keep the vehicle from reaching the goal.
desiredImmediateHeadingThe heading desired this tick. Often this will be the heading to the goal position, but the caller may instead want to move the entity back toward a line or something.
desiredSpeedThe desired unrestricted speed (e.g. ordered speed).
desiredLatAccelLimitLateral acceleration limit to use when considering turning maneuvers.
desiredHeadingOutThe output heading to turn to.
desiredSpeedOutThe output speed. This is usually an upper bound, but a maneuver to pass in front of another vehicle may require driving this speed. If the vehicle is moving in reverse, this will still be a positive value.
virtual void DtGroundMoveToObstacleAvoider::steeringAndSpeedThroughObstacles ( const DtVector &  localGoalPosition,
const double  desiredImmediateHeading,
const double  desiredSpeed,
const double  desiredAccelLimit,
double desiredHeadingOut,
double desiredSpeedOut,
AvoiderStatus avoiderStatus,
const bool  debug = false 
)
virtual

Called each tick of the parent controller to provide steering and speed, given the goal and considering obstacles.

Parameters
localGoalPositionThe goal location in local coordinates. This is used to allow the avoider to make sure that obstacle space buffers don't unnecessarily keep the vehicle from reaching the goal.
desiredImmediateHeadingThe heading desired this tick. Often this will be the heading to the goal position, but the caller may instead want to move the entity back toward a line or something.
desiredSpeedThe desired unrestricted speed (e.g. ordered speed).
desiredLatAccelLimitLateral acceleration limit to use when considering turning maneuvers.
desiredHeadingOutThe output heading to turn to.
desiredSpeedOutThe output speed. This is usually an upper bound, but a maneuver to pass in front of another vehicle may require driving this speed. If the vehicle is moving in reverse, this will still be a positive value.
virtual void DtGroundMoveToObstacleAvoider::searchAreaVisualization ( std::vector< DtVector > &  boundary)
virtual

Fills in boundary with the vertices (world coordinates) of the search area.

virtual void DtGroundMoveToObstacleAvoider::staticObstacleVisualization ( std::vector< std::vector< DtVector >> &  walls)
virtual

Fills in walls with the vertices (world coordinates) of the walls currently in use.

virtual void DtGroundMoveToObstacleAvoider::dynamicObstacleVisualization ( DtExtent extent)
virtual

Called each tick of the parent controller to provide steering and speed, given the goal and considering obstacles.

Parameters
localGoalPositionThe goal location in local coordinates. This is used to allow the avoider to make sure that obstacle space buffers don't unnecessarily keep the vehicle from reaching the goal.
desiredImmediateHeadingThe heading desired this tick. Often this will be the heading to the goal position, but the caller may instead want to move the entity back toward a line or something.
desiredSpeedThe desired unrestricted speed (e.g. ordered speed).
desiredLatAccelLimitLateral acceleration limit to use when considering turning maneuvers.
desiredHeadingOutThe output heading to turn to.
desiredSpeedOutThe output speed. This is usually an upper bound, but a maneuver to pass in front of another vehicle may require driving this speed. If the vehicle is moving in reverse, this will still be a positive value.
virtual double DtGroundMoveToObstacleAvoider::maxOffroadSpeed ( ) const
inlineprotectedvirtual

The maximum assumed speed while driving off road. This affects the search distance for dynamic obstacles. Default value: 20.0 m/s.

virtual double DtGroundMoveToObstacleAvoider::lookaheadTime ( ) const
inlineprotectedvirtual

The amount of time to lookahead. This affects the search distance for all obstacles. Note that the time required to slow to a stop is spd/accel; consider the max speed above and a gentle deceleration of 3-5mps. Default value: 10.0 s.

virtual bool DtGroundMoveToObstacleAvoider::shouldYieldToRight ( )
inlineprotectedvirtual

Indicates if yield-to-right is in effect. Ownship should yield (within reason) to vehicle obstacles approaching from the right. Takes priority if this and yield-to-left are in effect. TODO – not currently used.

virtual bool DtGroundMoveToObstacleAvoider::shouldYieldToLeft ( )
inlineprotectedvirtual

Indicates if yield-to-left is in effect. Ownship should yield (within reason) to vehicle obstacles approaching from the left. TODO – not currently used.

virtual void DtGroundMoveToObstacleAvoider::provideDynamicObstacles ( std::list< struct EntityObstacleData > &  vehicles)
protectedvirtual

Get the vehicle (dynamic) obstacles for the avoidance algorithm.

virtual void DtGroundMoveToObstacleAvoider::computeEntityObstacleData ( const DtSimObjectReference obj,
EntityObstacleData entityObstacleData 
)
protectedvirtual

Get the vehicle (dynamic) obstacles for the avoidance algorithm.

virtual void DtGroundMoveToObstacleAvoider::provideStaticObstacles ( std::list< struct FeatureObstacleData > &  walls)
protectedvirtual

Get the feature (static) obstacles for the avoidance algorithm.

virtual void DtGroundMoveToObstacleAvoider::testAndSetClockwiseOrdering ( FeatureObstacleData obstacle)
protectedvirtual

Determines if the vertices of an obstacle (assumed to be a closed area) are in clockwise order or not, and if not, reversed them (i.e. clockwise when viewed from above).

virtual void DtGroundMoveToObstacleAvoider::setInitialObstacleEdgeHeadings ( FeatureObstacleData obstacle) const
protectedvirtual

Get the vehicle (dynamic) obstacles for the avoidance algorithm.

virtual void DtGroundMoveToObstacleAvoider::setIsFacingEntity ( FeatureObstacleData obstacle,
const DtVector &  entityLocation 
)
protectedvirtual

Get the vehicle (dynamic) obstacles for the avoidance algorithm.

virtual DtExtent DtGroundMoveToObstacleAvoider::makeDynamicObstacleSearchArea ( const DtVector &  localGoal)
protectedvirtual

Compute the area in which to search for moving obstacles. This function uses a defined constant for the maximum speed at which a moving obstacle can be moving. It uses the ownship location and orientation to compute the search area.

Parameters
localGoalLocal coordinates of destination.
Returns
An area feature geometry describing the search area.
virtual MAKVRinTerra::DtFeatureGeometry::Area DtGroundMoveToObstacleAvoider::makeStaticObstacleSearchArea ( const DtVector &  localGoal)
protectedvirtual

Compute the area in which to search for static obstacles. This area will likely be different than the one for moving obstacles because all of these obstacles are stationary, i.e. they cannot be moving toward this vehicle.

Parameters
localGoalLocal coordinates of destination.
Returns
An area feature geometry describing the search area.
virtual bool DtGroundMoveToObstacleAvoider::isNotSelf ( const DtSimObject obj)
protectedvirtual

This also ignores an object if it is the parent of the entity.

virtual bool DtGroundMoveToObstacleAvoider::isNotBehind ( const DtSimObject obj)
protectedvirtual

This also ignores an object if it is the parent of the entity.

virtual bool DtGroundMoveToObstacleAvoider::isNotEmbarkedOnDifferentParent ( const DtSimObject obj)
protectedvirtual

This also ignores an object if it is the parent of the entity.

virtual bool DtGroundMoveToObstacleAvoider::doesNotOverlapInAltitude ( const DtSimObject obj)
protectedvirtual

This also ignores an object if it is the parent of the entity.

static bool DtGroundMoveToObstacleAvoider::ignoreSelfFilterFcn ( const DtSimObject obj,
void *  usr 
)
staticprotected

This also ignores an object if it is the parent of the entity.

static bool DtGroundMoveToObstacleAvoider::ignoreBehindFilterFcn ( const DtSimObject obj,
void *  usr 
)
staticprotected

This also ignores an object if it is the parent of the entity.

static bool DtGroundMoveToObstacleAvoider::ignoreEmbarkedOnDifferentParentFcn ( const DtSimObject obj,
void *  usr 
)
staticprotected

This also ignores an object if it is the parent of the entity.

static bool DtGroundMoveToObstacleAvoider::ignoreDifferentAltitudeFcn ( const DtSimObject obj,
void *  usr 
)
staticprotected

This also ignores an object if it is the parent of the entity.

virtual DtCompositePredicate DtGroundMoveToObstacleAvoider::dynamicObstaclePredicate ( )
protectedvirtual

This also ignores an object if it is the parent of the entity.

virtual void DtGroundMoveToObstacleAvoider::putFeatureInCache ( const MAKVRinTerra::DtFeature f)
protectedvirtual

Visitor function for features in myObstacleFeatureSet that puts them into a list of FeatureObstacleData.

virtual void DtGroundMoveToObstacleAvoider::computeFinalAction ( const std::list< struct EntityObstacleData > &  vehicles,
const std::list< struct FeatureObstacleData > &  walls,
const double  desiredHeading,
const double  desiredSpeed,
double outHeading,
double outSpeed,
AvoiderStatus status 
)
protectedvirtual

Analyzes obstacles and determines the best steering and speed through them.

Parameters
vehiclesA list of EntityObstacleData, with offset, velocity, and relativeHeading values referenced to the ownship location and heading. The relativeHeading for each obstacle has already been flipped 180 degrees if the vehicle is moving in reverse.
wallsSimilarly for feature obstacle data.
desiredHeadingThe absolute heading desired.
desiredSpeedThe speed desired for the ownship, e.g. ordered speed.
outHeadingThe heading of the best computed action.
outSpeedThe speed of the best computed action.
virtual double DtGroundMoveToObstacleAvoider::computeSpeedAndScoreForPathHeading ( const double  pathHeading,
double  refHeading,
SpeedConstraint refConstraint,
const bool  maybeYieldRow,
const std::list< struct EntityObstacleData > &  vehicles,
const std::list< struct FeatureObstacleData > &  walls,
const double  desiredSpeed,
const double  desiredHeading,
double outSpeed,
SpeedConstraint resultConstraint 
)
protectedvirtual

Computes the speed and a "score" for a path at a given heading from the ownship (refHeading). The function transforms all of the obstacle data to the frame of reference of the pathHeading and computes and merges SpeedConstraints for each obstacle. It returns the best score for this pathHeading, and the speed corresponding to that score.

Parameters
pathHeadingThe desired heading for the path.
refHeadingThe heading of the vehicle. This parameter allows the function to determine how much of a turn this pathHeading represents.
refConstraintThe constraint already computed for movement in the refHeading direction. This includes a clear distance in the refHeading direction and speed constraints to avoid any conflict area.
vehiclesA list of EntityObstacleData, where the offsets and velocities are relative to the [ownship] origin and the refHeading.
wallsSimilarly, for FeatureObstacleData.
desiredSpeedThe ideal speed (ordered or task speed).
outSpeedAn output parameter to hold the best speed, corresponding to the return score value.
resultConstraintThe final constraint used to select the outSpeed, using the scoring functions. This output is provided to allow the caller to determine if other speeds were possible, and to see what obstacle was the forcing one for the constraint.
Returns
A score for the given heading; the speed for that score is returned in outSpeed.
virtual double DtGroundMoveToObstacleAvoider::computeSpeedAndScoreForStraightAhead ( const std::list< struct EntityObstacleData > &  vehicles,
const std::list< struct FeatureObstacleData > &  walls,
const double  desiredSpeed,
const double  desiredHeading,
SpeedConstraint outConstraint,
double outSpeed 
)
protectedvirtual

Like #computerSpeedAndScoreForPathHeading, but fixed for a path heading that is straight ahead for the ownship. Returns a SpeedConstraint that can be used for later computation.

Parameters
vehiclesA list of EntityObstacleData, where the offsets and velocities are relative to the [ownship] origin and heading.
wallsSimilarly, for FeatureObstacleData.
outSpeedThe best speed to use going straight ahead.
outConstraintThe speed constraints for going straight ahead.
Returns
A score for going straight ahead at outSpeed.
virtual SpeedConstraint DtGroundMoveToObstacleAvoider::computeSpeedConstraintFromDynamicObstacle ( const double  originOffset,
const double  ownHalfWidth,
const double  ownHalfLength,
const EntityObstacleData obstacle,
bool  leftTurn,
bool  rightTurn,
const double  cornerBufferWidth 
)
protectedvirtual

Compute the constraints set by one dynamic obstacle. Given the ownship's speed along the (body) +x axis, determine if the obstacle will intersect the ownship and when; compute a speed below which the ownship will pass behind the obstacle and a speed above which the ownship will pass in front of the obstacle. This generates a SpeedConstraint. SpeedConstraints for all obstacles are merged to return the final one.

Parameters
originOffsetThis computation may be at an angle to the ownship's heading, requiring a turn along an arc. If two tangents are drawn to this arc, one at the ownship heading and one at a desired path heading, they will intersect at a point some distance in front of the ownship. This parameter is the distance to that intersection. This intersection point is the origin of the coordinate system that the obstacle positions are given in.
cornerBufferWidthIf the obstacle is close enough that it is along the curve that ownship would follow to turn to this path, then this function should check to see if the obstacle is along the curve. The curve cuts inside of the corner formed by the ownship x axis and the angled path line. This parameter defines how far inside the corner the curve cuts.
leftTurnand rightTurn indicate whether the path angles left or right from the ownship x axis. The cornerBufferWidth is applied to the inside of the turn.
Returns
A SpeedConstraint with the pass ahead and behind speed limits, plus the clear distance from the ownship to the conflict area. This distance includes the originOffset but not the length of the ownship.
virtual SpeedConstraint DtGroundMoveToObstacleAvoider::computeSpeedConstraintFromStaticObstacle ( const double  originOffset,
const double  ownHalfWidth,
const double  ownHalfLength,
const FeatureObstacleData obstacle,
bool  leftTurn,
bool  rightTurn,
const double  cornerBufferWidth 
)
protectedvirtual

This function is similar to the one for dynamic obstacles, except that the obstacle is made up of a set of static line segments instead of bounding volumes. Segments that do not face the ownship are ignored.

virtual double DtGroundMoveToObstacleAvoider::actionScore ( const SpeedConstraint constrainedAction,
const double  desiredHeading,
const double  desiredSpeed,
double speedForBestScore 
)
protectedvirtual

Combining Functions

Compute a score for a given SpeedConstraint, i.e. constrained speed intervals at a certain heading. Applies the scoring functions to the intervals. Note that since the scoring functions are (currently) linear functions of speed, only the interval end points need be scored. In addition to the interval end points in the constraint, this function computes scores at the desired speed and the minimum and maximum feasible speeds.

virtual void DtGroundMoveToObstacleAvoider::updateBestScoreAndSpeed ( double bestScore,
double bestSpeed,
const double  speed,
const double  heading,
const double  desiredSpeed,
const double  desiredHeading,
const bool  applyYield = false,
const bool  isStatic = false 
)
protectedvirtual

Computes the score for the given speed and heading using combinedScore, and then updates bestScore and bestSpeed if the resulting score is better than combinedScore.

Parameters
applyYieldA flag to indicate that the speed/heading input corresponds to a moving obstacle that has right of way.
isStaticA flag to indicate that speed/heading input corresponds to a static obstacle.
bestScoreIn/out parameter
bestSpeedOutput parameter; changed only if the computed score is better than the bestScore input.
virtual double DtGroundMoveToObstacleAvoider::combinedScore ( const double  speed,
const double  heading,
const double  desiredSpeed,
const double  desiredHeading,
const bool  yieldTo = false,
const bool  isStatic = false 
)
protectedvirtual

Adds all of the scoring functions. Simply adds together the scoring functions. To add a new scoring function in a plugin, override this function to add a new score, then add the result of the base combinedScore.

virtual double DtGroundMoveToObstacleAvoider::speedGreaterThanDesiredScore ( const double  speed,
const double  heading,
const double  desiredSpeed,
const double  desiredHeading 
)
protectedvirtual

Functions To Compute Individual Speed-Heading Scores

These functions should be linear in speed.

virtual double DtGroundMoveToObstacleAvoider::speedLessThanDesiredScore ( const double  speed,
const double  heading,
const double  desiredSpeed,
const double  desiredHeading 
)
protectedvirtual

Combining Functions

Compute a score for a given SpeedConstraint, i.e. constrained speed intervals at a certain heading. Applies the scoring functions to the intervals. Note that since the scoring functions are (currently) linear functions of speed, only the interval end points need be scored. In addition to the interval end points in the constraint, this function computes scores at the desired speed and the minimum and maximum feasible speeds.

virtual double DtGroundMoveToObstacleAvoider::speedInDesiredDirectionScore ( const double  speed,
const double  heading,
const double  desiredSpeed,
const double  desiredHeading 
)
protectedvirtual

Combining Functions

Compute a score for a given SpeedConstraint, i.e. constrained speed intervals at a certain heading. Applies the scoring functions to the intervals. Note that since the scoring functions are (currently) linear functions of speed, only the interval end points need be scored. In addition to the interval end points in the constraint, this function computes scores at the desired speed and the minimum and maximum feasible speeds.

virtual double DtGroundMoveToObstacleAvoider::speedLessThanFeasibleScore ( const double  speed,
const double  heading,
const double  desiredSpeed,
const double  desiredHeading 
)
protectedvirtual

Combining Functions

Compute a score for a given SpeedConstraint, i.e. constrained speed intervals at a certain heading. Applies the scoring functions to the intervals. Note that since the scoring functions are (currently) linear functions of speed, only the interval end points need be scored. In addition to the interval end points in the constraint, this function computes scores at the desired speed and the minimum and maximum feasible speeds.

virtual double DtGroundMoveToObstacleAvoider::speedGreaterThanFeasibleScore ( const double  speed,
const double  heading,
const double  desiredSpeed,
const double  desiredHeading 
)
protectedvirtual

Combining Functions

Compute a score for a given SpeedConstraint, i.e. constrained speed intervals at a certain heading. Applies the scoring functions to the intervals. Note that since the scoring functions are (currently) linear functions of speed, only the interval end points need be scored. In addition to the interval end points in the constraint, this function computes scores at the desired speed and the minimum and maximum feasible speeds.

virtual double DtGroundMoveToObstacleAvoider::headingInDesiredDirectionScore ( const double  speed,
const double  heading,
const double  desiredSpeed,
const double  desiredHeading 
)
protectedvirtual

Combining Functions

Compute a score for a given SpeedConstraint, i.e. constrained speed intervals at a certain heading. Applies the scoring functions to the intervals. Note that since the scoring functions are (currently) linear functions of speed, only the interval end points need be scored. In addition to the interval end points in the constraint, this function computes scores at the desired speed and the minimum and maximum feasible speeds.

virtual double DtGroundMoveToObstacleAvoider::yieldToScore ( const double  speed,
const double  heading,
const double  desiredSpeed,
const double  desiredHeading 
)
protectedvirtual

Combining Functions

Compute a score for a given SpeedConstraint, i.e. constrained speed intervals at a certain heading. Applies the scoring functions to the intervals. Note that since the scoring functions are (currently) linear functions of speed, only the interval end points need be scored. In addition to the interval end points in the constraint, this function computes scores at the desired speed and the minimum and maximum feasible speeds.

virtual void DtGroundMoveToObstacleAvoider::computeBodyTransform ( )
protectedvirtual

Computes the coordinate transforms for the calculations this tick. Fills in myLocalToHorizBodyXform.

virtual void DtGroundMoveToObstacleAvoider::computeHorizontalRotation ( const double  angle,
DtDcm &  rot 
)
protectedvirtual

Computes a 2D rotation matrix that can be used to pre-multiply a topo coordinate to make it relative to an angle. I.e., if V(x,y) is a topo vector with the given xy values, matrix * V = V'(x',y') is a vector in a coordinate system that is rotated by angle from topo.

virtual void DtGroundMoveToObstacleAvoider::markVehiclesWithRightOfWay ( const double  desiredHeading,
const std::list< struct EntityObstacleData > &  vehicles 
)
protectedvirtual

Mark vehicle obstacle in myVehiclesToYieldTo based on whether they are approaching the desired heading line from the side that has right of way.

virtual double DtGroundMoveToObstacleAvoider::maxSpeedForPassBehind ( const double  timeLimit,
const double  distance 
)
protectedvirtual

Computes the maximum speed the ownship can drive and still pass behind a moving obstacle at the given distance. Uses myBrakingLimit. The implementation does not use the timeLimit, because the fastest speed possible is achieved by going fast, decelerating at myBrakingLimit, and stopping at distance before the timeLimit. Other approaches are possible though.

virtual double DtGroundMoveToObstacleAvoider::minSpeedForPassAhead ( const double  timeLimit,
const double  distance 
)
protectedvirtual

Computes the minimum speed the ownship can drive and still pass ahead of a moving obstacle. This is just an estimate, as several factors are unknown or difficult to calculate. For example, the ownship will take some time to accelerate, and its acceleration ability is reduced as speed increases. This function computes the minimum speed such that if the ownship accelerates at myAccelerationLimit for timeLimit, it will go distance, which is the minimum distance it has to go in timeLimit.

virtual double DtGroundMoveToObstacleAvoider::minTurnRadiusForCurrentSpeed ( ) const
protectedvirtual

Computes the turn radius to use for turns in collision avoidance computations. Implicitly uses the current speed and the lateral acceleration limit set in the call to steeringAndSpeedThroughObstacles.

virtual double DtGroundMoveToObstacleAvoider::maxAccelerationForSpeed ( )
protectedvirtual

Returns the maximum acceleration that the vehicle can generate, considering its maxAcceleration parameter, soil and weather, and maxSpeed.

virtual double DtGroundMoveToObstacleAvoider::maxTractionForConditions ( )
protectedvirtual

Returns the maximum acceleration that the wheels/tracks can provide given the soil and weather. A positive value.

virtual double DtGroundMoveToObstacleAvoider::highestFeasibleSpeed ( ) const
protectedvirtual

Feasible Speeds

Speeds that can be reached in 1 second. Used to limit desired speed output. Set at the beginning of the function steeringAndSpeedThroughObstacles based on the entity's parametric acceleration limits, current speed, available traction, etc.; then used in computation of final desired speed.

virtual void DtGroundMoveToObstacleAvoider::setHighestFeasibleSpeed ( const double  s)
protectedvirtual

Computes the coordinate transforms for the calculations this tick. Fills in myLocalToHorizBodyXform.

virtual double DtGroundMoveToObstacleAvoider::lowestFeasibleSpeed ( ) const
protectedvirtual

Computes the coordinate transforms for the calculations this tick. Fills in myLocalToHorizBodyXform.

virtual void DtGroundMoveToObstacleAvoider::setLowestFeasibleSpeed ( const double  s)
protectedvirtual

Computes the coordinate transforms for the calculations this tick. Fills in myLocalToHorizBodyXform.

Member Data Documentation

const DtSimulationServices* DtGroundMoveToObstacleAvoider::mySimulationServices
protected
const DtLocalObject* DtGroundMoveToObstacleAvoider::myEntity
protected
const DtGroundMoveToDestinationControllerComponent* DtGroundMoveToObstacleAvoider::myParentController
protected
const DtGroundVehicleStateRepository* DtGroundMoveToObstacleAvoider::myVehicleState
protected
DtVector DtGroundMoveToObstacleAvoider::myLocalDestination
protected
bool DtGroundMoveToObstacleAvoider::myIsGoingBackwards
protected
double DtGroundMoveToObstacleAvoider::myLateralAccelerationLimit
protected

Limit from desired acceleration input and physical limits.

double DtGroundMoveToObstacleAvoider::myAccelerationLimit
protected

Highest (forward) acceleration physically possible now.

double DtGroundMoveToObstacleAvoider::myBrakingLimit
protected

Highest braking acceleration, limited by desired acceleration and physical limits. Negative.

double DtGroundMoveToObstacleAvoider::myHighestFeasibleSpeedNow
protected

Highest speed that can be achieved in 1 second given the desired acceleration and the physical limit of myAccelerationLimit.

double DtGroundMoveToObstacleAvoider::myLowestFeasibleSpeedNow
protected

Lowest speed that can be achieved in 1 second given the limitations of myBrakingLimit.

double DtGroundMoveToObstacleAvoider::myMaxSpeedForMinTurnRadius
protected

Fastest speed to use for tight turns.

double DtGroundMoveToObstacleAvoider::myCurrentAltitude
protected

Used in task visualizations.

double DtGroundMoveToObstacleAvoider::mySpeed
protected

Speed in direction of movement.

double DtGroundMoveToObstacleAvoider::myHeading
protected

Heading of movement. This is 180 degrees from heading if moving backwards.

std::set<DtSimObjectReference> DtGroundMoveToObstacleAvoider::myVehiclesToYieldTo
protected

If right of way priorities are being used, this is a set of vehicle obstacles that have the right of way, it are approaching the line to the destination from the direction defined by RoW. It is cleared and set every tick for use in action selection logic.

std::list<DtSimObjectReference> DtGroundMoveToObstacleAvoider::myCachedEntityObstacles
protected

Lists of vehicle obstacles found last time we looked.

double DtGroundMoveToObstacleAvoider::myLastEntityQueryTime
protected
bool DtGroundMoveToObstacleAvoider::myWasEmbarked
protected

Remembers embarkation state last tick. When this changes, the list of vehicle obstacles is refreshed.

std::shared_ptr<MAKVRinTerra::DtFeatureSet> DtGroundMoveToObstacleAvoider::myObstacleFeatureSet
protected

Used for feature set for last query. Held until it is loaded, and then not needed until the next query.

DtVector DtGroundMoveToObstacleAvoider::myLastObstacleSearchLocation
protected

These record the state of the entity when it made the last feature query. A new query is made when the state changes more than a threshold.

double DtGroundMoveToObstacleAvoider::myLastObstacleSearchHeading
protected
bool DtGroundMoveToObstacleAvoider::myHaveAskedForFeatureObstacles
protected

Set true when a query has been made through the terrain interface for a feature set with obstacle features.

bool DtGroundMoveToObstacleAvoider::myHaveLoadedFeatureObstacles
protected

Set true when a feature set has been loaded and the obstacles put into myCachedFeatureObstacles.

std::list<FeatureObstacleData> DtGroundMoveToObstacleAvoider::myCachedFeatureObstacles
protected

The features found the last time the terrain was queried. Vertices of lines, in local coordinates. The lines are typically area boundaries, with the first and last vertex the same location. Otherwise, an open line.
The offsetVertices in these FeatureObstacleData structures contain local coordinates instead of horizontal-body coordinates.

DtCoordTransform DtGroundMoveToObstacleAvoider::myLocalToHorizontalBody
protected

A coordinate transformation from local coordinates to a topo coordinate system that is rotated to the heading of the entity. I.e., body coordinates if the entity pitch and roll are zero.

bool DtGroundMoveToObstacleAvoider::myDebug
protected

Set by calling controller.

DtSimObjectReference DtGroundMoveToObstacleAvoider::myKeyVehicleObstacle
protected
bool DtGroundMoveToObstacleAvoider::myIsObstacleWall
protected
DtChord DtGroundMoveToObstacleAvoider::myKeyWallObstacle
protected
DtExtent DtGroundMoveToObstacleAvoider::myDynamicObstacleSearchArea
protected

For task visualization. Make these available to the calling controller. TODO.

MAKVRinTerra::DtFeatureGeometry::PointVector DtGroundMoveToObstacleAvoider::myStaticObstacleSearchArea
protected

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

Document ID: Generated on Thu Oct 23 22:29:17 EDT 2025 from SVN revision 280951
Copyright © 2005-2024 MAK Technologies. All Rights Reserved (www.mak.com)