SinglePrevalent

class SinglePrevalent<T, N : ConvexPolygon>(environment: Euclidean2DEnvironmentWithGraph<*, T, N, *>, node: Node<T>, prevalent: SteeringActions<T>.() -> NavigationAction2D<T, *, *, N, *>, toleranceAngle: Double = DEFAULT_TOLERANCE_ANGLE, alpha: Double = DEFAULT_ALPHA, maxWalk: () -> Double, maxWalkRatio: Double = DEFAULT_MAX_WALK_RATIO, delta: Double = DEFAULT_DELTA) : Weighted<T> (source)

A SteeringStrategy in which one action is prevalent. Only NavigationActions can be prevalent, because they guarantee to navigate the environment consciously (e.g. without getting stuck in obstacles). The purpose of this strategy is to linearly combine the potentially contrasting forces to which the node is subject, while maintaining that warranty. Such forces are combined as follows: let f be the prevalent force,

  • if f leads the node outside the room (= environment's area) he/she is into, no combination is performed and f is used as it is. This because crossing doors can be a thorny issue, and we don't want to introduce disturbing forces.

  • Otherwise, a linear combination is performed: f is assigned unitary weight, all other forces are assigned weight w equal to the maximum value in 0,1 so that the resulting force:

  • forms with f an angle smaller than or equal to the specified toleranceAngle,

  • doesn't lead the node outside the current room. The idea is to decrease the intensity of non-prevalent forces until the resulting one enters some tolerance sector defined by both the tolerance angle and the current room's boundary. With a suitable tolerance angle this allows to steer the node towards the target defined by the prevalent force, while using a trajectory which takes into account other urges as well. Finally, an exponential smoothing with the given alpha is applied to the resulting force in order to decrease oscillatory movements (this also known as shaking behavior).

Parameters

T

concentration type

N

type of nodes of the environment's graph.

Constructors

Link copied to clipboard
constructor(environment: Euclidean2DEnvironmentWithGraph<*, T, N, *>, node: Node<T>, prevalent: SteeringActions<T>.() -> NavigationAction2D<T, *, *, N, *>, toleranceAngle: Double = DEFAULT_TOLERANCE_ANGLE, alpha: Double = DEFAULT_ALPHA, maxWalk: () -> Double, maxWalkRatio: Double = DEFAULT_MAX_WALK_RATIO, delta: Double = DEFAULT_DELTA)

Types

Link copied to clipboard
object Companion

Default values for the parameters.

Functions

Link copied to clipboard

actions are partitioned in group steering actions and non-group steering actions. The overall next position for each of these two sets of actions is computed via weighted sum. The resulting vectors are then summed together (with unitary weight).

Link copied to clipboard

If there's no SteeringActionWithTarget among the provided actions, a zero vector is returned. Otherwise, the closest target is picked.