robokudo.action_servers.action_server_base¶
Base module for implementing ROS action servers in RoboKudo.
This module provides a base class for creating ROS action servers that can:
Handle action goals and feedback
Process client requests asynchronously
Support preemption of running goals
Manage server lifecycle (initialization, starting, etc.)
The base class abstracts common action server functionality while allowing specific implementations through subclassing.
Classes¶
A base class for implementing ROS action servers. |
Module Contents¶
- class robokudo.action_servers.action_server_base.ActionServerBase(action, feedback, result, auto_start: bool = True)¶
-
A base class for implementing ROS action servers.
This class provides the core functionality needed to create ROS action servers in RoboKudo. It handles:
Server initialization and startup
Goal reception and processing
Feedback and result message management
Preemption support
Subclasses must implement the _compute_result method to define specific server behavior.
- Variables:
-
logger – Logger instance for this action server
_feedback – Feedback message type for the action
_result – Result message type for the action
_action_server – The ROS action server instance
_feedback_msg – Current feedback message instance
_result_msg – Current result message instance
- ros_pkg_name = 'robokudo'¶
- name = 'action_server'¶
- logger = None¶
- _feedback¶
- _result¶
- _action_server¶
- _feedback_msg = None¶
- _result_msg = None¶
- start_server()¶
-
Start the ROS action server.
Initializes feedback and result message instances and starts the underlying ROS action server.
- _on_receive(goal)¶
-
Callback method executed when a new goal is received.
Processes the goal by calling _compute_result and handles success/failure cases appropriately.
- Parameters:
-
goal (Any) – The goal received from a client
- abstract _compute_result(goal) bool¶
-
Compute result for a received goal.
This abstract method must be implemented by subclasses to define how goals are processed. During computation, implementations should:
Regularly call self._check_for_preempt() to handle preemption
Update self._feedback_msg with progress information
Call self._send_feedback() to publish feedback
Set self._result_msg with the final result
- Parameters:
-
goal (Any) – The goal to process
- Returns:
-
True if goal was processed successfully, False otherwise
- Return type:
-
bool
- _check_for_preempt() bool¶
-
Check if the current goal has been preempted.
If preemption is requested, marks the goal as preempted and stops processing.
- Returns:
-
True if preemption was requested, False otherwise
- Return type:
-
bool
- _send_feedback()¶
-
Send the current feedback message to the action client.
Publishes the current state of self._feedback_msg to update clients on goal processing progress.