Skip to content

NichAttGH/Research-Track-1

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 

Repository files navigation

Research Track 1

First Assignment

Introduction to the Code

There are 5 functions: drive, turn, find_silver, find_golden and checklist; each function is explained into the FirstAssignment.py.

The 'while cycle' represents the steps that the robot must take to achieve the goal: to pair each SILVER token with each GOLDEN token.

  1. The first step represents the robot that initially look the closest SILVER token and tries to take it;
  2. Once taked, the program stores the offset of the SILVER token into the List 'tokens_taked' so that it no longer has to be considered among all the available SILVER tokens;
  3. After that, the robot look the closest GOLDEN token and release the SILVER token near to the GOLDEN token;
  4. At this point, the program stores the offset of the GOLDEN token into the List 'tokens_taked' so that it no longer has to be considered among all the available GOLDEN tokens;
  5. Now, the List has the first Pair and the program will continue to repeat each step until the last GOLDEN token because after the last, the program will warn us with a message that tells 'List Full, impossible to continue!'

If you want to run the code, just follow steps below:

  1. open the terminal shell;
  2. move into this path: python_simulator_rt1/robot-sim;
  3. write this line of code: $python2 run.py FirstAssignment.py;

PseudoCode

In the while loop:

If the list is full, all tokens paired

print: 'is not possible to continue because the list of tokens paired is full..'

the program exits the loop and ends

If state is equals to True

the robot look the closest Silver token

else

the robot look the closest Golden token

If is not found a token

the robot turn

else if the current distance from the robot to the token is less than 0.4 and the token found is Silver

print: 'found the Silver'

the robot grab the token

the token is stored into the list

the robot takes a few steps back

the variable 'state' changes value

else if the current distance from the robot to the token is less than 0.6 and the token found is Golden

print: 'found the Golden'

the robot release the Silver token near to the Golden token

the token is stored into the list

print: 'paired!'

the robot takes a few steps back

the variable 'state' changes value

else if the robot is well aligned with the token

print: 'ah, here we are'

the robot go forward

else if the robot is not well aligned with the token

print: 'left, a bit..' or print: 'right, a bit..'

the robot turn left or turn right

Future Improvements

Allow the robot to always find the closest token to it by performing, for example, a 360 degree turn on itself to store the distances of all the tokens present in the environment into a list and improve execution time

Second Assignment

Introduction to the Code

The assignment provides the use of Rviz and Gazebo for graphical interfaces and a robot that can move in the environment with the possibility to avoid obstacles.

For the assignment were created 3 nodes: Node_A, Node_B and Node_C.

The Node_A allows the robot to go to the point that the user wants, the Node_B allows the user to know the number of goal reached and canceled, while the Node_C provides the distance from the actual position of the robot to the desired position that the robot must reach and the average speed.

If you want to run the project, there are several requirements to follow (Pay attention: these requirements are for ubuntu 20.04):

  1. open the terminal shell;
  2. install ROS noetic by following the guide in this link: http://wiki.ros.org/noetic/Installation/Ubuntu
  3. install gazebo dependencies from this link: https://classic.gazebosim.org/tutorials?tut=ros_installing&cat=connect_ros
  4. install xterm with this command: sudo apt-get install xterm
  5. go into the directory of the workspace;
  6. download the repository with this command: git clone https://github.com/NichAttGH/RT1.git
  7. run the command: roslaunch assignment_2_2022 assignment_2.launch

At this point will be opened 4 windows: 1 for Rviz, 1 for Gazebo and 2 for respectively Node_A.py and Node_C.py.

The Node_A.py require that the user must type 2 coordinates: the coordinate X and the coordinate Y that the robot need to move to the desired point that the user want.

While, the Node_C.py show continously the distance from the current position of the robot to the desired position and the average speed.

Instead, the Node_B.py is a service that show the number of the goals reached from the robot and goals canceled from the user; furthermore it need to be called in a new terminal shell with this command: rosservice call Node_B.py

Flowchart of the Node_A.py

Flowchart 2_assignment_RT1 drawio

Future improvements

Some ideas for future improvements:

  • A way to know the coordinates of the whole area of the environment because in this case we could see exactly where the robot can go (this point is maybe the priority for a possible update becuase when the user type coordinates that refer to a point that is out of the simulation, the program doesn't work so good indeed when the robot can't arrive to the desired position, the program increments the counter of the goal canceled);
  • A way to allow the robot to choose the fastest direction to go to the desired position from the user (because now the robot choose alone which direction to take, so there is a possibility that the robot choose the slowest direction to go to the desired position from the user);

About

Assignments for Research Track 1

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published