Reasoning Action
reasoning_action.py
Overview
reasoning_action.py is a high-level task orchestrator that converts symbolic “table commands” (PLACE, CLEAR, …) and a navigation path into three concrete ROS Action goals:
movement_control – drives the mobile base along the path
arm_control – moves the wrist / forearm to the working pose
gripper_control – opens or closes the gripper
When the whole macro succeeds—or when any step fails—the node emits one human-readable feedback message for GUIs, loggers, or supervisor FSMs.
Interfaces (strongly-typed, partially stateful)
Direction |
Name |
Type |
Notes |
---|---|---|---|
Required |
|
|
Global or local path from the planner |
Required |
|
|
Symbolic keyword (PLACE, CLEAR, …) |
Provided |
|
|
“Busy” → doing a task, “Free” → finished/failed |
Action client |
|
|
Executes the navigation path |
Action client |
|
|
Positions forearm / wrist |
Action client |
|
|
Grips or releases the dish |
Contract
Pre-conditions
All three Action servers are running (checked at startup).
Path and command topics share the same robot namespace.
Post-conditions
Exactly one feedback line per task: “Busy” at start, “Free” when done.
Arm & gripper goals are sent only if base motion succeeds.
Statefulness
The node keeps an internal flag path_received
so each incoming path is
executed once; after completion the flag resets.
Customisation hooks
Override perform_table_command()
(or the private
_run_manipulation_sequence()
) to map each symbolic keyword onto a custom
sequence of arm/gripper goals.
- class reasoning_action.ReasoningAction[source]
Bases:
object
Coordinates navigation + manipulation through three ActionLib clients.
Variables
- path_receivedbool
Becomes
True
when a new path topic arrives; cleared after use.- path_msgnav_msgs.msg.Path | None
The most recent path waiting to be executed.
- task_feedback_pubrospy.Publisher
Latched channel for GUIs / loggers → “Busy” / “Free”.
- movement_client / arm_client / gripper_clientactionlib.SimpleActionClient
Pre-connected clients;
wait_for_servers()
blocks until ready.
- loop() None [source]
- 0.3 Hz cycle (≈ every 3 s):
if a new path is queued → send to base, wait blocking;
on success → run arm & gripper macros;
publish “Busy” / “Free” to feedback topic.
- path_callback(msg: nav_msgs.msg.Path) None [source]
Store the planner path for use in the main loop.
- perform_table_command(decision: str) None [source]
Map symbolic command to arm/gripper macros.
Stub does nothing so the example compiles; override in subclasses:
PLACE → lower arm, open gripper
CLEAR → close gripper, raise arm
- table_command_callback(msg: std_msgs.msg.String) None [source]
Forward symbolic keyword (PLACE, CLEAR, …) to
perform_table_command()
.