NODE move_base_nav.py

navigation using MoveBase and the navigation stack

In a way very similar to how the NODE bug_m acts, this node implements a composite behaviour which drives the robot towards a target plus a final orientation. But in this case, the node uses MoveBase uses the navigation stack to reach the final position.

Authors

prof. Carmine Recchiuto (UniGe), Francesco Ganci (S4143910)

Version:

v1.5.0

move_base_nav.active_ = False

the activity status of the node.

move_base_nav.cbk_odometry(msg)[source]

subscription callback for the odometry topic

move_base_nav.change_state(state)[source]

state transition from the current one to the one in the argument.

move_base_nav.cl_head_orient_switch = None

(client handle) client to enable and disable the head orientation

move_base_nav.cl_move_base_signal = None

(service client handle) client for service_move_base_signal

move_base_nav.desired_position_ = x: 0.0 y: 0.0 z: 0.0

the objective position for move_base. obtained from the parameters ‘des_pos_x’ and ‘des_pos_y’

move_base_nav.desired_yaw_ = 0.0

the current orientation of the robot

move_base_nav.err_pos = inf

teh error between the desired position and the current one.

Note

if the position is not measured, the distance will be always infinite.

move_base_nav.err_yaw = 1.5707963267948966

the error between the current orientation and the desired one.

Note

its default value is PI/2, and also when the distance is not measured

move_base_nav.main()[source]

state machine implementation

move_base_nav.move_base_cancel_goal()[source]

send a cancellation request to move_base

move_base_nav.move_base_send_target(x, y)[source]

send a target to move base.

Parameters
  • x (float) – the x coordinate

  • y (float) – the y coordinate

move_base_nav.move_base_switch(data)[source]

used for switching the activity status of the node.

The node also updates the target, reading the new one from the parameters server.

Parameters

data (SetBool) – the boolean SetBool.data inside the message is the new activity status

Note

before calling the service, make sure the three ros parameters ‘des_pos_x’ , ‘des_pos_y’ and ‘des_yaw’ have been set.

Todo

differently from the other behavioural nodes, this node requires to be retriggered using this service each time the objective changes. this could be a desin issue. The node should update automatically the objective when it changes.

move_base_nav.normalize_angle(angle)[source]

angle normalization between -PI and PI.

Note

the parameter “angle” is the err_yaw in this implementation.

move_base_nav.position_ = x: 0.0 y: 0.0 z: 0.0

the current position of the robot, from the odometry

move_base_nav.pub_move_base_cancel = None

(publisher handle) the publisher for cancelling the request

move_base_nav.pub_move_base_goal = None

(publisher handle) move base goal

move_base_nav.replan_time = 30

the planner, in case the robot is requiring too much time for reaching the point, can do a replanning request

move_base_nav.send_signal()[source]

send a signal through the service service_move_base_signal if available.

move_base_nav.service_head_orient_switch = '/head_orient_switch'

service name for the head orientation

move_base_nav.service_move_base_signal = '/nav_stack_signal'

the node assumes that some other node implements this client, used for sending the signal when the robot reaches the objective.

move_base_nav.service_move_base_switch = '/nav_stack_switch'

name of the service to trigger the state of the node

move_base_nav.srv_move_base_switch = None

service handle for service_move_base_switch

move_base_nav.state_ = 0

the current state of the node

move_base_nav.state_description = ''

just a message to make clear the current status of the node

move_base_nav.sub_odometry = None

(subscription handle) subscription to the odometry

move_base_nav.threshold_position_ = 0.35

the maximum allowed position error while reaching the target.

move_base_nav.topic_move_base_cancel = '/move_base/cancel'

name of the topic for cancelling the navigation request

move_base_nav.topic_move_base_goal = '/move_base/goal'

the topic for sending the target to the navigation stack

move_base_nav.topic_odometry = '/odom'

the node measures the position of the robot during the navigation.

move_base_nav.working_rate = 10

the working rate is the maximum update frequency of this node. the status is checked with a frequency of ‘working_rate’ Hz.

move_base_nav.yaw_ = 0.0

the orientation of the robot about the ‘z’ axis, from the odometry

move_base_nav.yaw_precision_ = 0.3490658503988659

+/- 20 degree allowed

move_base_nav.yaw_precision_2_ = 0.03490658503988659

+/- 2 degree allowed