Skip to content

Commit

Permalink
Merge pull request #27 from robotology/GoogleDialogModule
Browse files Browse the repository at this point in the history
Added Google Dialog Module
  • Loading branch information
vtikha authored Oct 8, 2020
2 parents b5f6ab5 + 969452e commit 186f5ca
Show file tree
Hide file tree
Showing 14 changed files with 502 additions and 6 deletions.
6 changes: 5 additions & 1 deletion speechInteraction/cmake/FindGOOGLEAPIS.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,18 @@ file(GLOB google_longrunning ${googleapis_INCLUDE_DIR}/google/longrunning/*.pb.c
file(GLOB google_protobuf ${googleapis_INCLUDE_DIR}/google/protobuf/*.pb.cc)
file(GLOB google_language ${googleapis_INCLUDE_DIR}/google/cloud/language/v1/*.pb.cc)
file(GLOB google_texttospeech ${googleapis_INCLUDE_DIR}/google/cloud/texttospeech/v1/*.pb.cc)
file(GLOB google_dialogflow ${googleapis_INCLUDE_DIR}/google/cloud/dialogflow/cx/v3beta1/*.pb.cc)
file(GLOB google_type ${googleapis_INCLUDE_DIR}/google/type/*.pb.cc)

set(googleAPIsrc ${google_api}
${google_rpc}
${google_speech}
${google_longrunning}
${google_protobuf}
${google_language}
${google_texttospeech})
${google_dialogflow}
${google_texttospeech}
${google_type})

include(FindPackageHandleStandardArgs)

Expand Down
1 change: 1 addition & 0 deletions speechInteraction/modules/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@
add_subdirectory(googleSpeech)
add_subdirectory(googleSpeechProcess)
add_subdirectory(googleSynthesis)
add_subdirectory(googleDialog)
29 changes: 29 additions & 0 deletions speechInteraction/modules/googleDialog/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Copyright (C) 2019 Fondazione Istituto Italiano di Tecnologia (IIT)
# All Rights Reserved.
# Authors: Vadim Tikhanoff <[email protected]>

project(googleDialog)

yarp_add_idl(IDL_GEN_FILES ${PROJECT_NAME}.thrift)

set(idl ${PROJECT_NAME}.thrift)
set(doc_files ${PROJECT_NAME}.xml)

source_group("Source Files" FILES ${source})
source_group("Header Files" FILES ${header})
source_group("IDL Files" FILES ${idl})
source_group("DOC Files" FILES ${doc})

add_executable(${PROJECT_NAME} main.cpp ${idl} ${IDL_GEN_FILES} ${doc} ${GRPC_SRCS} ${GRPC_HDRS} )

message("GRPC_INCLUDE_DIRS = ${GRPC_INCLUDE_DIRS}")
message("GRPC_LIBRARIES = ${GRPC_LIBRARIES}")
message("googleAPIsrc = ${googleAPIsrc}")

target_include_directories(${PROJECT_NAME} PRIVATE ${PROJECT_SOURCE_DIR}/include)
#target_link_libraries(${PROJECT_NAME} ${YARP_LIBRARIES} ${GRPC_LIBRARIES} googleAPI )
target_link_libraries(${PROJECT_NAME} ${YARP_LIBRARIES} googleAPI libprotobuf.so libgrpc++.so libgrpc++_alts.so libgrpc++_error_details.so libgrpc++_reflection.so libgrpc_plugin_support.so libgrpcpp_channelz.so )
install(TARGETS ${PROJECT_NAME} DESTINATION bin)
yarp_install(FILES DESTINATION ${ICUBCONTRIB_MODULES_INSTALL_DIR})

add_subdirectory(app)
2 changes: 2 additions & 0 deletions speechInteraction/modules/googleDialog/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Google Cloud Text to Speech API with YARP
==========================
10 changes: 10 additions & 0 deletions speechInteraction/modules/googleDialog/app/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Copyright (C) 2019 Fondazione Istituto Italiano di Tecnologia (IIT)
# All Rights Reserved.
# Authors: Vadim Tikhanoff <[email protected]>

file(GLOB conf ${CMAKE_CURRENT_SOURCE_DIR}/conf/*.ini)

file(GLOB scripts ${CMAKE_CURRENT_SOURCE_DIR}/scripts/*.xml)

yarp_install(FILES ${conf} DESTINATION ${ICUBCONTRIB_CONTEXTS_INSTALL_DIR}/${PROJECT_NAME})
yarp_install(FILES ${scripts} DESTINATION ${ICUBCONTRIB_APPLICATIONS_INSTALL_DIR})
3 changes: 3 additions & 0 deletions speechInteraction/modules/googleDialog/app/conf/config.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
name googleDialog
language_code en-US
sample_rate_hertz 16000
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<application>
<name>Google_Dialog</name>

<dependencies>
</dependencies>

<module>
<name>yarpdev</name>
<parameters>--device AudioRecorderWrapper --context startAudio --from startaudio.ini --channels 1 --rate 16000 --samples 16000</parameters>
<node>localhost</node>
</module>

<module>
<name>googleSpeech</name>
<parameters>--language_code it-IT</parameters>
<node>localhost</node>
</module>

<module>
<name>googleSpeechProcess</name>
<node>localhost</node>
</module>

<connection>
<from>/microphone/audio:o</from>
<to>/googleSpeech/sound:i</to>
<protocol>tcp</protocol>
</connection>

<connection>
<from>/googleSpeech/commands:rpc</from>
<to>/microphone/rpc</to>
<protocol>tcp</protocol>
</connection>

<connection>
<from>/googleSpeech/result:o</from>
<to>/googleSpeechProcess/text:i</to>
<protocol>tcp</protocol>
</connection>


</application>
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<application>
<name>Google_Speech_Processing</name>

<dependencies>
</dependencies>

<module>
<name>yarpdev</name>
<parameters>--device AudioRecorderWrapper --context startAudio --from startaudio.ini --channels 1 --rate 16000 --samples 16000</parameters>
<node>localhost</node>
</module>

<module>
<name>googleSpeech</name>
<parameters>--language_code it-IT</parameters>
<node>localhost</node>
</module>

<module>
<name>googleSpeechProcess</name>
<node>localhost</node>
</module>

<connection>
<from>/microphone/audio:o</from>
<to>/googleSpeech/sound:i</to>
<protocol>tcp</protocol>
</connection>

<connection>
<from>/googleSpeech/commands:rpc</from>
<to>/microphone/rpc</to>
<protocol>tcp</protocol>
</connection>

<connection>
<from>/googleSpeech/result:o</from>
<to>/googleSpeechProcess/text:i</to>
<protocol>tcp</protocol>
</connection>


</application>
27 changes: 27 additions & 0 deletions speechInteraction/modules/googleDialog/googleDialog.thrift
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Copyright (C) 2019 Fondazione Istituto Italiano di Tecnologia (IIT)
# All Rights Reserved.
# Authors: Vadim Tikhanoff <[email protected]>
#
# googleDialog.thrift

/**
* googleDialog_IDL
*
* IDL Interface to google cloud speech processing.
*/

struct Bottle {
} (
yarp.name = "yarp::os::Bottle"
yarp.includefile = "yarp/os/Bottle.h"
)

service googleDialog_IDL
{
/**
* Quit the module.
* @return true/false on success/failure
*/
bool quit();

}
53 changes: 53 additions & 0 deletions speechInteraction/modules/googleDialog/googleDialog.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<?xml-stylesheet type="text/xsl" href="yarpmanifest.xsl"?>

<module>
<name>googleDiaglog</name>
<doxygen-group>googleDiaglog</doxygen-group>
<description>This module is responsible for dialoging with goog dialog flow</description>
<copypolicy> Released under the terms of the BSD 3-Clause License.</copypolicy>
<version>0.3.0</version>

<description-long>
This module This module communicates with the dialogflow google service.
</description-long>

<arguments>
<param default="googleDiaglog" desc="Module's name; all the open ports will be tagged with the prefix /name.">name</param>

</arguments>

<authors>
<author email="ilaria.carlini@@iit.it"> Ilaria Carlini</author>
<author email="[email protected]"> Laura Cavaliere </author>
<author email="[email protected]"> Vadim Tikhanoff </author>
</authors>

<data>
<input>
<type>Bottle</type>
<port>/googleDialog/text:i</port>
<description>
Port to receive end-user expression
</description>
</input>
<output>
<type>Bottle</type>
<port>/googleDialog/result:o</port>
<description>
Sends the response from the agent
</description>
</output>
</data>

<services>
<server>
<type>googleDiaglog_IDL</type>
<idl>idl.thrift</idl>
<port>/googleDiaglog/rpc</port>
<description>service port</description>
</server>
</services>

</module>

Loading

0 comments on commit 186f5ca

Please sign in to comment.