Reasoning Order Verification
reasoning_order_verification.py
Overview
reasoning_order_verification.py is the natural-language gatekeeper that stands between automatic speech recognition (ASR) and the orchestration layer.
Workflow
ASR sentence arrives on
/{robot}/voice_recogn
.The node validates the text:
contains the polite fragment “Can I have”
mentions at least one item from food_list
If valid → build a structured :pyclass:`tiago1.msg.Voice_rec` order, publish it to the task-manager and push the same order into the shared orchestration queue via the
/robot_state_decision_add
service.If invalid → emit an integer error code on the interaction error channel.
Interfaces (strongly-typed, stateless)
Direction |
Name |
ROS type |
Notes |
---|---|---|---|
Required |
|
|
Raw ASR text, e.g. |
Provided |
|
|
Structured, validated order (id + list_of_orders). |
Provided |
|
|
|
Service client |
|
|
Appends the order to the orchestration FIFO. |
Order Verification & Error Handling KPIs
Metric |
Target |
---|---|
Verification latency (/voice_recogn → /verif_T_manager) |
≤ 200 ms |
Dish-match recall (valid dishes recognized) |
≥ 98 % |
Error-handling coverage (mis-orders triggering error code) |
≥ 95 % |
Validation policy
Syntax guard – sentence must include “Can I have”.
Menu match – at least one substring from food_list must be present.
Multi-dish support – all matches packed into a single order message.
Error codes
1
– no recognised dish
2
– polite fragment missing
Both are recoverable; waiter simply prompts the customer to repeat.
- class reasoning_order_verification.ReasoningOrderVerification(server_robots: int, food_list: list[str])[source]
Bases:
object
Parse spoken orders → validate → publish structured order or error code.
Variables
- server_clientrospy.ServiceProxy
Link to
/{robot}/robot_state_decision_add
(FIFO enqueue).- food_listlist[str]
Canonical dish names; matching is substring-based (case-sensitive).
- msgstd_msgs.msg.String | None
Latest ASR sentence waiting to be parsed.
- counter_idint
Auto-incremented ticket number for each accepted order.
- parse_order()[source]
Validate :pyattr:`self.msg`; publish order or error.
Called once per second from the main loop.