Skip to content

Commit

Permalink
[google_chat_ros]recieving -> receiving
Browse files Browse the repository at this point in the history
  • Loading branch information
mqcmd196 authored and knorth55 committed Jun 8, 2022
1 parent d855fa1 commit 9b3cc5d
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 19 deletions.
16 changes: 8 additions & 8 deletions google_chat_ros/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
The ROS wrapper for Google Chat API
1. [Installation Guide](#install)
1. [Sending the message](#send)
1. [Recieving the message](#recieve)
1. [Receiving the message](#recieve)
1. [Handling the event](#event)
1. [Optional functions](#optional)
1. [Helper nodes](#helper)
Expand Down Expand Up @@ -69,12 +69,12 @@ catkin build
```
### 1.4 Launch the node
#### HTTPS mode
You have to set rosparams `recieving_mode=https`, `google_cloud_credentials_json`, `host`, `port`, `ssl_certfile`, `ssl_keyfile`.
You have to set rosparams `receiving_mode=https`, `google_cloud_credentials_json`, `host`, `port`, `ssl_certfile`, `ssl_keyfile`.
#### Pub/Sub mode
You have to set rosparams `recieving_mode=pubsub`, `google_cloud_credentials_json`, `project_id`, `subscription_id`. `subscription_id` would be `chat-sub` if you follow [Pub/Sub mode](#pubsub) example.
You have to set rosparams `receiving_mode=pubsub`, `google_cloud_credentials_json`, `project_id`, `subscription_id`. `subscription_id` would be `chat-sub` if you follow [Pub/Sub mode](#pubsub) example.
##### Example
```bash
roslaunch google_chat_ros google_chat.launch recieving_mode:=pubsub google_cloud_credentials_json:=/path/to/<project_id>-XXXXXXXX.json project_id:=<project_id> subscription_id:=chat-sub
roslaunch google_chat_ros google_chat.launch receiving_mode:=pubsub google_cloud_credentials_json:=/path/to/<project_id>-XXXXXXXX.json project_id:=<project_id> subscription_id:=chat-sub
```
<a id="send"></a>
## 2. Sending the message
Expand Down Expand Up @@ -160,13 +160,13 @@ rostopic pub -1 /google_chat_ros/send/goal google_chat_ros/SendMessageActionGoal
See [Here](#image).

<a id="recieve"></a>
## 3. Recieving the messages
## 3. Receiving the messages
### 3.1 ROS Topic
When the bot was mentioned, the node publishes `~message_activity` topic.

### 3.2 Examples

#### Recieving a text message
#### Receiving a text message
```yaml
event_time: "2022-04-28T06:25:26.884623Z"
space:
Expand Down Expand Up @@ -200,7 +200,7 @@ user:
human: True
```
#### Recieving a message with an image or gdrive file and download it
#### Receiving a message with an image or gdrive file and download it
<!-- TODO add link to example -->
<a id="event"></a>
Expand Down Expand Up @@ -297,5 +297,5 @@ rostopic pub -1 /google_chat_ros/send/goal google_chat_ros/SendMessageActionGoal
localpath: '/home/user/Pictures/image.png'
space: 'spaces/<your space>'
```
### 5.2 Recieving a message with images or gdrive file
### 5.2 Receiving a message with images or gdrive file
You have to set rosparam `~download_data` True, `~download_directory`. If the node recieved the message with image or google drive file, it automatically downloads to `~donwload_directory` path.
4 changes: 2 additions & 2 deletions google_chat_ros/launch/google_chat.launch
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<launch>
<arg name="recieving_mode" default="url" doc="Google Chat API settings. Choose from url, dialogflow, pubsub, none."/>
<arg name="receiving_mode" default="url" doc="Google Chat API settings. Choose from url, dialogflow, pubsub, none."/>
<arg name="gdrive_upload_service" default="/gdrive_ros/upload" doc="The ROS service name of gdrive_ros upload"/>
<arg name="upload_data_timeout" default="20" />
<arg name="download_data" default="true" />
Expand Down Expand Up @@ -27,7 +27,7 @@
<node name="google_chat_ros" pkg="google_chat_ros" type="google_chat_ros_node.py"
respawn="$(arg respawn)" output="screen">
<rosparam subst_value="true">
recieving_mode: $(arg recieving_mode)
receiving_mode: $(arg receiving_mode)
gdrive_upload_service: $(arg gdrive_upload_service)
upload_data_timeout: $(arg upload_data_timeout)
download_data_timeout: $(arg download_data_timeout)
Expand Down
2 changes: 1 addition & 1 deletion google_chat_ros/msg/MessageEvent.msg
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# ROS message for recieving Google Chat message
# ROS message for receiving Google Chat message
string event_time
google_chat_ros/Space space
google_chat_ros/Message message
Expand Down
14 changes: 7 additions & 7 deletions google_chat_ros/scripts/google_chat_ros_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class GoogleChatROS(object):
Send request to Google Chat REST API via ROS
"""
def __init__(self):
recieving_chat_mode = rospy.get_param('~recieving_mode') # select from 'url', 'pubsub', 'none'
receiving_chat_mode = rospy.get_param('~receiving_mode') # select from 'url', 'pubsub', 'none'
self.gdrive_ros_srv = rospy.get_param('~gdrive_upload_service')
google_credentials = rospy.get_param('~google_cloud_credentials_json')

Expand All @@ -43,8 +43,8 @@ def __init__(self):
rospy.logwarn("Failed to start Google Chat REST service")
rospy.logerr(e)

# For recieving message
if recieving_chat_mode in ("url", "dialogflow", "pubsub"):
# For receiving message
if receiving_chat_mode in ("url", "dialogflow", "pubsub"):
# rosparams
self.upload_data_timeout = rospy.get_param('~upload_data_timeout')
self.download_data = rospy.get_param('~download_data')
Expand All @@ -55,7 +55,7 @@ def __init__(self):
self._space_activity_pub = rospy.Publisher("~space_activity", SpaceEvent, queue_size=1)
self._card_activity_pub = rospy.Publisher("~card_activity", CardEvent, queue_size=1)

if recieving_chat_mode == "url":
if receiving_chat_mode == "url":
rospy.loginfo("Expected to get Google Chat Bot URL request")
rospy.loginfo("Starting Google Chat HTTPS server...")
self.host = rospy.get_param('~host')
Expand All @@ -70,7 +70,7 @@ def __init__(self):
except ConnectionError as e:
rospy.logwarn("The error occurred while starting HTTPS server")
rospy.logerr(e)
elif recieving_chat_mode == "pubsub":
elif receiving_chat_mode == "pubsub":
rospy.loginfo("Expected to use Google Cloud Pub Sub service")
self.project_id = rospy.get_param("~project_id")
self.subscription_id = rospy.get_param("~subscription_id")
Expand All @@ -79,11 +79,11 @@ def __init__(self):
rospy.on_shutdown(self.killpubsub)
self._pubsub_client.run()

elif recieving_chat_mode == "none":
elif receiving_chat_mode == "none":
rospy.logwarn("You cannot recieve Google Chat event because HTTPS server or Google Cloud Pub/Sub is not running.")

else:
rospy.logerr("Please choose recieving_mode param from dialogflow, https, pubsub, none.")
rospy.logerr("Please choose receiving_mode param from dialogflow, https, pubsub, none.")

def killhttpd(self):
self._server.kill()
Expand Down
2 changes: 1 addition & 1 deletion google_chat_ros/src/google_chat_ros/google_chat.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def kill(self):
self._httpd.server_close()

class GoogleChatHTTPSHandler(s.BaseHTTPRequestHandler):
"""The handler for https request from Google chat API. Mainly used for recieving messages, events.
"""The handler for https request from Google chat API. Mainly used for receiving messages, events.
"""
def __init__(self, callback, user_agent, *args):
self._callback = callback
Expand Down

0 comments on commit 9b3cc5d

Please sign in to comment.