Skip to content

Commit 65a079a

Browse files
authored
Merge pull request #516 from k-okada/chat_thread3
google_chat_ros: enable to get therad_name message result
2 parents e5de02a + 34ad00e commit 65a079a

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

google_chat_ros/scripts/google-chat.l

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@
44
(ros::roseus "google_chat_eus_client")
55

66
(defun send-google-chat-text (space content
7-
&key (thread-name nil) (action-goal-name "google_chat_ros/send") (wait t))
7+
&key (thread-name nil) (action-goal-name "google_chat_ros/send") (wait t)
8+
(ac (instance ros::simple-action-client :init
9+
action-goal-name google_chat_ros::SendMessageAction)))
810
(wait (boundp 'google_chat_ros::SendMessageAction)
9-
(let ((goal (instance google_chat_ros::SendMessageActionGoal :init))
10-
(ac (instance ros::simple-action-client :init
11-
action-goal-name google_chat_ros::SendMessageAction)))
11+
(let ((goal (instance google_chat_ros::SendMessageActionGoal :init)))
1212
(when (send ac :wait-for-server 1)
1313
(when (eq (send ac :get-state) actionlib_msgs::GoalStatus::*active*)
1414
(send ac :cancel-goal)
@@ -19,17 +19,17 @@
1919
(send goal :goal :text content)
2020
(send ac :send-goal goal)
2121
(if wait
22-
(return-from send-google-chat-text (send ac :wait-for-result :timeout 5))
22+
(return-from send-google-chat-text (if (send ac :wait-for-result :timeout 5) (send ac :get-result) nil))
2323
(return-from send-google-chat-text t))))))
2424

2525
(defun send-google-chat-image
2626
(space image-path
2727
&key (image-header "") (thread-name nil)
28-
(action-goal-name "google_chat_ros/send") (wait t))
28+
(action-goal-name "google_chat_ros/send") (wait t)
29+
(ac (instance ros::simple-action-client :init
30+
action-goal-name google_chat_ros::SendMessageAction)))
2931
(when (boundp 'google_chat_ros::SendMessageAction)
30-
(let ((goal (instance google_chat_ros::SendMessageActionGoal :init))
31-
(ac (instance ros::simple-action-client :init
32-
action-goal-name google_chat_ros::SendMessageAction))
32+
(let ((goal (instance google_chat_ros::SendMessageActionGoal :init)))
3333
(card (instance google_chat_ros::Card :init))
3434
(section (instance google_chat_ros::Section :init))
3535
(widget (instance google_chat_ros::WidgetMarkup :init))
@@ -72,11 +72,11 @@
7272
;; buttons should be list
7373
(space buttons
7474
&key (buttons-header "") (thread-name nil)
75-
(action-goal-name "google_chat_ros/send") (wait nil))
75+
(action-goal-name "google_chat_ros/send") (wait nil)
76+
(ac (instance ros::simple-action-client :init
77+
action-goal-name google_chat_ros::SendMessageAction)))
7678
(when (boundp 'google_chat_ros::SendMessageAction)
7779
(let ((goal (instance google_chat_ros::SendMessageActionGoal :init))
78-
(ac (instance ros::simple-action-client :init
79-
action-goal-name google_chat_ros::SendMessageAction))
8080
(card (instance google_chat_ros::Card :init))
8181
(section (instance google_chat_ros::Section :init))
8282
(widget (instance google_chat_ros::WidgetMarkup :init)))

0 commit comments

Comments
 (0)