Task Manager

task_manager.py

Overview

task_manager.py is the central state orchestrator of the TIAGo cognitive stack. It listens to low-level controller feedback and customer order events, then delegates all reasoning to the /robot_state_decision service. By outsourcing the decision logic the node stays stateless and easy to unit- test while the service can evolve (rule engine, ML policy, …) without touching this file.

Interfaces (strongly-typed, partly stateful)

Direction / Type

Name

ROS type

Notes

Required (sub)

/{robot}/feedback_acion

std_msgs/String

Controller status, e.g. "ARM_DONE" or "BASE_FAILED"

Required (sub)

/{robot}/verif_T_manager

tiago1/Voice_rec

Verified customer order (currently cached, not relayed)

Client (srv)

/{robot}/robot_state_decision

tiago1/robotstatedecision

Request → state_input: str – last feedback Response ← symbolic task / ack

Provided (pub)

/{robot}/speaker_channel

std_msgs/String

Robot dialogue (“I will get to …”, “Waiting”, …)

Contract

Pre-conditions

  • /robot_state_decision is available before main loop starts.

  • Feedback topic publishes at most twice per second (queue=10).

Post-conditions

  • On every feedback message exactly one service call is made.

  • Dialogue text is always published, even if the service fails.

  • Internal state_input is cleared only on node shutdown.

Execution loop

Every 2 s (Rate(0.5)):

  1. If a new feedback string exists → call the service.

  2. Log the response.

  3. Publish a spoken confirmation on /speaker_channel.

Implementation notes

  • Voice_rec orders are stored for future extensions where the service might need context.

  • A latched publisher is not used so UIs see only fresh responses.

  • Exception handling: only rospy.ServiceException is caught; any other error propagates for debugging.

class task_manager.TaskManager[source]

Bases: object

Aggregate feedback → call decision service → publish dialogue line.

change_state()[source]

If state_input exists call decision service and speak reply.