Welcome to final_assignment’s documentation!
Indices and tables
UI Module
This code is the core of the program. We need the user to choose one of the modality, so we have to active one while the others are waiting.
- scripts.UI.switch()[source]
This function will start the different modalities depending on what the user decides to choose. The variable boolprint is used to wait in the first modality the end of the task. The input is got with the function
input()
. This is the core of the program because it gives the user the possibility to choose the modality.it is important to say that the code manages the possibility of the first modality to cancel the goal to be reached.
- Parameters
none. –
Modality1 Module
- Subscribes to:
none
- Publishes to:
none
- This node is needed to the first modality of the program. The node makes the robot autonomously reach a x,y position inserted by the user on the UI interface. It uses actionlib, which permits to us to make the code simplier and better. It is really important to say that we have three parameters that we get from the UI:
active
which is the variable determinating the status of the modality, if it’s on or not.desired_position_x
which communicates the desired x position.desired_position_y
which communicates the desired y position.
- scripts.modality1.ActionClient()[source]
Function to define the ActionClient and create the action.
- Parameters
none. –
- scripts.modality1.UpdatingVariables()[source]
- Function to update the variables:
active
desired_position_x
desired_position_y
- Parameters
none. –
- scripts.modality1.done_cb(status, result)[source]
- Function to define the functionalities of the action, like advising the user of the goal received and other useful messages. We want the action to do the following dues:
Advising the user Advising the user that the goal was cancelled.
Advising the user that the goal was achieved.
Advising the user that the goal was aborted because the timer expired.
Advising the user that the goal was not accepted.
- Parameters
none –
- Returns
none
Modality2 Module
This code is just the already existing teleop_twist_keyboard package on ROS. Some of the code has been modified in order to incorporate the script with the final_assignment package. Some code won’t be commented as gar as you can check the ROS wiki package of it by googling it. Anyway, here’s the link for getting deeper in the code: http://wiki.ros.org/teleop_twist_keyboard
- class scripts.modality2.PublishThread(rate)[source]
-
- run()[source]
Method representing the thread’s activity.
You may override this method in a subclass. The standard run() method invokes the callable object passed to the object’s constructor as the target argument, if any, with sequential and keyword arguments taken from the args and kwargs arguments, respectively.
Modality3 Module
This code is just the already existing teleop_twist_keyboard package on ROS. Some of the code has been modified in order to incorporate
the script with the final_assignment package. Some code won’t be commented as gar as you can check the ROS wiki package of it by googling it.
Anyway, here’s the link for getting deeper in the code: http://wiki.ros.org/teleop_twist_keyboard
The dictionary moveBindings
will have some features popped out because when the robot is close to the walls. This permits to the user to avoid colliding with the walls.
- scripts.modality3.CallbackLaser(msg)[source]
Function to check if some wall is close to the robot.
- Parameters
robot (message from the odometry of the) –
- class scripts.modality3.PublishThread(rate)[source]
- run()[source]
Method representing the thread’s activity.
You may override this method in a subclass. The standard run() method invokes the callable object passed to the object’s constructor as the target argument, if any, with sequential and keyword arguments taken from the args and kwargs arguments, respectively.
- scripts.modality3.getKey(key_timeout)[source]
Function to get the input from the keyboard without having the need to wait for the user to press enter.
- Parameters
key_timeout –
- Returns
the k
- scripts.modality3.main()[source]
The main here is really important because as the different input arrives it changes the key moving the robots. As the other two modalities, we have again
active
which permits the user to use the modality as he wants. As you could see, the modality 1 and the modality 2 are pretty equal, but here’s the difference, when the robot is close to a wall, we pop the keys in the dictionary permitting the robot to move towards the robot.