Final Assignment
1.0
Research Track part 1 - Assignment 2 - RobEng A.A. 2020/2021
|
Functions | |
def | update_current_position () |
Update the informations about the position from check_position service. More... | |
def | clear_status () |
clear the status of the node. More... | |
def | new_target_to_move_base () |
ask a new randomly-choosen target to the server points_manager, then send to MoveBase the target to reach . More... | |
def | srv_reach_random_pos_switch (data) |
Turn on and off the service. More... | |
def | srv_reach_random_pos_status (data) |
return the status of the service. More... | |
def | main () |
The algorithm of the node. More... | |
def | cbk_on_shutdown () |
This is called on the shutdown of the node. More... | |
Variables | |
string | node_name = "reach_random_pos_service" |
name of this node More... | |
string | name_reach_random_pos_status = "/reach_random_pos_status" |
name of the service 'reach_random_pos_status' More... | |
string | name_reach_random_pos_switch = "/reach_random_pos_switch" |
name of the service 'reach_random_pos_switch' More... | |
string | name_check_position = "/check_position" |
name of the service 'check_position' More... | |
string | name_get_point = "/get_point" |
name of the service 'get_point' More... | |
string | name_move_base = "/move_base/goal" |
name of the topic 'move_base/goal' (Publisher) More... | |
topic_move_base = None | |
handler topic 'move_base/goal' (Publisher) More... | |
bool | service_active = False |
status of the node (bool; default: False) More... | |
bool | is_moving = False |
the robot is moving (bool; default: False) More... | |
bool | signal_last_pos = False |
last pos signal received (bool; default: False) More... | |
actual_position = Point( ) | |
actual position of the robot (geometry_msgs/Point) More... | |
target_position = None | |
the target position (geometry_msgs/Point; default: None) More... | |
last_response_check_pos = check_positionResponse( ) | |
response from the service 'check_position' (final_assignment/check_position) More... | |
float | min_distance_from_the_target = 0.5 |
tolerance on the distance from the target More... | |
cycle_time = rospy.Duration( 0, 500 ) | |
time between two cycles More... | |
srv_check_position = None | |
call-point of the service 'check_position' More... | |
srv_get_point = None | |
call-point of the service 'get_point' More... | |
def reach_random_pos_service.cbk_on_shutdown | ( | ) |
This is called on the shutdown of the node.
Definition at line 320 of file reach_random_pos_service.py.
def reach_random_pos_service.clear_status | ( | ) |
clear the status of the node.
This is called when the service is turned off. Simple setting of booleans to 'off' state.
(not is_moving), (not signal_last_pos), (not target_pos)
Definition at line 140 of file reach_random_pos_service.py.
def reach_random_pos_service.main | ( | ) |
The algorithm of the node.
This 'main' function contains the working algorithm of the node. Its functioning can be summarized as follows:
Definition at line 273 of file reach_random_pos_service.py.
def reach_random_pos_service.new_target_to_move_base | ( | ) |
ask a new randomly-choosen target to the server points_manager, then send to MoveBase the target to reach .
Definition at line 154 of file reach_random_pos_service.py.
def reach_random_pos_service.srv_reach_random_pos_status | ( | data | ) |
return the status of the service.
Definition at line 240 of file reach_random_pos_service.py.
def reach_random_pos_service.srv_reach_random_pos_switch | ( | data | ) |
Turn on and off the service.
data | (final_assignment/switch_service) the switch. |
The switch has this behaviour:
Definition at line 196 of file reach_random_pos_service.py.
def reach_random_pos_service.update_current_position | ( | ) |
Update the informations about the position from check_position service.
if the robot is_moving, make a common request to /check_position service; else, do nothing.
Definition at line 112 of file reach_random_pos_service.py.
reach_random_pos_service.actual_position = Point( ) |
actual position of the robot (geometry_msgs/Point)
Definition at line 85 of file reach_random_pos_service.py.
reach_random_pos_service.cycle_time = rospy.Duration( 0, 500 ) |
time between two cycles
Definition at line 99 of file reach_random_pos_service.py.
bool reach_random_pos_service.is_moving = False |
the robot is moving (bool; default: False)
Definition at line 78 of file reach_random_pos_service.py.
reach_random_pos_service.last_response_check_pos = check_positionResponse( ) |
response from the service 'check_position' (final_assignment/check_position)
Definition at line 92 of file reach_random_pos_service.py.
float reach_random_pos_service.min_distance_from_the_target = 0.5 |
tolerance on the distance from the target
Definition at line 96 of file reach_random_pos_service.py.
string reach_random_pos_service.name_check_position = "/check_position" |
name of the service 'check_position'
Definition at line 60 of file reach_random_pos_service.py.
string reach_random_pos_service.name_get_point = "/get_point" |
name of the service 'get_point'
Definition at line 64 of file reach_random_pos_service.py.
string reach_random_pos_service.name_move_base = "/move_base/goal" |
name of the topic 'move_base/goal' (Publisher)
Definition at line 68 of file reach_random_pos_service.py.
string reach_random_pos_service.name_reach_random_pos_status = "/reach_random_pos_status" |
name of the service 'reach_random_pos_status'
Definition at line 52 of file reach_random_pos_service.py.
string reach_random_pos_service.name_reach_random_pos_switch = "/reach_random_pos_switch" |
name of the service 'reach_random_pos_switch'
Definition at line 56 of file reach_random_pos_service.py.
string reach_random_pos_service.node_name = "reach_random_pos_service" |
name of this node
Definition at line 48 of file reach_random_pos_service.py.
bool reach_random_pos_service.service_active = False |
status of the node (bool; default: False)
Definition at line 75 of file reach_random_pos_service.py.
bool reach_random_pos_service.signal_last_pos = False |
last pos signal received (bool; default: False)
Definition at line 81 of file reach_random_pos_service.py.
reach_random_pos_service.srv_check_position = None |
call-point of the service 'check_position'
Definition at line 176 of file reach_random_pos_service.py.
reach_random_pos_service.srv_get_point = None |
call-point of the service 'get_point'
Definition at line 179 of file reach_random_pos_service.py.
reach_random_pos_service.target_position = None |
the target position (geometry_msgs/Point; default: None)
Definition at line 88 of file reach_random_pos_service.py.
reach_random_pos_service.topic_move_base = None |
handler topic 'move_base/goal' (Publisher)
Definition at line 71 of file reach_random_pos_service.py.