test_intent_event.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 
3 import rospy
4 from dialogflow_ros import DialogflowClient
5 from dialogflow_ros.msg import *
6 from dialogflow_v2beta1.types import EventInput, QueryInput
7 from google.protobuf import struct_pb2
8 import datetime
9 
10 if __name__ == '__main__':
11  rospy.init_node('test_intent_text', log_level=rospy.DEBUG)
12  dc = DialogflowClient()
13 
14  # parameters = struct_pb2.Struct()
15  # hour = datetime.datetime.now().hour
16  # minute = datetime.datetime.now().minute
17  # parameters['time'] = "{}:{}".format(hour, minute)
18  # event_input = EventInput(name='GET_TIME', parameters=parameters,
19  # language_code=dc.get_language_code())
20  # print(dc.event_intent(event_input))
21 
22  # parameters = struct_pb2.Struct()
23  # parameters['objects'] = ['snack', 'milk']
24  # event_input = EventInput(name='objects_found', parameters=parameters,
25  # language_code=dc.get_language_code())
26 
27  event_name = 'objects_found'
28  parameters = DialogflowParameter(param_name='objects', value=['snack', 'milk'])
29  event_input = DialogflowEvent(event_name=event_name,
30  parameters=[parameters])
31  print(dc.event_intent(event_input))


dialogflow_ros
Author(s): Anas Abou Allaban
autogenerated on Mon Jun 10 2019 13:02:59