Class SinglePrevalent
-
- All Implemented Interfaces:
-
it.unibo.alchemist.model.cognitive.SteeringStrategy
public final class SinglePrevalent<T extends Object, N extends ConvexPolygon> extends Weighted<T>
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).
-
-
Field Summary
Fields Modifier and Type Field Description public final static Double
DEFAULT_TOLERANCE_ANGLE
public final static Double
DEFAULT_ALPHA
public final static Double
DEFAULT_MAX_WALK_RATIO
public final static Double
DEFAULT_DELTA
-
Constructor Summary
Constructors Constructor Description SinglePrevalent(Euclidean2DEnvironmentWithGraph<?, T, N, ?> environment, Node<T> node, Function1<List<SteeringAction<T, Euclidean2DPosition>>, NavigationAction<T, Euclidean2DPosition, Euclidean2DTransformation, ?, ?, N, ?>> prevalent, Double toleranceAngle, Double alpha, Function0<Double> maxWalk, Double maxWalkRatio, Double delta)
-
Method Summary
Modifier and Type Method Description Euclidean2DPosition
computeNextPosition(List<SteeringAction<T, Euclidean2DPosition>> actions)
actions are partitioned in group steering actions and non-group steering actions. -
-
Constructor Detail
-
SinglePrevalent
SinglePrevalent(Euclidean2DEnvironmentWithGraph<?, T, N, ?> environment, Node<T> node, Function1<List<SteeringAction<T, Euclidean2DPosition>>, NavigationAction<T, Euclidean2DPosition, Euclidean2DTransformation, ?, ?, N, ?>> prevalent, Double toleranceAngle, Double alpha, Function0<Double> maxWalk, Double maxWalkRatio, Double delta)
-
-
Method Detail
-
computeNextPosition
Euclidean2DPosition computeNextPosition(List<SteeringAction<T, Euclidean2DPosition>> actions)
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).
- Parameters:
actions
-the list of actions to combine.
-
-
-
-