Package populus :: Module ReactiveMind :: Class ReactiveMind :: Class Motivation
[frames] | no frames]

Class Motivation

This an nested helper class that realizes a motivation intended as a psychological pressure in doing something.

Instance Methods
 
__init__(self, combiner)
The constructor creates a motivation instance setting a given combiner algorithm.
Vec3
value(self)
The vectorial value of the motivation.
 
setValue(self, v)
Set the vectorial value of the motivation.
dict
candidates(self)
Return the candidates table.
 
connectWith(self, function)
Set up a receptor function which connect this motivation to a body part to affect its motion.
 
bufferize(self, bhvKey, candidate)
Bufferize a candidate motivation value for later evaluation.
 
evaluate(self)
Evaluate all candidates and compute a final motivation.
 
motivate(self)
Apply the motivation to the body model controlled by the mind.
Method Details

__init__(self, combiner)
(Constructor)

 

The constructor creates a motivation instance setting a given combiner algorithm.

The combiner algorithm is used to blend the set of motivational candidate values to result in unique final value to assign to the motivation.

Parameters:
  • combiner (callable) - The combiner algorithm used to blend candidates values.

value(self)

 

The vectorial value of the motivation.

Returns: Vec3
The value of the motivation expressed as a vectorial amount.

setValue(self, v)

 

Set the vectorial value of the motivation.

Parameters:
  • v (Vec3) - A vectorial values for the motivation.

candidates(self)

 

Return the candidates table.

Returns: dict
A table containing candidates values and the reactive behaviors who generate them.

connectWith(self, function)

 

Set up a receptor function which connect this motivation to a body part to affect its motion.

Parameters:
  • function (callable) - A receptor function provided by body model.

bufferize(self, bhvKey, candidate)

 

Bufferize a candidate motivation value for later evaluation.

Parameters:
  • bhvKey (int) - The identifier of the behavior who generated the candidate value.
  • candidate (Vec3 or list) - A candidate motivation values expressed as a vectorial amount or list of costs.

motivate(self)

 

Apply the motivation to the body model controlled by the mind. The motivation will not affect the body unless it has previously connected to it through a receptor function.