ML Warm-Up Exercises
Read all the documents in this lab script before starting to do/type anything. Ask if anything is unclear before doing something.
If you do something you need to know what effect it will have, otherwise you could damage the VM or ROS and be unable to work properly.
Reactive Behaviors and Perceptron for Robot Control
In this lab session, you will test different reactive robot behaviors (aggression, fear, exploration and love behaviors). You will train and test a perceptron model to control the speed of a mobile robot.
Reactive Behaviors
Task 1
Download the ZIP file Lab_files_reactive_behaviors.zip
from the Moodle page of this unit and extract the files in your Documents folder. This folder contains the following files:
- Demo_aggression_reactive_behavior.ttt: Example of aggression behavior using a mobile robot with input data from distance sensors.
- Demo_fear_reactive_behavior.ttt: Example of fear behavior using a mobile robot with input data from distance sensors.
- Demo_Braitenberg_vehicles_wall_following - template.ttt: Example scenario with a mobile robot for the implementation of wall following using reactive behaviors.
Task 2
Open and analyse the code from the aggression (Demo_aggression_reactive_behavior) and fear (Demo_fear_reactive_behavior) reactive robot behaviors. Figure 1 illustrates these behaviors with Braitenberg vehicles. Observe how the sensors connected to the motors control the direction of the robot when an obstacle is detected. Change the weights of the sensorimotor connections to small and large values and observe how they affect the robot behavior.
Task 3
Open the Demo_Braitenberg_vehicles_wall_following
- template file and try to implement the fear or exploration robot behaviors to make the robot capable of following the walls of the scenario.
Perceptron model
Task 1
Download the ZIP file Lab_files_perceptron_control.zip
from the Moodle page of this unit and extract the files in your Documents folder. This folder contains the following files:
- Demo_simplePerception.py: Example of perceptron model with 2 input signals for recognition of AND gate input pattern.
- Demo_blockColor_with_perceptron_with_CopperliaSim.py: Example of perceptron model with 3 input signals for recognition of colours and robot control in CoppeliaSim.
- Demo_perceptron_camera_color_control.ttt: Example scenario for control of robot speed based on colour predicted by the perceptron model.
Task 2
Open the Demo_simplePerception.py
file and check the implementation of the Perceptron model () algorithm from the Lecture slides available on Moodle. The example implements the Perceptron model for recognition of input pattern from a 2-bit AND gate. Train and test the network for recognition of input patters from a 2-bit AND, NOT, OR, NAND, NOR, XOR logic gates.
Task 3
Open the Demo_blockColor_with_perceptron_with_CopperliaSim.py
file and check the implementation of the Perceptron model with three inputs (Red, Green, Blue) for recognition of colours (). Run the program and verify the output recognition. Try changing the training values for the Red, Green and Blue components to be able to recognise different colours.
Task 4
Open the Demo_blockColor_with_perceptron_with_CopperliaSim.py
file and set the variable robotControl = True
.
Open the Demo_perceptron_camera_color_control.ttt
file, which contains the CoppeliaSim scenario for robot control. Run CoppeliaSim and then run the Perceptron model, the robot should move faster when red colours are detected and slower when green colours are detected ().