Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Do Not Merge] Develop Branch for Spot #325

Open
wants to merge 52 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
249449f
add webhook server to recieve the https POST method from Dialogflow.
mqcmd196 Apr 26, 2021
6c9cab2
update README.md
mqcmd196 Jun 2, 2021
2e2df9b
change config file path settings
mqcmd196 Jun 3, 2021
74ae730
use catkin_virtualenv for execute with Python3
mqcmd196 Jun 3, 2021
10af9e1
fix README.md
mqcmd196 Jun 3, 2021
bdb95fd
use rosparam when loading config file, remove catch the exception, re…
mqcmd196 Jun 3, 2021
a9e7bb3
add arg to whether launch webhook_server or not
mqcmd196 Jun 3, 2021
ec602f1
Merge branch 'master' into dialogflow_https_server
knorth55 Sep 8, 2021
cc2b6ea
support pydrive2 for gdrive_server_node.py
knorth55 Sep 23, 2021
9564c81
add server started loginfo
knorth55 Sep 23, 2021
26352bf
update readme
knorth55 Sep 23, 2021
3e654c9
Merge remote-tracking branch 'mqcmd196/dialogflow_https_server' into …
sktometometo Sep 24, 2021
3883275
Merge remote-tracking branch 'knorth55/gdrive-ros-pydrive2' into deve…
sktometometo Sep 26, 2021
cecc2e0
[dialogflow_task_executive] add text interface
sktometometo Oct 20, 2021
a6bfdab
[dialogflow_task_executive] fix bugs and update some
sktometometo Oct 20, 2021
9fb65e1
[dialogflow_task_executive] update README.md for text interface
sktometometo Oct 20, 2021
78953b7
Merge branch 'PR/add-interfaces-to-dialogflow-client' into develop/spot
sktometometo Oct 20, 2021
2f00181
[dialogflow_task_executive] add sample apps
sktometometo Oct 20, 2021
c3d2907
Merge branch 'PR/add-sample-apps-to-dialogflow-task-executive' into d…
sktometometo Oct 20, 2021
46961d1
[dialogflow_task_executive] support launch_args of app_manager
sktometometo Oct 20, 2021
00cc93e
Merge branch 'PR/support-app-manager-launch-args-dialogflow-task-exec…
sktometometo Oct 20, 2021
94433ff
[dialogflow_task_executive] fix format
sktometometo Oct 25, 2021
21bd457
[dialogflow_task_executive] fix format
sktometometo Oct 25, 2021
34e9455
[dialogflow_task_executive] fix format
sktometometo Oct 25, 2021
915df82
[dialogflow_task_executive] fix format
sktometometo Oct 25, 2021
8d9ae7c
[dialogflow_task_executive] fix format
sktometometo Oct 25, 2021
8d820a4
[dialogflow_task_executive] fix format
sktometometo Oct 25, 2021
e53eab8
[gdrive_ros] add gdrive_ros client
sktometometo Nov 9, 2021
cb31f04
[gdrive_ros] Add a roseus client library and sample
sktometometo Nov 10, 2021
a6e8bbb
[gdrive_ros] update CMakeLists.txt to add installation of euslisp and…
sktometometo Nov 10, 2021
dccffa7
[gdrive_ros] add rospy client and update examples
sktometometo Nov 10, 2021
781c49e
[gdrive_ros] fix module import
sktometometo Nov 10, 2021
291a2a9
Merge remote-tracking branch 'sktometometo/PR/support-app-manager-lau…
sktometometo Nov 10, 2021
d4a081d
Merge remote-tracking branch 'sktometometo/PR/add-interfaces-to-dialo…
sktometometo Nov 10, 2021
c526600
Merge branch 'PR/add-gdrive-ros-client' into develop/spot
sktometometo Nov 10, 2021
92b45e5
Support new version of voice_text API
mqcmd196 Nov 22, 2021
67bbc92
fix error handling
mqcmd196 Nov 23, 2021
ea20d34
set default library directory
mqcmd196 Nov 24, 2021
cc7c445
migrate api version to traditional source code
mqcmd196 Nov 24, 2021
6284a17
remove api source code
mqcmd196 Nov 24, 2021
4e82f41
support vt attributes
mqcmd196 Nov 24, 2021
1d7c9b5
update README to support new voice text API
mqcmd196 Nov 24, 2021
c9e36bd
fix member var bug
mqcmd196 Nov 24, 2021
be05704
Merge pull request #2 from mqcmd196/support_vtapi
sktometometo Nov 25, 2021
0ecdaae
[dialogflow_task_executive] support hotword yaml
sktometometo Dec 23, 2021
80fd614
[dialogflow_task_executive] fix bugs
sktometometo Dec 23, 2021
43c54b5
[dialogflow_task_executive] update
sktometometo Dec 30, 2021
f0a96a6
Revert "[dialogflow_task_executive] update"
sktometometo Dec 30, 2021
f290a8c
[dialogflow_task_executive] update to load rosparam after init_node
sktometometo Dec 30, 2021
ebf1163
Pr/spotdev/update webrtcvad ros (#4)
sktometometo Jan 28, 2022
8a6668e
[webrtcvad_ros] update
sktometometo Jan 31, 2022
5cac617
[.github] add pull request template
sktometometo Mar 7, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# 注意点

- 基本的に Pull Request のマージは Pull Request を出した人本人が行ってください。
- 壊すかもと思わず、壊れたらRevertすればいいやくらいの気持ちでマージしてください。
- 最悪 sktometometo がどうにかします。
- マージ前にレビューを依頼するかどうかは各位に任せます。わからなければ @sktometometo にレビューを依頼してください。
- マージ権限がなければ @sktometometo に権限を依頼してください。
50 changes: 35 additions & 15 deletions 3rdparty/voice_text/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,32 +28,51 @@ else()
if("${CMAKE_SIZEOF_VOID_P}" STREQUAL "4")
set(VT_LIB_PATH_OLD ${VT_ROOT}/bin/x86_32/RAMIO/libvt_jpn.so) # e.g., /usr/vt/sayaka/M16/bin/x86_32/RAMIO/libvt_jpn.so
set(VT_LIB_PATH_NEW ${VT_ROOT}/bin/LINUX32_GLIBC3/RAMIO/libvt_jpn.so) # e.g., /usr/vt/risa/H16/bin/LINUX32_GLIBC3/RAMIO/libvt_jpn.so
set(VT_LIB_PATH_FILEIO ${VT_ROOT}/bin/FILEIO/LINUX32_GLIBC3/libvt_jpn.so) # e.g., /usr/vt/hikari/D16/bin/FILEIO/LINUX32_GLIBC3/libvt_jpn.so
elseif("${CMAKE_SIZEOF_VOID_P}" STREQUAL "8")
set(VT_LIB_PATH_OLD ${VT_ROOT}/bin/x86_64/RAMIO/libvt_jpn.so) # e.g., /usr/vt/sayaka/M16/bin/x86_64/RAMIO/libvt_jpn.so
set(VT_LIB_PATH_NEW ${VT_ROOT}/bin/LINUX64_GLIBC3/RAMIO/libvt_jpn.so) # e.g., /usr/vt/risa/H16/bin/LINUX64_GLIBC3/RAMIO/libvt_jpn.so
set(VT_LIB_PATH_FILEIO ${VT_ROOT}/bin/FILEIO/LINUX64_GLIBC3/libvt_jpn.so) # e.g., /usr/vt/hikari/D16/bin/FILEIO/LINUX64_GLIBC3/libvt_jpn.so
endif()
if(EXISTS ${VT_LIB_PATH_OLD})
set(VT_LIB_PATH ${VT_LIB_PATH_OLD})
else()
if(EXISTS ${VT_LIB_PATH_NEW})
set(VT_LIB_PATH ${VT_LIB_PATH_NEW})
endif()
elseif(EXISTS ${VT_LIB_PATH_NEW})
set(VT_LIB_PATH ${VT_LIB_PATH_NEW})
elseif(EXISTS ${VT_LIB_PATH_FILEIO})
set(VT_LIB_PATH ${VT_LIB_PATH_FILEIO})
endif()
if(VT_LIB_PATH)
message(WARNING "VoiceText library is found at ${VT_LIB_PATH}")
message(WARNING "VoiceText Engine library is found at ${VT_LIB_PATH}")
else()
message(WARNING "VoiceText library is not found at ${VT_LIB_PATH_OLD} or ${VT_LIB_PATH_NEW}")
message(WARNING "VoiceText Engine library is not found at ${VT_LIB_PATH_OLD} or ${VT_LIB_PATH_NEW} or ${VT_LIB_PATH_FILE}")
endif()
endif()

# use traditional sdk or new api
set(VT_SDK_H ${VT_ROOT}/inc/vt_jpn.h)
set(VT_API_H ${VT_ROOT}/inc/vtapi.h)
if(EXISTS ${VT_SDK_H})
# use traditional sdk
message(WARNING "Using SDK because ${VT_SDK_H} was found.")
set(VT_INCLUDE ${VT_SDK_H})
elseif(EXISTS ${VT_API_H})
# use new api
message(WARNING "Using API because ${VT_SDK_H} was not found but ${VT_API_H} was found.")
string(REPLACE "/" ";" _VT_ROOT_SPLIT ${VT_ROOT})
list(GET _VT_ROOT_SPLIT 3 VT_SPEAKER)
list(GET _VT_ROOT_SPLIT 4 VT_TYPE)
set(VT_API_LIB_PATH ${VT_ROOT}/bin/libvtapi.so)
set(VT_INCLUDE ${VT_API_H})
endif()
configure_file(src/voice_text.cpp.in ${PROJECT_SOURCE_DIR}/src/voice_text.cpp)

include_directories(
${Boost_INCLUDE_DIRS}
${catkin_INCLUDE_DIRS}
)
add_executable(voice_text src/voice_text.cpp)
add_dependencies(voice_text ${PROJECT_NAME}_generate_messages_cpp ${PROJECT_NAME}_gencfg)
set_target_properties(voice_text PROPERTIES COMPILE_FLAGS -D_REENTRANT)
include_directories(
${Boost_INCLUDE_DIRS}
${catkin_INCLUDE_DIRS}
)
add_executable(voice_text src/voice_text.cpp)
add_dependencies(voice_text ${PROJECT_NAME}_generate_messages_cpp ${PROJECT_NAME}_gencfg)
set_target_properties(voice_text PROPERTIES COMPILE_FLAGS -D_REENTRANT)

if(NOT VT_LIB_PATH)
message(WARNING "Building dummy library")
Expand All @@ -64,10 +83,11 @@ if(NOT VT_LIB_PATH)
set(VT_LIB_PATH ${PROJECT_BINARY_DIR}/libvt_jpn.so)
endif()

target_link_libraries(voice_text
target_link_libraries(voice_text
${catkin_LIBRARIES}
${VT_LIB_PATH} -lm -lpthread
)
${VT_API_LIB_PATH} -lm -lpthread -ldl
)
if(NOT EXISTS ${VT_LIB_PATH})
add_dependencies(voice_text vt_dummy)
endif()
Expand Down
20 changes: 17 additions & 3 deletions 3rdparty/voice_text/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,23 @@ ROS Interface for HOYA VoiceText Speech Synthesis Engine

## Installation

1. Install VoiceText SDK
2. Put license file
3. Build this package
### 1. Install VoiceText SDK
#### If you have voicetext sdk install binary, please follow the official guide and install both engine and SDK
#### If you don't have the sdk install binary but have voice text API binary, please follow the guide below.
1. Install VoiceText Engine by official guide
2. Copy VoiceText API binaries to VoiceText binary directory
VoiceText API package includes binary libraries and header file. You have to copy those of them to specific directory by executing following commands.
```bash
cd /path_to_api_package_directory # e.g. cd ~/Downloads/RS_VTAPI_SDK_Linux_4.3.0.2/20201113_VTAPI4.3.0.2_LINUX
cd bin/x64 # You have to cd x86 if your system is x86 architecture
# Assuming VoiceText engine's talker is hikari, type is D16. If it is different, please set appropriate directory.
sudo cp -a * /usr/vt/hikari/D16/bin # Don't forget to add -a not to break symbolic link.
cd ../../include/
sudo mkdir /usr/vt/hikari/D16/inc # not include, but inc
sudo cp vtapi.h /usr/vt/hikari/D16/inc
```
### 2. Put license file
### 3. Build this package

```bash
cd /path/to/catkin_workspace
Expand Down
57 changes: 53 additions & 4 deletions 3rdparty/voice_text/src/voice_text.cpp.in
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
#ifdef USE_DUMMY_INCLUDE
#include "dummy/vt_dummy.h"
#else
#include "@VT_ROOT@/inc/vt_jpn.h"
#include "@VT_INCLUDE@"
#endif

namespace fs = boost::filesystem;
Expand All @@ -43,7 +43,13 @@ public:

~VoiceText() {
if (initialized_) {
#ifdef _VTAPI_H_
VTAPI_ReleaseHandle(this->hVTAPI);
VTAPI_UnloadEngine(this->hEngine);
VTAPI_Exit();
#else
VT_UNLOADTTS_JPN(-1);
#endif
}
}

Expand All @@ -62,16 +68,34 @@ public:
license_path_char = (char*)calloc(std::strlen(license_path_.c_str())+1, sizeof(char));
std::strcpy(license_path_char, license_path_.c_str());
}
#ifdef _VTAPI_H_
VTAPI_Init("@VT_ROOT@/bin"); // set voice_text binary library path because it loads them dynamically
this->hVTAPI = VTAPI_CreateHandle();
if (this->hVTAPI == 0) {
ROS_ERROR("VoiceText API ERROR when creating API handler. : %s\n", VTAPI_GetLastErrorInfo(0)->szMsg);
return false;
}
VTAPI_SetLicenseFolder(license_path_char);
// Load engine
this->hEngine = VTAPI_GetEngine("@VT_SPEAKER@", "@VT_TYPE@");
ret = VTAPI_SetEngineHandle(this->hVTAPI, this->hEngine);
if(ret < VTAPI_SUCCESS){
ROS_ERROR("VoiceText API ERROR when creating engine handler. CODE: %d, MESSAGE: %s \n", ret, VTAPI_GetLastErrorInfo(this->hVTAPI)->szMsg);
return false;
}
#else
ret = VT_LOADTTS_JPN((int)NULL, -1, db_path_char, license_path_char);
free(db_path_char);
if (!license_path_.empty()) free(license_path_char);
if (ret != VT_LOADTTS_SUCCESS) {
ROS_FATAL("Failed to load TTS engine (code %d)", ret);
if (ret == -1) {
ROS_FATAL("You must install voice_text library before building this library");
}
return false;
}
#endif

free(db_path_char);
if (!license_path_.empty()) free(license_path_char);

// advertise service
srv_ = nh_.advertiseService("text_to_speech", &VoiceText::text_to_speech, this);
Expand Down Expand Up @@ -101,6 +125,27 @@ public:
char* wave_char = (char*)calloc(std::strlen(req.wave_path.c_str())+1, sizeof(char));
std::strcpy(wave_char, req.wave_path.c_str());

#ifdef _VTAPI_H_
int ret;
// set attributes
VTAPI_SetAttr(this->hVTAPI, ATTR_PITCH, config_.pitch);
VTAPI_SetAttr(this->hVTAPI, ATTR_SPEED, config_.speed);
VTAPI_SetAttr(this->hVTAPI, ATTR_VOLUME, config_.volume);
VTAPI_SetAttr(this->hVTAPI, ATTR_PAUSE, config_.pause);
ret = VTAPI_SetOutputFile(this->hVTAPI, wave_char, FORMAT_16PCM_WAV);
if(ret != VTAPI_SUCCESS){
ROS_ERROR("VoiceText API ERROR when executing VTAPI_SetOutputFile. STATUS: %s\n", VTAPI_GetLastErrorInfo(this->hVTAPI)->szMsg);
res.ok = false;
}
// set input text file path
ret = VTAPI_TextToFile(this->hVTAPI, text_char, -1, TEXT_FORMAT_DEFAULT);
if(ret != VTAPI_SUCCESS){
ROS_ERROR("VoiceText API ERROR when executing VTAPI_TextToFile. STATUS: %s\n", VTAPI_GetLastErrorInfo(this->hVTAPI)->szMsg);
res.ok = false;
}
free(text_char);
free(wave_char);
#else
int ret = VT_TextToFile_JPN(VT_FILE_API_FMT_S16PCM_WAVE,
text_char,
wave_char,
Expand All @@ -113,12 +158,12 @@ public:

free(text_char);
free(wave_char);

if (ret != VT_FILE_API_SUCCESS) {
ROS_ERROR("Failed to execute tts: (code: %d)", ret);
res.ok = false;
return true;
}
#endif

res.ok = true;
return true;
Expand All @@ -131,6 +176,10 @@ public:
ros::ServiceServer srv_;
bool initialized_;
std::string db_path_, license_path_;
#ifdef _VTAPI_H_
VTAPI_HANDLE hVTAPI;
VTAPI_ENGINE_HANDLE hEngine;
#endif
};

int main(int argc, char** argv) {
Expand Down
13 changes: 11 additions & 2 deletions dialogflow_task_executive/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@ cmake_minimum_required(VERSION 2.8.3)
project(dialogflow_task_executive)

find_package(catkin REQUIRED COMPONENTS
catkin_virtualenv
message_generation
std_msgs
)

add_message_files(
FILES
DialogResponse.msg
ConversationText.msg
)

generate_messages(
Expand All @@ -20,10 +22,17 @@ catkin_package(
CATKIN_DEPENDS message_runtime
)

catkin_generate_virtualenv(
PYTHON_VERSION 3
)

install(DIRECTORY node_scripts
catkin_install_python(
PROGRAMS node_scripts/webhook_server.py
DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
)

install(FILES node_scripts/dialogflow_client.py node_scripts/task_executive.py
DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
USE_SOURCE_PERMISSIONS
)

install(DIRECTORY launch
Expand Down
77 changes: 77 additions & 0 deletions dialogflow_task_executive/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,14 @@ Your robot will execute the task from dialogflow.

![](./img/pr2_demo.gif)

### Use text prompt

Run text prompt script for text interface demo.

```bash
rosrun dialogflow_task_executive text_chat_prompt.py
```

## Upstart example

Edit a config file below and save it as `/etc/init/jsk-dialog.conf`
Expand Down Expand Up @@ -123,12 +131,81 @@ script
end script
```


## Enable Dialogflow webhook service(optional)

You can recieve the Dialogflow webhook response by `webhook_server.py`.
To use the node, you have to open the port and establish the SSL connection. If you've already opened 443 port but used by another process, you have to use haproxy.

### 1.Get SSL certificate

I recommend to use certbot. Please read the [official guide](https://certbot.eff.org/lets-encrypt/ubuntubionic-other).

### 2.(optional) Enable haproxy and establish forward proxy

If another processes use 443 port, you may use haproxy like [DigitalOceanGuide](https://www.digitalocean.com/community/tutorials/how-to-secure-haproxy-with-let-s-encrypt-on-ubuntu-14-04).

1. Install haproxy

```bash
sudo apt-get update
sudo apt-get install haproxy
```

2. Stop the haproxy service

```bash
sudo systemctl stop haproxy.service
```

3. Copy your pem file to haproxy directory and secure access

```bash
sudo mkdir -p /etc/haproxy/certs
DOMAIN='dialogflow.yourdomain.com' sudo -E bash -c 'cat /etc/letsencrypt/live/$DOMAIN/fullchain.pem /etc/letsencrypt/live/$DOMAIN/privkey.pem > /etc/haproxy/certs/$DOMAIN.pem'
sudo chmod -R go-rwx /etc/haproxy/certs
```

4. Write your `haproxy.cfg` file like [this](https://gist.github.com/mqcmd196/be29f2136b62a7d74d6c3f6c7673b114) and save at `/etc/haproxy/`

5. Run the haproxy service

```bash
sudo systemctl start haproxy.service
```

### 3.setup dialogflow_task_exective webhook_server

Your server's host name, port, certfile and keyfile should be passed to the node. The example `dialogflow_task_executive/config/webhook.json`, is as follows:

```json
{
"host": "dialogflow.yourdomain.com",
"port": 8090
"certfile": "/path/to/your/server.crt"
"keyfile": "/path/to/your/server.key"
}
```

It is true that `certfile` and `keyfile` are at `/etc/letsencrypt/live/$DOMAIN/`, however non-root users are not permitted to read the file. To avoid it, you exec
```bash
DOMAIN='dialogflow.yourdomain.com' sudo -E bash -c 'cat /etc/letsencrypt/live/$DOMAIN/fullchain.pem > /path/to/your/server.pem'
DOMAIN='dialogflow.yourdomain.com' sudo -E bash -c 'cat /etc/letsencrypt/live/$DOMAIN/privkey.pem > /path/to/your/server.key'
```
To secure the file, you exec
```bash
sudo chmod go-rwx /path/to/your/server.crt
sudo chmod go-rwx /path/to/your/server.key
```

## Author

Yuki Furuta <[email protected]>

Shingo Kitagawa <[email protected]>

Yoshiki Obinata <[email protected]>

## License

BSD
3 changes: 3 additions & 0 deletions dialogflow_task_executive/apps/app.installed
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
apps:
- app: dialogflow_task_executive/sample_app
display: sample dialogflow app
4 changes: 4 additions & 0 deletions dialogflow_task_executive/apps/sample_app/sample_app.app
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
display: sample dialogflow app
platform: dummy
launch: dialogflow_task_executive/sample_app.xml
interface: dialogflow_task_executive/sample_app.interface
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
published_topics: {}
subscribed_topics: {}
6 changes: 6 additions & 0 deletions dialogflow_task_executive/apps/sample_app/sample_app.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<launch>
<arg name="place" default="Tokyo"/>
<node name="sample_app_print" pkg="dialogflow_task_executive" type="sample_app_print.py" output="screen">
<param name="place" value="$(arg place)"/>
</node>
</launch>
3 changes: 3 additions & 0 deletions dialogflow_task_executive/config/dialogflow_hotword.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
- ねえねえ
- こんにちは
- やあ
Loading