Skip to content

Commit

Permalink
google_chat_ros/script/helper.py: add ~send_dialogflow_response_to_go…
Browse files Browse the repository at this point in the history
…ogle_chat param. Set False did not returns dialogflow response to chat
  • Loading branch information
k-okada committed Apr 13, 2023
1 parent fee7e68 commit 46525ef
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
Empty file modified dialogflow_task_executive/node_scripts/sample_app_print.py
100755 → 100644
Empty file.
2 changes: 2 additions & 0 deletions google_chat_ros/launch/google_chat.launch
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
<!-- params for helper -->
<arg name="use_helper" default="true" />
<arg name="to_dialogflow_client" default="false" />
<arg name="send_dialogflow_response_to_google_chat" default="true" />
<arg name="debug_sound" default="false" />

<node name="google_chat_ros" pkg="google_chat_ros" type="google_chat_ros_node.py"
Expand Down Expand Up @@ -49,6 +50,7 @@
respawn="$(arg respawn)" output="screen" if="$(arg use_helper)">
<rosparam subst_value="true">
to_dialogflow_client: $(arg to_dialogflow_client)
send_dialogflow_response_to_google_chat: $(arg send_dialogflow_response_to_google_chat)
debug_sound: $(arg debug_sound)
</rosparam>
</node>
Expand Down
14 changes: 8 additions & 6 deletions google_chat_ros/scripts/helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ def __init__(self):
# Get configuration params
self.to_dialogflow_task_executive = rospy.get_param("~to_dialogflow_client")
self.sound_play_jp = rospy.get_param("~debug_sound")
self.send_dialogflow_response_to_google_chat = rospy.get_param("~send_dialogflow_response_to_google_chat", True)
self._message_sub = rospy.Subscriber("google_chat_ros/message_activity", MessageEvent, callback=self._message_cb)
self.recent_message_event = None

Expand Down Expand Up @@ -59,13 +60,14 @@ def _message_cb(self, data):
thread_name = data.message.thread_name
text = data.message.argument_text
if self.to_dialogflow_task_executive:
chat_goal = SendMessageGoal()
chat_goal.space = space
chat_goal.thread_name = thread_name
dialogflow_res = self.dialogflow_action_client(text)
content = "<{}> {}".format(sender_id, dialogflow_res.response.response)
chat_goal.text = content
self.send_chat_client(chat_goal)
if self.send_dialogflow_response_to_google_chat:
chat_goal = SendMessageGoal()
chat_goal.space = space
chat_goal.thread_name = thread_name
content = "<{}> {}".format(sender_id, dialogflow_res.response.response)
chat_goal.text = content
self.send_chat_client(chat_goal)
if self.sound_play_jp:
sound_goal = SoundRequestGoal()
sound_goal.sound_request.sound = sound_goal.sound_request.SAY
Expand Down

0 comments on commit 46525ef

Please sign in to comment.