Logo Robotika.SK Faculty of Electrical Engineering and Information Technology, Slovak University of Technology  Logo Faculty of Mathematics, Physics and Informatics, Comenius University 

Deadline of this assignment is set to: 2022-06-25 10:22:59

1. Task: Ellipse

Ellipse is a set of points, for which the sum of their distances from the two focal points is the same.

Image: Ellipse, by Ag2gaeh, CC BY-SA 4.0

We can thus draw an ellipse using a pensil in a simple way: attaching the string in points F1 and F2 and keeping the string always straightened.

Task for rabbits: Build a robot that can move alongside an ellipse. The string is attached in the focal points, it is straightened and freely attached to the robot so that it limits its movement. The robot is trying to move forward, but when that is not possible, it will allow for the neccessary turning left or right. Will a differential gear be helpful?

Task for tigers: Build a robot that can move alongside an ellipse and draw it at the same time. Make sure that the pencil/pen is attached very near the point that strains the string. The robot will stop when the ellipse is drawn and it will report how much is the shape of the ellipse prolonged to the sides (i.e. how much it is non-circular).

2. Task: A learning robot

What makes a robot to be a robot is that it can be changed to perform (at least a bit) different things. Even robots that are doing the same thing all the time (for instance painting a car) can be taught a new sequence or progression. We have different ways how to make the robots learn something new. One option is that en engineer will enter into the robot a new program. Another possibility is that an operator will show the robot - using some console, joystic or simiar some new movements. And the most advanced method is to have a robot that can learn on its own.

Task for rabbits: Build a simple robot with at least two sensors. Each of the sensors will distinguish between two different values - for example: an obstacle is detected vs. obstacle is too far, another example: seeing black line, or not seeing black line. After starting the program, the robot will be in the learning phase: Before a sound signal, an operator will place the robot in some specific situation - for example: the light reflectance sensor sees the line and the distance measuring sensor does not detect an obstacle and tells the robot using a button (left/right arrows, or both) what should happen in that particular situation (robot should turn left/right, or stop). After each such new situation, the program offers to learn a new one, or finish the learning phase. In situations that were not specified in this way, the robot will be moving straight. After the learning completed, the operator will place the robot where the learned behavior should be activated, and presses a button to start. Make your robot learn at least three different behaviors: for example following a line on the right edge, following a line on the left edge, avoiding obstacles, and simila.

Example: A robot has two sensors: light sensor for line following and distance sensor for detecting obstacles. The operator will place the robot so that the right sensor sees the line and mark this situation as "move right". Next, the operator will place the robot with right sensor on the line and marks "move right". Result: robot learned to follow a line. Another trial with the same robot and program: Operator will place the robot in front of an obstacle and marks "move right". Result: Robot learned to avoid obstacles

Data that the robot remembered (one possibility):

when learning started:  after learning in case 1:  after learning in case 2:

L R D    action
0 0 0    forward                   forward                       forward
0 0 1    forward                   forward                       right
0 1 0    forward                   right                          forward
0 1 1    forward                   forward                       forward
1 0 0    forward                   left                            forward
1 0 1    forward                   forward                       forward
1 1 0    forward                   forward                       forward
1 1 1    forward                   forward                       forward

L - left line sensor, R - right line sensor, D - distance sensor.

Task for tigers: Build a simple robot with at least three sensors. Each of the sensors will distinguish between two or a couple of (3,4,...?) different values. After starting the program, the robot can be controlled over BT: it is moving forward and turns or stops on a remote request. Whenever the robot receives a request, it will determine all the sensor readings, and adds one in that particular slot of the frequency table. The learning phase either lasts a specific time, or it is terminated by the opeartor in some other way. The learned behavior is then finally activated: robot obtaining readings from all the sensors repeatedly, and using the frequency table to select the next action at every moment: using that action which has the highest value, i.e. that action which the operator requested in that particular sensory situation most frequently. 
Comment: if needed, you can improve the learning process (for example add 10 when operator requests an action, and add 1 three times per second otherwise - depending on the current sensory readings) - use your createivity.

Example: Robot has three ultrasonic sensors - one looking ahead, and one towards left and one towards right. In the first trial, the operator will control the robot so that it will follow the contours of the obstacle in a clockwise direction, in the second trial, the robot will learn to follow the contours counter-clockwise, in the third attempt, the robot will learn to follow an obstacle.

Data as remembered by the robot when learning finished - in case 1 (one possibility):

sensors              action
L R M      forward   left     right
0 0 0           1        0        5
0 0 1           1        3        1
0 1 0           2        1        0
0 1 1           0        4        1
1 0 0           0        0        0
1 0 1           0        0        0
1 1 0           0        0        0
1 1 1           0        0        0

Video: Robot learns to follow counters first, then it learns to push objects.
It uses the very same program, what has changed is only the input of the operator. Source: Bayesian Programming.