Final Assignment  1.0
Research Track part 1 - Assignment 2 - RobEng A.A. 2020/2021
user_console Namespace Reference

Functions

def reach_random_pos ()
 Implementation of the command reach_random_pos [no.1]. More...
 
def stop_reach_random_pos ()
 Stop the background process reach_random_pos More...
 
def reach_user_pos ()
 Implementation of the command reach_user_pos [no.2]. More...
 
def reach_user_pos_bug0 (target)
 Send manually a goal to bug0. More...
 
def wall_follow (val=True)
 Implementation of the command wall_follow [no.3]. More...
 
def last_pos ()
 Implementation of the command last_pos [no.4]. More...
 
def change_motion_planning_algorithm ()
 Implementation of the command change_motion_planning_algorithm [no.5]. More...
 
def print_help ()
 Implementation of the command help [no.6]. More...
 
def main ()
 Ask the next command to the user. More...
 
def cbk_on_shutdown ()
 Called when the shutdown signal is raised. More...
 

Variables

string node_name = "user_console"
 name of this node More...
 
string name_wall_follower_switch = "/wall_follower_switch"
 name of the server 'wall_follower_switch' More...
 
string name_reach_random_pos_switch = "/reach_random_pos_switch"
 name of the service 'reach_random_pos_switch' More...
 
string name_user_target = "/user_target"
 name of the service 'user_target' More...
 
string name_position_defined = "/position_defined"
 name of the service 'position_defined' More...
 
string name_bug0_switch = "/bug0_switch"
 name of the service 'bug0_switch' More...
 
string name_bug0_status = "/bug0_status"
 name of the service 'bug0_status' More...
 
list commands
 available commands More...
 
list commands_info
 infos about each command More...
 
int last_command_idx = -1
 last command index More...
 
bool robot_busy = False
 is there any movement ongoing? More...
 
bool reach_random_pos_active = False
 is reach_random_pos active? More...
 
bool wall_follow_active = False
 is wall follow active? More...
 
bool use_bug0 = False
 use bug0 or move_base More...
 
 srv_wall_follower_switch = None
 call point of the server 'wall_follower_switch' More...
 
 srv_reach_random_pos_switch = None
 call-point of the service 'reach_random_pos_switch' More...
 
 srv_user_target = None
 entry point of the service 'user_target' More...
 
 srv_position_defined = None
 call-point of the service 'position_defined' More...
 
 srv_bug0_switch = None
 call-point of the service 'bug0_switch' More...
 
 srv_bug0_status = None
 call-point of the service 'bug0_status' More...
 

Function Documentation

◆ cbk_on_shutdown()

def user_console.cbk_on_shutdown ( )

Called when the shutdown signal is raised.

Definition at line 473 of file user_console.py.

◆ change_motion_planning_algorithm()

def user_console.change_motion_planning_algorithm ( )

Implementation of the command change_motion_planning_algorithm [no.5].

select a motion planning algorithm between bug0 and move_base.


See also: Command Line Interfaces - Commands

Definition at line 328 of file user_console.py.

◆ last_pos()

def user_console.last_pos ( )

Implementation of the command last_pos [no.4].

Interrupts any ongoing background task whih makes the robot busy.


See also: Command Line Interfaces - Commands

Definition at line 300 of file user_console.py.

◆ main()

def user_console.main ( )

Ask the next command to the user.

This function implements a simple while-switch pattern for receiving command from the command line.
Commands are all case-insensitive. Also corresponding numbers are allowed (lazy mode).


See also: Command Line Interfaces - Commands

Definition at line 410 of file user_console.py.

◆ print_help()

def user_console.print_help ( )

Implementation of the command help [no.6].

The function prints an help on the screen.


See also: Command Line Interfaces - Commands

Definition at line 363 of file user_console.py.

◆ reach_random_pos()

def user_console.reach_random_pos ( )

Implementation of the command reach_random_pos [no.1].

This function selects the node to activate between move_base and bug0. Then, it sends the proper switch message to the selected motion planning algorithm.


See also: Command Line Interfaces - Commands

Definition at line 100 of file user_console.py.

◆ reach_user_pos()

def user_console.reach_user_pos ( )

Implementation of the command reach_user_pos [no.2].

This function asks for a target to the user, then checks it.
If the position is contained in the set of predefined ones, the command is valid, and a message is issued to the selected motion planning algorithm.
After sent the message, the function waits until the target is reached.


See also: Command Line Interfaces - Commands

Definition at line 181 of file user_console.py.

◆ reach_user_pos_bug0()

