ticare_navigation.nav_manager module

class ticare_navigation.nav_manager.ComStatus(value)

Bases: Enum

Defines the communication statuses sent from NavManager to the ticare_communication package.

Attributes:

HOME: The robot has returned to the starting point. OBJECT_POINT: The robot has reached the location of the identified object.

HOME = 'home'
OBJECT_POINT = 'object_point'
class ticare_navigation.nav_manager.NavManager(*args: Any, **kwargs: Any)

Bases: Node

High-level orchestrator that monitors localization quality (AMCL) and manages state transitions (Search, Navigation, Emergency).

Attributes:

state (NavigationState): The current state of the navigation FSM.

vision_pub (Publisher): Sends commands (“start_vis”, “stop_vis”) to the ticare_vision package to activate or deactivate the camera during the search phase. communication_pub (Publisher): Communicates mission status (“home”, “object_point”) to the ticare_communication package.

vision_sub (Subscription): Receives object detection status (“object_detected”) from ticare_vision package. communication_sub (Subscription): Receives mission start commands (“start_nav”, “return”) from ticare_communication package.

save_pose_client (Client): Request to record start or target points.

nav_to_pose_client (ActionClient): Sends the robot to the target using A* algorithm. follow_waypoints_client (ActionClient): Executes coverage path planning.

timer (Timer): Main control loop timer that checks the current state and executes the corresponding behavior.

data_dir (str): The directory path where the YAML files of the initial and object poses are saved. config_dir (str): The directory path where the YAML file of the coverage points is saved.

cancel_follow_waypoints_response_callback(future: rclpy.task.Future) None

Handles the response from cancelling the FollowWaypoints goal.

Args:

future (Future): The future object representing the cancel goal response.

communication_callback(msg: std_msgs.msg.String) None

Handles mission commands from the communication package.

Args:

msg (String): The message data containing the command.

control_loop_callback() None

Main control loop that orchestrates FSM transitions based on the current state.

follow_waypoints_feedback_callback(feedback_msg: nav2_msgs.action.FollowWaypoints.Feedback) None

Handles feedback from the FollowWaypoints action server.

Args:

feedback_msg (FollowWaypoints.Feedback): The feedback message from the action server.

follow_waypoints_response_callback(future: rclpy.task.Future) None

Handles the response from the FollowWaypoints action server.

Args:

future (Future): The future object representing the action goal response.

follow_waypoints_result_callback(future: rclpy.task.Future) None

Handles the result from the FollowWaypoints action server.

Args:

future (Future): The future object representing the action result.

nav_to_pose_feedback_callback(feedback_msg: nav2_msgs.action.NavigateToPose.Feedback) None

Handles feedback from the NavigateToPose action server.

Args:

feedback_msg (NavigateToPose.Feedback): The feedback message from the action server.

nav_to_pose_response_callback(future: rclpy.task.Future) None

Handles the response from the NavigateToPose action server.

Args:

future (Future): The future object representing the action goal response.

nav_to_pose_result_callback(future: rclpy.task.Future) None

Handles the result from the NavigateToPose action server.

Args:

future (Future): The future object representing the action result.

perform_recovery_rotation() None

Executes a recovery rotation to improve AMCL localization.

publish_cmd_vel_msg(linear_x: float, angular_z: float) None

Publishes a Twist message to the cmd_vel topic.

Args:

linear_x (float): The linear velocity in the x direction [m/s]. angular_z (float): The angular velocity around the z axis [rad/s].

publish_communication_status(status: ComStatus) None

Publishes a communication status to the ticare_communication package.

Args:

status (ComStatus): The communication status to be published (e.g., HOME, OBJECT_POINT).

publish_vision_command(command: VisionCommand) None

Publishes a vision command to the ticare_vision package.

Args:

command (VisionCommand): The vision command to be published (e.g., START_VIS, STOP_VIS).

save_pose_response_callback(future: rclpy.task.Future) None

Handles the response from the SavePose service.

Args:

future (Future): The future object representing the service call.

send_follow_waypoints_goal(room: str = 'all') None

Sends a goal to the FollowWaypoints action server to execute a coverage path.

Args:

room (str): The room for which to execute the coverage path. Default is “all”, which executes the full path, other options (Lab_Paloma, Sala_D, etc.).

send_nav_to_pose_goal(label: SavePoseLabel) None

Sends a goal to the NavigateToPose action server to navigate to the specified pose.

Args:

label (SavePoseLabel): The label of the pose to navigate to (e.g., START_POSE, OBJECT_POSE).

send_save_pose_request(label: SavePoseLabel) None

Sends a service request to save the current pose with the specified label.

Args:

label (SavePoseLabel): The label for the pose to be saved (e.g., START_POSE, OBJECT_POSE).

vision_callback(msg: std_msgs.msg.String) None

Handles object detection status from the vision package.

Args:

msg (String): The message data from the vision node.

class ticare_navigation.nav_manager.NavigationState(value)

Bases: Enum

Defines the states for the TiCare Navigation FSM.

Attributes:

IDLE: System is initialized and waiting for a mission. LOCALIZING: Checks if a recovery rotation is needed to improve AMCL localization before proceeding. SAVING_START_POSE: Records the starting position for the “Returning Home” phase. SEARCHING: Executes the search pattern in the target room. SAVING_OBJECT_POSE: Records the exact location of the identified object. RETURNING_HOME: Robot returns to the mission starting point. AWAITING_RETURN: Passive state waiting for the user confirmation to guide them to the object. NAV_TO_OBJECT: Robot guides the user to the detected object’s location.

AWAITING_RETURN = 7
IDLE = 1
LOCALIZING = 2
NAV_TO_OBJECT = 8
RETURNING_HOME = 6
SAVING_OBJECT_POSE = 5
SAVING_START_POSE = 3
SEARCHING = 4
class ticare_navigation.nav_manager.SavePoseLabel(value)

Bases: Enum

Defines the labels for the poses saved by the SavePose service.

Attributes:

START_POSE: The starting position of the robot at the beginning of the mission. OBJECT_POSE: The position of the identified object after the search phase.

OBJECT_POSE = 'object_pose'
START_POSE = 'start_pose'
class ticare_navigation.nav_manager.VisionCommand(value)

Bases: Enum

Defines the vision commands sent from NavManager to the ticare_vision package.

Attributes:

START_VIS: The robot has localized itself and activates the camera to start the search protocol. STOP_VIS: The search protocol has finished, deactivate the camera.

START_VIS = 'start_vis'
STOP_VIS = 'stop_vis'
ticare_navigation.nav_manager.main(args=None) None

Main function to initialize the NavManager node and start spinning.