To show how to implement and use Py-iB2c, 3 examples have been added to the repository. The network is aimed at heading a simple 2D agent to different targets. The agent has 8 proximity sensors and the simulator can be configured to have static and moving obstacles.
In the first example, the agent is made up by 2 behaviors:
- DecreaseVelocityBehavior: reduces the nominal velocity in case the velocity vector is not aimed at the target, generating a coefficient 0 >= alpha_v >= 1
- HeadToPointBehavior: it turns the commanded velocity to aim the agent to the target. It generates the commanded velocity V_c.
This is the structure of the proposed network:
Take a look at the code to see how the behaviors are implemented and how the network is configured.
The next example is similar to the previous one, but a collision avoidance behavior has been included. Taking the proximity sensor, it generates a commanded velocity to avoid colliding with objects. When a sensor detects and objects, the activity of the behavior increases and inhibits the HeadToPointBehavior module. Both modules are connected to a (Weighted) fusion modules, so that the final velocity is a mix of both commands.
Finally, in example_3.py the same behavior of example_2 has been implemented, but loading the network created in example_1 as it was a single behavior, and also loading the avoid collision module.