Skip to content

Commit

Permalink
feat: skeleton handle_task_feedback_request implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
maciejmajek committed Aug 21, 2024
1 parent 3335b9f commit 0cc7263
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/rai_hmi/rai_hmi/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ def __init__(self, node_name: str):
self.system_prompt = self._initialize_system_prompt()
self.faiss_index = self._load_documentation()
self.tools = self._initialize_available_tools()
self.initialize_task_action_client_and_server()

self.get_logger().info("HMI Node has been started")

Expand Down
23 changes: 21 additions & 2 deletions src/rai_hmi/rai_hmi/voice_hmi.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,12 @@
from langchain.prompts import ChatPromptTemplate
from langchain_core.messages import AIMessage, BaseMessage, HumanMessage
from langchain_openai import ChatOpenAI
from rclpy.action.server import ServerGoalHandle
from rclpy.callback_groups import ReentrantCallbackGroup
from std_msgs.msg import String

from rai_hmi.base import BaseHMINode
from rai_interfaces.action import TaskFeedback


class VoiceHMINode(BaseHMINode):
Expand Down Expand Up @@ -77,8 +79,25 @@ def handle_human_message(self, msg: String):
self.processing = False

# TODO: Implement
def handle_task_feedback_request(self, goal_handle):
pass
def handle_task_feedback_request(self, goal_handle: ServerGoalHandle):

# Extract goal data
goal: TaskFeedback.Goal = goal_handle.request
goal # type: ignore

# Handle the goal.current_task and goal.issue_description
for _ in range(10):
goal_handle.publish_feedback(
TaskFeedback.Feedback(feedback="Processing...")
)

goal_handle.succeed()
# Create and return a result
result = TaskFeedback.Result()
result.informations = "Do this and that..."
result.success = True

return result


def main(args=None):
Expand Down

0 comments on commit 0cc7263

Please sign in to comment.