Control of a robot in a simulated environment.
An overview of this program function.
Go to Introduction
A rapid description of how the program works (pseudo-code).
Go to How it works
How install and run this program in Linux.
Go to Installation and Execution
How this program could be improved.
Go to Improvements
This program uses the library sr.robot to get information about the robot and to control it.
In particular, the robot:
- Follows a path.
- Avoids the golden tokens which rappresent the borders.
- Grabs a silver token when it is near to it and move it behind itself.
At the begin it looks like:
Let's analyze each case:
- If there is an angle too small between the robot and a golden token, the robot turns away to be almost parallel to the borders.
- If there is a distance too small between the robot and a golden token, the robot starts a check to identify where the path is free; to do this, it checks the distance from the wall on the right and from the wall on the left (walls are represented by golden token) and go to the furthest one.
- If there is not any golden token between the robot and a silver token and the distance between them is little enough (less than the distance between the robot and the closest golden token), the robot turns against the silver token and go on.
- When the robot is close enough to the silver token, it grabs this one, move it behind itself and turns again to continue the path.
Download this repository typing:
git clone https://github.com/simone-contorno/rt-assignment-1
Go into the folder robot-sim and run 'assignment.py' type:
python2 run.py assignment.py
You can also change some parameters into the code to modify the robot performance (e.g. straight_on_speed and refresh_rate).
You will find all the information about functions and variables in the file thanks to the comments.
Let's notice some possible and very well improvements:
- The robot could turn better with a better check about the golden tokens around it.
- The robot could identify better the silver token, for instance it could go to reach it only when there is not any golden token between them, without the second check about the distance between the robot and the closest golden token.