def user_console.reach_user_pos_bug0 (   target)

Send manually a goal to bug0.

Parameters
target(geometry_msgs/Point) the target to reach.

The service bug0 needs a further step: the desired target must be passed via parameter server.
So, the function writes on the parameter server, then waits until the goal is reached.


See also: service bug0 status, in particular how to use it.

Definition at line 233 of file user_console.py.

◆ stop_reach_random_pos()

def user_console.stop_reach_random_pos ( )

Stop the background process reach_random_pos

If move_base is active, the function waits until the target is reached and then turns off the node reach_random_pos_service.py. Otherwise, it immediately stops bug0.

Definition at line 137 of file user_console.py.

◆ wall_follow()

def user_console.wall_follow (   val = True)

Implementation of the command wall_follow [no.3].

Parameters
val(bool; default: True) the state of the wall_follow service

The function simply activates the wall follow service sending to it a switch message.
The same function can turn off the service, passing False as argument.


See also: Command Line Interfaces - Commands

Definition at line 267 of file user_console.py.

Variable Documentation

◆ commands

list user_console.commands
Initial value:
1 = [ "", \
2  "reach_random_pos", \
3  "reach_user_pos", \
4  "wall_follow", \
5  "last_pos", \
6  "change_motion_planning_algorithm", \
7  "help", \
8  "exit" ]

available commands

Definition at line 51 of file user_console.py.

◆ commands_info

list user_console.commands_info
Initial value:
1 = [ "", \
2  "periodically ask a position to the server, then try and reach it.", \
3  "ask to the user a position, then try and reach it. ", \
4  "use the component wall_follower.", \
5  "Stop any ongoing movement", \
6  "select your motion planning algorithm between 'move_base' and 'bug0'", \
7  "print this help", \
8  "Close this program." ]

infos about each command

Definition at line 61 of file user_console.py.

◆ last_command_idx

int user_console.last_command_idx = -1

last command index

Definition at line 71 of file user_console.py.

◆ name_bug0_status

string user_console.name_bug0_status = "/bug0_status"

name of the service 'bug0_status'

Definition at line 48 of file user_console.py.

◆ name_bug0_switch

string user_console.name_bug0_switch = "/bug0_switch"

name of the service 'bug0_switch'

Definition at line 45 of file user_console.py.

◆ name_position_defined

string user_console.name_position_defined = "/position_defined"

name of the service 'position_defined'

Definition at line 42 of file user_console.py.

◆ name_reach_random_pos_switch

string user_console.name_reach_random_pos_switch = "/reach_random_pos_switch"

name of the service 'reach_random_pos_switch'

Definition at line 36 of file user_console.py.

◆ name_user_target

string user_console.name_user_target = "/user_target"

name of the service 'user_target'

Definition at line 39 of file user_console.py.

◆ name_wall_follower_switch

string user_console.name_wall_follower_switch = "/wall_follower_switch"

name of the server 'wall_follower_switch'

Definition at line 33 of file user_console.py.

◆ node_name

string user_console.node_name = "user_console"

name of this node

Definition at line 30 of file user_console.py.

◆ reach_random_pos_active

bool user_console.reach_random_pos_active = False

is reach_random_pos active?

Definition at line 77 of file user_console.py.

◆ robot_busy

bool user_console.robot_busy = False

is there any movement ongoing?

Definition at line 74 of file user_console.py.

◆ srv_bug0_status

user_console.srv_bug0_status = None

call-point of the service 'bug0_status'

Definition at line 393 of file user_console.py.

◆ srv_bug0_switch

user_console.srv_bug0_switch = None

call-point of the service 'bug0_switch'

Definition at line 390 of file user_console.py.

◆ srv_position_defined

user_console.srv_position_defined = None

call-point of the service 'position_defined'

Definition at line 387 of file user_console.py.

◆ srv_reach_random_pos_switch

user_console.srv_reach_random_pos_switch = None

call-point of the service 'reach_random_pos_switch'

Definition at line 381 of file user_console.py.

◆ srv_user_target

user_console.srv_user_target = None

entry point of the service 'user_target'

Definition at line 384 of file user_console.py.

◆ srv_wall_follower_switch

user_console.srv_wall_follower_switch = None

call point of the server 'wall_follower_switch'

Definition at line 378 of file user_console.py.

◆ use_bug0

bool user_console.use_bug0 = False

use bug0 or move_base

Definition at line 83 of file user_console.py.

◆ wall_follow_active

bool user_console.wall_follow_active = False

is wall follow active?

Definition at line 80 of file user_console.py.