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) |
|
|
Controller status, e.g. |
Required (sub) |
|
|
Verified customer order (currently cached, not relayed) |
Client (srv) |
|
|
Request → |
Provided (pub) |
|
|
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)):
If a new feedback string exists → call the service.
Log the response.
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.