|
4 | 4 | (ros::roseus "google_chat_eus_client") |
5 | 5 |
|
6 | 6 | (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))) |
8 | 10 | (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))) |
12 | 12 | (when (send ac :wait-for-server 1) |
13 | 13 | (when (eq (send ac :get-state) actionlib_msgs::GoalStatus::*active*) |
14 | 14 | (send ac :cancel-goal) |
|
19 | 19 | (send goal :goal :text content) |
20 | 20 | (send ac :send-goal goal) |
21 | 21 | (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)) |
23 | 23 | (return-from send-google-chat-text t)))))) |
24 | 24 |
|
25 | 25 | (defun send-google-chat-image |
26 | 26 | (space image-path |
27 | 27 | &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))) |
29 | 31 | (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))) |
33 | 33 | (card (instance google_chat_ros::Card :init)) |
34 | 34 | (section (instance google_chat_ros::Section :init)) |
35 | 35 | (widget (instance google_chat_ros::WidgetMarkup :init)) |
|
72 | 72 | ;; buttons should be list |
73 | 73 | (space buttons |
74 | 74 | &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))) |
76 | 78 | (when (boundp 'google_chat_ros::SendMessageAction) |
77 | 79 | (let ((goal (instance google_chat_ros::SendMessageActionGoal :init)) |
78 | | - (ac (instance ros::simple-action-client :init |
79 | | - action-goal-name google_chat_ros::SendMessageAction)) |
80 | 80 | (card (instance google_chat_ros::Card :init)) |
81 | 81 | (section (instance google_chat_ros::Section :init)) |
82 | 82 | (widget (instance google_chat_ros::WidgetMarkup :init))) |
|
0 commit comments