Welcome to RT1_FinalAssignment’s documentation!

Indices and tables

User Interface Module

Service:

/directions /input_key

This node implements the user interface, takes the user input and launches the specific launch file.

scripts.input_controller.choice1()[source]

Function to handle the first modality of moving the robot, asking to the user the coordinates.

Service:

/directions

The user message is passed to the service manage_input, advertised by choice1

scripts.input_controller.choice2()[source]

Function to handle the second modality of moving the robot, asking the user to directly drive the robot sending value 1.

Service:

/input_key

The user choice is passed to the service manage_input, advertised by choice2

scripts.input_controller.choice3()[source]

Function to handle the third modality of moving the robot, asking the user to directly drive the robot sending value 2.

Service:

/input_key

The user choice is passed to the service manage_input, advertised by choice2

scripts.input_controller.userInterface()[source]

Function to print the text to show to the user.

Returns: input(String) value from the user to send it to the menage service.

Modality one Module

Service:

/directions

Action:

/move_base /actionlib

This node implements the automatic movement of the robot from it’s current/initial position, to the one inserted by the user evaluating if it is reachable or not.

scripts.choice1.directions_server()[source]

Function that describes the node directions_controller to the user.

calls the service handler to manage the directions service, retriving the values from the manage_input function.

scripts.choice1.manage_input(request)[source]

Function to handle the user choice of mode 1. Sets the target and waits for the result.

Parameters

*request (float64 x, float64 y) –

Returns

when the goal is reached -1: when the goal is not reached or not reachable

Return type

1

The user choice is passed to the action parameters, send to the server with target variable and waits to check if the choosen point can be reached or not (in this case will call the cancel_goal() function)

Modality two Module

Service:

/input_key

This node implements the lauching of the last 2 modalities:

mode2. the user is free to drive the robot as he/her prefers without any constraint mode3. the user drives the robot but there will be a collision control, avoiding the user to hit obstacles.

scripts.choice2.input_key_server()[source]

Function that describes the node keyboard_controller to the user.

calls the service handler to manage the input_key service, retriving the values from the manage_input function.

scripts.choice2.manage_input(request)[source]

Function called by both choice 2 and 3 but if mode 3 is choosen here the launcher for that specific mode is called.

Parameters

*request (float64 x, float64 y) –

The user choice is passed to the os to launch the chosen launch file.

Modality three Module

Subscribes to:

/remap_cmd_vel to send the velocity in different cases based on the scanning /scan to get the laser scanning of the map

Publishes to:

/cmd_vel the desired distance from the obstacles deteced.

This node implements the driving of the robot with obstacle avoidance.

scripts.choice3.clbk_remap(data)[source]

Callback to copy the remap_cmd_vel on repost which can be modified or left untouched

Parameters
  • in (*data* variable name for the message that is passed) –

  • geometry_msgs (in this case the) –

scripts.choice3.clbk_scan(data)[source]

Callback to compute the minimun obstacle distance to the right, left and in front of the robot.

Parameters
  • in (*data* variable name for the message that is passed) –

  • sensor_msgs (in this case the) –

Returns

repost global variable that modifies the velocity of the robot based on its position

The publisher is initialized and publishes on the repost variable

scripts.choice3.inputKey_remap()[source]

Function to initialize the node inputKey_node. Subscribes to the topics Twist and LaserScan.

scripts.choice3.minimum_th(ranges)[source]

Function to section the ranges array in 3 parts and store the minimum distance for each of them.

Parameters

topic (*ranges* array of integers coming from the LaserScan) –

Returns

distance array of integers containing the minimum distance from the right, center and left scanned ranges

The user choice is passed to the os to launch the chosen launch file.